home *** CD-ROM | disk | FTP | other *** search
/ Introducing the New Way to Shop from Home / Iceland.iso / pc / unipower / Data1.cab / IcelandGroceryOffline.xml1 < prev    next >
Text File  |  2003-03-05  |  207KB  |  4,910 lines

  1. <models>
  2.     <model name="IcelandOffline">
  3.         <dataconnections>
  4.             <dataconnection name="Grocery" type="dcserver" connectionstring="IcelandOffline"/>
  5.             <dataconnection name="WWWRoot" type="file" connectionstring="%SMRuntime\Applications\IcelandOffline\HTTPServer_Virtual_Directory%" />
  6.             <dataconnection name="StoreContent" type="file" connectionstring="%SMRuntime\Applications\IcelandOfflineStoreContent\HTTPServer_Virtual_Directory%" />
  7.         </dataconnections>
  8.         <objects>
  9.             <object name="Address">
  10.                 <datasource>
  11.                     <query id="CustomerAddress" default="true">
  12.                         <select name="SELECT
  13.     AddressID,
  14.     CustomerID,
  15.     AddressTypeID,
  16.     Street,
  17.     Area,
  18.     Town,
  19.     County,
  20.     Postcode,
  21.     DeliveryNote,
  22.     ShowTerms,
  23.     StoreID,
  24.     ZoneID,
  25.     HouseName    
  26.  
  27. FROM Address
  28. WHERE CustomerID = @CustomerID AND AddressTypeID = @AddressTypeID" connection="Grocery" type="replace" use="raw">
  29.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  30.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  31.                         </select>
  32.                         <insert name="INSERT INTO Address(
  33.     CustomerID,
  34.     AddressTypeID,
  35.     Street,
  36.     Area,
  37.     Town,
  38.     County,
  39.     PostCode,
  40.     DeliveryNote,
  41.     ShowTerms,
  42.     StoreID,
  43.     HouseName )
  44.  
  45. VALUES(
  46.     @CustomerID,
  47.     @AddressTypeID,
  48.     @Street,
  49.     @Area,
  50.     @Town,
  51.     @County,
  52.     @PostCode,
  53.     @DeliveryNote,
  54.     @ShowTerms,
  55.     @StoreID,
  56.     @HouseName )
  57. " connection="Grocery" type="replace" use="raw">
  58.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  59.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  60.                             <parameter name="HouseName" datatype="string" direction="in"/>
  61.                             <parameter name="Street" datatype="string" direction="in"/>
  62.                             <parameter name="Area" datatype="string" direction="in"/>
  63.                             <parameter name="Town" datatype="string" direction="in"/>
  64.                             <parameter name="County" datatype="string" direction="in"/>
  65.                             <parameter name="Postcode" datatype="string" direction="in"/>
  66.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  67.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  68.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  69.                         </insert>
  70.                         <update name="UPDATE Address 
  71. SET     Street = @Street,
  72.     AddressTypeID =@AddressTypeID,
  73.     Area = @Area,
  74.     Town = @Town,
  75.     County = @County,
  76.     Postcode = @Postcode,
  77.     DeliveryNote = @DeliveryNote,
  78.     ShowTerms = @ShowTerms,
  79.     StoreID     = @StoreID,
  80.     HouseName = @HouseName
  81.  
  82. WHERE CustomerID = @CustomerID AND  AddressID = @AddressID" connection="Grocery" type="replace" use="raw">
  83.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  84.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  85.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  86.                             <parameter name="HouseName" datatype="string" direction="in"/>
  87.                             <parameter name="Street" datatype="string" direction="in"/>
  88.                             <parameter name="Area" datatype="string" direction="in"/>
  89.                             <parameter name="Town" datatype="string" direction="in"/>
  90.                             <parameter name="County" datatype="string" direction="in"/>
  91.                             <parameter name="Postcode" datatype="string" direction="in"/>
  92.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  93.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  94.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  95.                         </update>
  96.                         <delete name="DELETE FROM Address
  97. WHERE AddressTypeID = @AddressTypeID AND CustomerID = @CustomerID
  98.  
  99. " connection="Grocery" type="replace" use="raw">
  100.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  101.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  102.                         </delete>
  103.                     </query>
  104.                     <query id="AddressByID" default="false">
  105.                         <select name="SELECT
  106.     AddressID,
  107.     CustomerID,
  108.     AddressTypeID,
  109.     Street,
  110.     Area,
  111.     Town,
  112.     County,
  113.     Postcode,
  114.     DeliveryNote,
  115.     ShowTerms,
  116.     StoreID,
  117.     ZoneID,
  118.     HouseName    
  119. FROM Address
  120. WHERE  AddressID = @AddressID
  121. " connection="Grocery" type="replace" use="raw">
  122.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  123.                         </select>
  124.                         <update name="UPDATE Address 
  125. SET     HouseName = @HouseName,
  126.     Street = @Street,
  127.     Area = @Area,
  128.     Town = @Town,
  129.     County = @County,
  130.     Postcode = @Postcode,
  131.     DeliveryNote = @DeliveryNote,
  132.     ShowTerms = @ShowTerms,
  133.     StoreID       = @StoreID
  134.  
  135. WHERE AddressID = @AddressID
  136. " connection="Grocery" type="replace" use="raw">
  137.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  138.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  139.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  140.                             <parameter name="HouseName" datatype="string" direction="in"/>
  141.                             <parameter name="Street" datatype="string" direction="in"/>
  142.                             <parameter name="Area" datatype="string" direction="in"/>
  143.                             <parameter name="Town" datatype="string" direction="in"/>
  144.                             <parameter name="County" datatype="string" direction="in"/>
  145.                             <parameter name="Postcode" datatype="string" direction="in"/>
  146.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  147.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  148.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  149.                         </update>
  150.                         <delete name="DELETE FROM Address
  151. WHERE AddressID = @AddressID
  152. " connection="Grocery" type="replace" use="raw">
  153.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  154.                         </delete>
  155.                     </query>
  156.                     <query id="CustomerAddresses" default="false">
  157.                         <select name="SELECT
  158.     Address.AddressID,
  159.     Address.CustomerID,
  160.     AddressType.AddressTypeID,
  161.     Address.Street,
  162.     Address.Area,
  163.     Address.Town,
  164.     Address.County,
  165.     Address.Postcode,
  166.     Address.DeliveryNote,
  167.     Address.ShowTerms,
  168.     Address.StoreID,
  169.     Address.ZoneID,
  170.     Address.HouseName    
  171.  
  172. FROM AddressType
  173. INNER JOIN Address
  174. ON AddressType.AddressTypeID = Address.AddressTypeID
  175. WHERE Address.AddressTypeID < 6 
  176. AND Address.CustomerID = @CustomerID
  177.  
  178. " connection="Grocery" type="replace" use="raw">
  179.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  180.                         </select>
  181.                         <insert name="INSERT INTO Address(
  182.     CustomerID,
  183.     AddressTypeID,
  184.     Street,
  185.     Area,
  186.     Town,
  187.     County,
  188.     PostCode,
  189.     DeliveryNote,
  190.     ShowTerms,
  191.     StoreID,
  192.     HouseName )
  193.  
  194. VALUES(
  195.     @CustomerID,
  196.     @AddressTypeID,
  197.     @Street,
  198.     @Area,
  199.     @Town,
  200.     @County,
  201.     @PostCode,
  202.     @DeliveryNote,
  203.     @ShowTerms,
  204.     @StoreID,
  205.     @HouseName )
  206. " connection="Grocery" type="replace" use="raw">
  207.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  208.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  209.                             <parameter name="HouseName" datatype="string" direction="in"/>
  210.                             <parameter name="Street" datatype="string" direction="in"/>
  211.                             <parameter name="Area" datatype="string" direction="in"/>
  212.                             <parameter name="Town" datatype="string" direction="in"/>
  213.                             <parameter name="County" datatype="string" direction="in"/>
  214.                             <parameter name="Postcode" datatype="string" direction="in"/>
  215.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  216.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  217.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  218.                         </insert>
  219.                         <update name="UPDATE Address 
  220. SET    AddressTypeID =@AddressTypeID,
  221.     HouseName = @HouseName,
  222.     Street = @Street,
  223.     Area = @Area,
  224.     Town = @Town,
  225.     County = @County,
  226.     Postcode = @Postcode,
  227.     DeliveryNote = @DeliveryNote,
  228.     ShowTerms = @ShowTerms,
  229.     StoreID     = @StoreID
  230.  
  231. WHERE CustomerID = @CustomerID AND  AddressID = @AddressID
  232. " connection="Grocery" type="replace" use="raw">
  233.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  234.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  235.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  236.                             <parameter name="HouseName" datatype="string" direction="in"/>
  237.                             <parameter name="Street" datatype="string" direction="in"/>
  238.                             <parameter name="Area" datatype="string" direction="in"/>
  239.                             <parameter name="Town" datatype="string" direction="in"/>
  240.                             <parameter name="County" datatype="string" direction="in"/>
  241.                             <parameter name="Postcode" datatype="string" direction="in"/>
  242.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  243.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  244.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  245.                         </update>
  246.                         <delete name="DELETE FROM Address
  247. WHERE AddressTypeID = @AddressTypeID AND CustomerID = @CustomerID
  248. " connection="Grocery" type="replace" use="raw">
  249.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  250.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  251.                         </delete>
  252.                     </query>
  253.                     <query id="AddressesByStoreGroup" default="false">
  254.                         <select name="SELECT
  255.     Address.AddressID,
  256.     Address.CustomerID,
  257.     Address.AddressTypeID,
  258.     Address.Street,
  259.     Address.Area,
  260.     Address.Town,
  261.     Address.County,
  262.     Address.Postcode,
  263.     Address.DeliveryNote,
  264.     Address.ShowTerms,
  265.     Address.StoreID,
  266.     Address.ZoneID,
  267.     Address.HouseName
  268.     
  269. FROM  Address 
  270. INNER JOIN  StoreInStoreGroup  
  271. ON Address.StoreID = StoreInStoreGroup.StoreID
  272. WHERE  StoreInStoreGroup.StoreGroupID = @StoreGroupID
  273. " connection="Grocery" type="replace" use="raw">
  274.                             <parameter name="StoreGroupID" datatype="integer" direction="in"/>
  275.                         </select>
  276.                         <update name="UPDATE Address 
  277. SET    AddressTypeID =@AddressTypeID,
  278.     HouseName = @HouseName,
  279.     Street = @Street,
  280.     Area = @Area,
  281.     Town = @Town,
  282.     County = @County,
  283.     Postcode = @Postcode,
  284.     DeliveryNote = @DeliveryNote,
  285.     ShowTerms = @ShowTerms,
  286.     StoreID     = @StoreID
  287.  
  288. WHERE CustomerID = @CustomerID AND  AddressID = @AddressID
  289. " connection="Grocery" type="replace" use="raw">
  290.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  291.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  292.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  293.                             <parameter name="HouseName" datatype="string" direction="in"/>
  294.                             <parameter name="Street" datatype="string" direction="in"/>
  295.                             <parameter name="Area" datatype="string" direction="in"/>
  296.                             <parameter name="Town" datatype="string" direction="in"/>
  297.                             <parameter name="County" datatype="string" direction="in"/>
  298.                             <parameter name="Postcode" datatype="string" direction="in"/>
  299.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  300.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  301.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  302.                         </update>
  303.                     </query>
  304.                     <query id="CustomerAddressesByStoreGroup" default="false">
  305.                         <select name="SELECT
  306.     Address.AddressID,
  307.     Address.CustomerID,
  308.     Address.AddressTypeID,
  309.     Address.Street,
  310.     Address.Area,
  311.     Address.Town,
  312.     Address.County,
  313.     Address.Postcode,
  314.     Address.DeliveryNote,
  315.     Address.ShowTerms,
  316.     Address.StoreID,
  317.     Address.ZoneID,
  318.     Address.HouseName
  319.  
  320. FROM  Address 
  321. INNER JOIN StoreInStoreGroup  
  322. ON Address.StoreID = StoreInStoreGroup.StoreID
  323. WHERE  StoreInStoreGroup.StoreGroupID = @StoreGroupID
  324. AND  Address.CustomerID  = @CustomerID
  325. " connection="Grocery" type="replace" use="raw">
  326.                             <parameter name="StoreGroupID" datatype="integer" direction="in"/>
  327.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  328.                         </select>
  329.                         <update name="UPDATE Address 
  330. SET    AddressTypeID =@AddressTypeID,
  331.     HouseName = @HouseName,
  332.     Street = @Street,
  333.     Area = @Area,
  334.     Town = @Town,
  335.     County = @County,
  336.     Postcode = @Postcode,
  337.     DeliveryNote = @DeliveryNote,
  338.     ShowTerms = @ShowTerms,
  339.     StoreID     = @StoreID
  340.  
  341. WHERE CustomerID = @CustomerID AND  AddressID = @AddressID
  342. " connection="Grocery" type="replace" use="raw">
  343.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  344.                             <parameter name="AddressID" datatype="integer" direction="in"/>
  345.                             <parameter name="AddressTypeID" datatype="integer" direction="in"/>
  346.                             <parameter name="HouseName" datatype="string" direction="in"/>
  347.                             <parameter name="Street" datatype="string" direction="in"/>
  348.                             <parameter name="Area" datatype="string" direction="in"/>
  349.                             <parameter name="Town" datatype="string" direction="in"/>
  350.                             <parameter name="County" datatype="string" direction="in"/>
  351.                             <parameter name="Postcode" datatype="string" direction="in"/>
  352.                             <parameter name="DeliveryNote" datatype="string" direction="in"/>
  353.                             <parameter name="ShowTerms" datatype="boolean" direction="in"/>
  354.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  355.                         </update>
  356.                     </query>
  357.                 </datasource>
  358.                 <properties>
  359.                     <property name="AddressID" alias="AddressID" datatype="integer" nullable="false" pkey="true"/>
  360.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="true"/>
  361.                     <property name="AddressTypeID" alias="AddressTypeID" datatype="integer" nullable="false" pkey="true"/>
  362.                     <property name="HouseName" alias="HouseName" datatype="string" nullable="false"/>
  363.                     <property name="Street" alias="Street" datatype="string" nullable="false"/>
  364.                     <property name="Area" alias="Area" datatype="string" nullable="true"/>
  365.                     <property name="Town" alias="Town" datatype="string" nullable="false"/>
  366.                     <property name="County" alias="County" datatype="string" nullable="true"/>
  367.                     <property name="Postcode" alias="Postcode" datatype="string" nullable="false"/>
  368.                     <property name="DeliveryNote" alias="DeliveryNote" datatype="string" nullable="true"/>
  369.                     <property name="ShowTerms" alias="ShowTerms" datatype="boolean" nullable="false"/>
  370.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="true"/>
  371.                     <property name="ZoneID" alias="ZoneID" datatype="integer" nullable="true"/>
  372.                     <property name="StoreGroupID" alias="StoreGroupID" datatype="integer" nullable="true"/>
  373.                 </properties>
  374.                 <relationships>
  375.                     <relationship name="AddressByID" object="Address" keyprop="none" collection="false" query="AddressByID">
  376.                         <key pkey="AddressID" fkey="AddressID" from="parent" to="child"/>
  377.                     </relationship>
  378.                     <relationship name="AddressesByStoreGroup" object="Address" keyprop="none" collection="true" query="AddressesByStoreGroup">
  379.                         <key pkey="StoreGroupID" fkey="StoreGroupID" from="parent" to="child"/>
  380.                     </relationship>
  381.                     <relationship name="CustomerAddressesByStoreGroup" object="Address" keyprop="none" collection="true" query="CustomerAddressesByStoreGroup">
  382.                         <key pkey="StoreGroupID" fkey="StoreGroupID" from="parent" to="child"/>
  383.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  384.                     </relationship>
  385.                 </relationships>
  386.             </object>
  387.             <object name="Basket">
  388.                 <datasource>
  389.                     <query id="CustomerBasket" default="true">
  390.                         <select name="SELECT @CustomerID AS CustomerID, @StoreID AS StoreID
  391. FROM Customer
  392. WHERE CustomerID=@CustomerID
  393. " connection="Grocery" type="replace" use="raw">
  394.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  395.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  396.                         </select>
  397.                         <delete name="DELETE FROM BasketItem 
  398. WHERE CustomerID = @CustomerID
  399. " connection="Grocery" type="replace" use="raw">
  400.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  401.                         </delete>
  402.                     </query>
  403.                 </datasource>
  404.                 <properties>
  405.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  406.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="true"/>
  407.                     <property name="PromoReduction" alias="PromoReduction" datatype="money" nullable="true"/>
  408.                     <property name="LoyaltyPoints" alias="LoyaltyPoints" datatype="integer" nullable="true"/>
  409.                     <property name="BasketTotal" alias="BasketTotal" datatype="money" nullable="true"/>
  410.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="date" nullable="true"/>
  411.                 </properties>
  412.                 <relationships>
  413.                     <relationship name="Items" object="BasketItem" keyprop="none" collection="true" query="CustomerBasketItems">
  414.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  415.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  416.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  417.                     </relationship>
  418.                     <relationship name="Promos" object="Promo" keyprop="none" collection="true" query="StoreBasketPromos">
  419.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  420.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  421.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  422.                     </relationship>
  423.                     <relationship name="BasketPromos" object="Promo" keyprop="none" collection="true" query="BasketPromos">
  424.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  425.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  426.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  427.                     </relationship>
  428.                 </relationships>
  429.                 <methods>
  430.                     <method name="BasketToOrder" returntype="integer" uuid="IcelandGrocery.Basket" implname="BasketToOrder">
  431.                         <parameter name="OrderID" datatype="integer" direction="in"/>
  432.                     </method>
  433.                     <method name="CalcPromos" returntype="object" uuid="IcelandGrocery.Basket" implname="CalcPromos">
  434.                         <parameter name="IsCheckout" datatype="boolean" direction="in"/>
  435.                     </method>
  436.                 </methods>
  437.             </object>
  438.             <object name="BasketItem">
  439.                 <datasource>
  440.                     <query id="CustomerBasketItems" default="false">
  441.                         <select name="SELECT DISTINCT
  442.     BasketItem.BasketItemID,
  443.     BasketItem.CustomerID,
  444.     BasketItem.Quantity,
  445.     BasketItem.ItemNo,
  446.     BasketItem.Note,
  447.     BasketItem.UnitID AS BasketUnitID,
  448.     Product.ProductID,
  449.     Product.Name,
  450.     Product.Description,
  451.     Product.PackSize,
  452.     Product.UnitSize,
  453.     Product.UnitID,
  454.     Product.HasLabelData,
  455.     ProductInStore.CaseDealImageID,
  456.     Product.CaseDealParentID,
  457.     ProductInStore.ComparativeSizeInfo,
  458.     ProductInStore.AddedVal,
  459.     ProductInStore.Saving,
  460.     ProductInStore.IsNew,
  461.     ProductInStore.IsCaseDealParent,
  462.     ProductInStore.Price,
  463.     ProductInStore.StoreID AS IsAvailable,
  464.     ProductInStore.IntroductionDate,
  465.     ProductOptionValue.ProductID AS HasOptions,
  466.     BasketItem.UpdateTime
  467. FROM BasketItem
  468.  
  469. INNER JOIN Product
  470. ON BasketItem.ProductID = Product.ProductID 
  471. LEFT JOIN ProductInStore
  472. ON Product.ProductID = ProductInStore.ProductID
  473. LEFT JOIN ProductOptionValue
  474. ON ProductOptionValue.ProductID = Product.ProductID
  475.  
  476. WHERE   BasketItem.CustomerID = @CustomerID
  477. AND @IntroductionDate != NULL 
  478. AND ProductInStore.StoreID = @StoreID 
  479. AND ProductInStore.IntroductionDate <= @IntroductionDate
  480.  
  481. ORDER BY 
  482. BasketItem.UpdateTime DES, 
  483. BasketItem.ItemNo DES, 
  484. ProductInStore.IntroductionDate DES
  485. " connection="Grocery" type="replace" use="raw">
  486.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  487.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  488.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  489.                         </select>
  490.                         <insert name="INSERT INTO BasketItem(
  491.     CustomerID,
  492.     ProductID,
  493.     Quantity,
  494.     UnitID,
  495.     ItemNo,
  496.     Note)
  497.  
  498. VALUES(
  499.     @CustomerID,
  500.     @ProductID,
  501.     @Quantity,
  502.     @UnitID,
  503.     @ItemNo,
  504.     @Note )
  505. SELECT @@IDENTITY AS BasketItemID
  506.  
  507. " connection="Grocery" type="replace" use="raw">
  508.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  509.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  510.                             <parameter name="Quantity" datatype="float" direction="in"/>
  511.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  512.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  513.                             <parameter name="Note" datatype="string" direction="in"/>
  514.                         </insert>
  515.                         <update name="UPDATE BasketItem
  516. SET     ProductID = @ProductID,
  517.     Quantity = @Quantity,
  518.     UnitID = @UnitID,
  519.     Note = @Note,
  520.     UpdateTime=GETDATE() 
  521.     WHERE CustomerID = @CustomerID AND ItemNo = @ItemNo
  522. " connection="Grocery" type="replace" use="raw">
  523.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  524.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  525.                             <parameter name="Quantity" datatype="float" direction="in"/>
  526.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  527.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  528.                             <parameter name="Note" datatype="string" direction="in"/>
  529.                         </update>
  530.                         <delete name="DELETE FROM BasketItem 
  531. WHERE CustomerID = @CustomerID AND ItemNo = @ItemNo
  532. " connection="Grocery" type="replace" use="raw">
  533.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  534.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  535.                         </delete>
  536.                     </query>
  537.                     <query id="CustomerBasketItem" default="true">
  538.                         <select name="SELECT DISTINCT
  539.     BasketItem.BasketItemID,
  540.     BasketItem.CustomerID,
  541.     BasketItem.Quantity,
  542.     BasketItem.ItemNo,
  543.     BasketItem.Note,
  544.     BasketItem.UnitID AS BasketUnitID,
  545.     Product.ProductID,
  546.     Product.Name,
  547.     Product.Description,
  548.     Product.PackSize,
  549.     Product.UnitSize,
  550.     Product.UnitID,
  551.     Product.HasLabelData,
  552.     ProductInStore.IsCaseDealParent,
  553.     ProductInStore.CaseDealImageID,
  554.     Product.CaseDealParentID,
  555.     ProductInStore.ComparativeSizeInfo,
  556.     ProductInStore.AddedVal,
  557.     ProductInStore.Saving,
  558.     ProductInStore.IsNew,
  559.     ProductInStore.Price,
  560.     ProductInStore.StoreID AS IsAvailable,
  561.     ProductInStore.IntroductionDate,
  562.     ProductOptionValue.ProductID AS HasOptions
  563.  
  564. FROM BasketItem
  565. INNER JOIN Product
  566. ON BasketItem.ProductID = Product.ProductID 
  567. LEFT JOIN ProductInStore
  568. ON Product.ProductID = ProductInStore.ProductID
  569. LEFT JOIN ProductOptionValue
  570. ON ProductOptionValue.ProductID = Product.ProductID
  571. WHERE
  572. BasketItem.CustomerID = @CustomerID
  573. AND BasketItem.ItemNo = @ItemNo
  574. AND @IntroductionDate != NULL
  575. AND ProductInStore.StoreID = @StoreID
  576. AND ProductInStore.IntroductionDate <= @IntroductionDate
  577.  
  578. ORDER BY ProductInStore.IntroductionDate DESC
  579. " connection="Grocery" type="replace" use="raw">
  580.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  581.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  582.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  583.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  584.                         </select>
  585.                         <insert name="INSERT INTO BasketItem(
  586.     CustomerID,
  587.     ProductID,
  588.     Quantity,
  589.     UnitID,
  590.     ItemNo,
  591.     Note)
  592.  
  593. VALUES(
  594.     @CustomerID,
  595.     @ProductID,
  596.     @Quantity,
  597.     @UnitID,
  598.     @ItemNo,
  599.     @Note )
  600. SELECT @@IDENTITY AS BasketItemID
  601. " connection="Grocery" type="replace" use="raw">
  602.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  603.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  604.                             <parameter name="Quantity" datatype="float" direction="in"/>
  605.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  606.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  607.                             <parameter name="Note" datatype="string" direction="in"/>
  608.                         </insert>
  609.                         <update name="UPDATE BasketItem
  610. SET     ProductID = @ProductID,
  611.     Quantity = @Quantity,
  612.     UnitID = @UnitID,
  613.     Note = @Note,
  614.     UpdateTime=GETDATE()
  615.     WHERE CustomerID = @CustomerID AND ItemNo = @ItemNo
  616. " connection="Grocery" type="replace" use="raw">
  617.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  618.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  619.                             <parameter name="Quantity" datatype="float" direction="in"/>
  620.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  621.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  622.                             <parameter name="Note" datatype="string" direction="in"/>
  623.                         </update>
  624.                         <delete name="DELETE FROM BasketItem 
  625. WHERE CustomerID = @CustomerID AND ItemNo = @ItemNo
  626. " connection="Grocery" type="replace" use="raw">
  627.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  628.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  629.                         </delete>
  630.                     </query>
  631.                 </datasource>
  632.                 <properties>
  633.                     <property name="ItemID" alias="BasketItemID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  634.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false"/>
  635.                     <property name="Quantity" alias="Quantity" datatype="float" nullable="false"/>
  636.                     <property name="ItemNo" alias="ItemNo" datatype="short" nullable="false"/>
  637.                     <property name="Note" alias="Note" datatype="string" nullable="true"/>
  638.                     <property name="ItemUnitID" alias="BasketUnitID" datatype="integer" nullable="false"/>
  639.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false"/>
  640.                     <property name="Name" alias="Name" datatype="string" nullable="true"/>
  641.                     <property name="Description" alias="Description" datatype="string" nullable="true"/>
  642.                     <property name="PackSize" alias="PackSize" datatype="short" nullable="true"/>
  643.                     <property name="UnitSize" alias="UnitSize" datatype="float" nullable="true"/>
  644.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="false"/>
  645.                     <property name="ComparativeSizeInfo" alias="ComparativeSizeInfo" datatype="String" nullable="true"/>
  646.                     <property name="AddedVal" alias="AddedVal" datatype="string" nullable="true"/>
  647.                     <property name="Saving" alias="Saving" datatype="money" nullable="true"/>
  648.                     <property name="IsNew" alias="IsNew" datatype="boolean" nullable="true"/>
  649.                     <property name="HasLabelData" alias="HasLabelData" datatype="boolean" nullable="false"/>
  650.                     <property name="Price" alias="Price" datatype="money" nullable="true"/>
  651.                     <property name="ItemCost" alias="ItemCost" datatype="money" nullable="true"/>
  652.                     <property name="IsAvailable" alias="IsAvailable" datatype="integer" nullable="true"/>
  653.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="false"/>
  654.                     <property name="HasOptions" alias="HasOptions" datatype="integer" nullable="true"/>
  655.                     <property name="PromoReduction" alias="PromoReduction" datatype="money" nullable="true"/>
  656.                     <property name="IsCaseDealParent" alias="IsCaseDealParent" datatype="boolean" nullable="false"/>
  657.                     <property name="CaseDealParentID" alias="CaseDealParentID" datatype="integer" nullable="true"/>
  658.                     <property name="CaseDealImageID" alias="CaseDealImageID" datatype="string" nullable="true"/>
  659.                     <property name="CategoryRank" alias="CategoryRank" datatype="integer" nullable="true"/>
  660.                 </properties>
  661.                 <relationships>
  662.                     <relationship name="OptionValues" object="BasketItemOptionValue" keyprop="down" collection="true" query="BasketItemOptionValues">
  663.                         <key pkey="ItemID" fkey="BasketItemID" from="parent" to="child"/>
  664.                     </relationship>
  665.                     <relationship name="Options" object="ProductOption" keyprop="none" collection="true" query="ProductOptions">
  666.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  667.                     </relationship>
  668.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="ProductCategories">
  669.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  670.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  671.                     </relationship>
  672.                     <relationship name="CaseDealProducts" object="Product" keyprop="none" collection="true" query="StoreProductCaseDealProducts">
  673.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  674.                         <key pkey="ProductID" fkey="CaseDealParentID" from="parent" to="child"/>
  675.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  676.                     </relationship>
  677.                 </relationships>
  678.             </object>
  679.             <object name="BasketItemOptionValue">
  680.                 <datasource>
  681.                     <query id="BasketItemOptionValues" default="false">
  682.                         <select name="SELECT BasketItemID, ProductOptionID, OptionValue 
  683. FROM BasketItemOptionValue
  684. WHERE BasketItemID = @BasketItemID
  685. " connection="Grocery" type="replace" use="raw">
  686.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  687.                         </select>
  688.                         <insert name="INSERT INTO BasketItemOptionValue(BasketItemID, ProductOptionID, OptionValue)
  689. VALUES(@BasketItemID, @ProductOptionID, @OptionValue)
  690. " connection="Grocery" type="replace" use="raw">
  691.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  692.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  693.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  694.                         </insert>
  695.                         <update name="UPDATE BasketItemOptionValue
  696. SET OptionValue = @OptionValue
  697. WHERE BasketItemID = @BasketItemID AND ProductOptionID = @ProductOptionID
  698. " connection="Grocery" type="replace" use="raw">
  699.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  700.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  701.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  702.                         </update>
  703.                         <delete name="DELETE FROM BasketItemOptionValue
  704. WHERE BasketItemID = @BasketItemID
  705. " connection="Grocery" type="replace" use="raw">
  706.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  707.                         </delete>
  708.                     </query>
  709.                     <query id="BasketItemOptionValue" default="true">
  710.                         <select name="SELECT BasketItemID, ProductOptionID, OptionValue 
  711. FROM BasketItemOptionValue
  712. WHERE BasketItemID = @BasketItemID AND ProductOptionID = @ProductOptionID
  713. " connection="Grocery" type="replace" use="raw">
  714.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  715.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  716.                         </select>
  717.                         <insert name="INSERT INTO BasketItemOptionValue(BasketItemID, ProductOptionID, OptionValue)
  718. VALUES(@BasketItemID, @ProductOptionID, @OptionValue)
  719. " connection="Grocery" type="replace" use="raw">
  720.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  721.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  722.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  723.                         </insert>
  724.                         <update name="UPDATE BasketItemOptionValue
  725. SET OptionValue = @OptionValue
  726. WHERE BasketItemID = @BasketItemID AND ProductOptionID = @ProductOptionID
  727. " connection="Grocery" type="replace" use="raw">
  728.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  729.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  730.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  731.                         </update>
  732.                         <delete name="DELETE FROM BasketItemOptionValue
  733. WHERE BasketItemID = @BasketItemID AND ProductOptionID = @ProductOptionID
  734. " connection="Grocery" type="replace" use="raw">
  735.                             <parameter name="BasketItemID" datatype="integer" direction="in"/>
  736.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  737.                         </delete>
  738.                     </query>
  739.                 </datasource>
  740.                 <properties>
  741.                     <property name="BasketItemID" alias="BasketItemID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  742.                     <property name="ProductOptionID" alias="ProductOptionID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  743.                     <property name="OptionValue" alias="OptionValue" datatype="string" nullable="false"/>
  744.                 </properties>
  745.                 <relationships/>
  746.             </object>
  747.             <object name="Category">
  748.                 <datasource>
  749.                     <query id="ProductCategories" default="false">
  750.                         <select name="SELECT DISTINCT 
  751. CategoryInStore.StoreID AS StoreID,
  752. Category.CategoryID, 
  753. Name, 
  754. ParentID, 
  755. LevelNo, 
  756. IsLeaf, 
  757. TopLevelID, 
  758. ColorCode, 
  759. SortOrder
  760. FROM Category
  761. INNER JOIN ProductInCategory 
  762. ON Category.CategoryID = ProductInCategory.CategoryID
  763. INNER JOIN CategoryInStore 
  764. ON Category.CategoryID = CategoryInStore.CategoryID
  765. INNER JOIN ProductInStore 
  766. ON ProductInStore.StoreID = CategoryInStore.StoreID
  767.  
  768. WHERE ProductInStore.ProductID = @ProductID
  769. AND ProductInCategory.ProductID = @ProductID
  770. AND ProductInStore.StoreID = @StoreID
  771.  
  772. " connection="Grocery" type="replace" use="raw">
  773.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  774.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  775.                         </select>
  776.                     </query>
  777.                     <query id="StoreCategory" default="true">
  778.                         <select name="SELECT 
  779. CategoryInStore.StoreID, 
  780. Category.CategoryID, 
  781. Name, 
  782. ParentID, 
  783. LevelNo, 
  784. IsLeaf, 
  785. TopLevelID, 
  786. ColorCode, 
  787. SortOrder
  788. FROM Category
  789. INNER JOIN CategoryInStore 
  790. ON CategoryInStore.CategoryID = Category.CategoryID
  791. WHERE CategoryInStore.StoreID = @StoreID 
  792. AND Category.CategoryID = @CategoryID
  793. " connection="Grocery" type="replace" use="raw">
  794.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  795.                             <parameter name="CategoryID" datatype="integer" direction="in"/>
  796.                         </select>
  797.                     </query>
  798.                     <query id="StoreCategories" default="false">
  799.                         <select name="SELECT 
  800. CategoryInStore.StoreID, 
  801. Category.CategoryID, 
  802. Category.Name, 
  803. Category.ParentID, 
  804. Category.LevelNo, 
  805. Category.IsLeaf, 
  806. Category.TopLevelID, 
  807. Category.ColorCode, 
  808. Category.SortOrder
  809. FROM Category
  810. INNER JOIN CategoryInStore 
  811. ON Category.CategoryID = CategoryInStore.CategoryID
  812. WHERE CategoryInStore.StoreID = @StoreID
  813. ORDER BY Category.LevelNo
  814. " connection="Grocery" type="replace" use="raw">
  815.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  816.                         </select>
  817.                     </query>
  818.                     <query id="StoreSubCategories" default="false">
  819.                         <select name="SELECT 
  820. CategoryInStore.StoreID, 
  821. Category.CategoryID, 
  822. Name, ParentID, 
  823. LevelNo, 
  824. IsLeaf, 
  825. TopLevelID, 
  826. ColorCode, 
  827. SortOrder
  828. FROM Category
  829. INNER JOIN CategoryInStore 
  830. ON Category.CategoryID = CategoryInStore.CategoryID
  831. WHERE CategoryInStore.StoreID = @StoreID 
  832. AND ParentID = @ParentID
  833. " connection="Grocery" type="replace" use="raw">
  834.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  835.                             <parameter name="ParentID" datatype="integer" direction="in"/>
  836.                         </select>
  837.                     </query>
  838.                 </datasource>
  839.                 <properties>
  840.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="false" pkey="false"/>
  841.                     <property name="CategoryID" alias="CategoryID" datatype="integer" nullable="false" pkey="true"/>
  842.                     <property name="Name" alias="Name" datatype="string" nullable="false"/>
  843.                     <property name="ParentID" alias="ParentID" datatype="integer" nullable="false"/>
  844.                     <property name="LevelNo" alias="LevelNo" datatype="short" nullable="false"/>
  845.                     <property name="IsLeaf" alias="IsLeaf" datatype="boolean" nullable="false"/>
  846.                     <property name="TopLevelID" alias="TopLevelID" datatype="integer" nullable="false"/>
  847.                     <property name="ColorCode" alias="ColorCode" datatype="String" nullable="true"/>
  848.                     <property name="SortOrder" alias="SortOrder" datatype="integer" nullable="true"/>
  849.                 </properties>
  850.                 <relationships>
  851.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="StoreSubCategories">
  852.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  853.                         <key pkey="CategoryID" fkey="ParentID" from="parent" to="child"/>
  854.                     </relationship>
  855.                     <relationship name="Products" object="Product" keyprop="none" collection="true" query="StoreCategoryProducts">
  856.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  857.                         <key pkey="CategoryID" fkey="CategoryID" from="parent" to="child"/>
  858.                     </relationship>
  859.                     <relationship name="ProductsWithAV" object="Product" keyprop="none" collection="true" query="StoreCategoryProductsWithAV">
  860.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  861.                         <key pkey="CategoryID" fkey="CategoryID" from="parent" to="child"/>
  862.                         <key pkey="AttributeID" fkey="AttributeID" from="parent" to="child"/>
  863.                     </relationship>
  864.                     <relationship name="Attributes" object="ProductAttribute" keyprop="none" collection="true" query="StoreCategoryAttributes">
  865.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  866.                         <key pkey="CategoryID" fkey="CategoryID" from="parent" to="child"/>
  867.                     </relationship>
  868.                 </relationships>
  869.             </object>
  870.             <object name="Coupon">
  871.                 <datasource>
  872.                     <query id="CustomerCoupon" default="true">
  873.                         <select name="SELECT CouponID, CustomerID, PromoID
  874. FROM Coupon
  875. WHERE CouponID = @CouponID
  876. " connection="Grocery" type="replace" use="raw">
  877.                             <parameter name="CouponID" datatype="integer" direction="in"/>
  878.                         </select>
  879.                         <insert name="INSERT INTO Coupon(PromoID, CustomerID)
  880. VALUES(@PromoID, @CustomerID)
  881. " connection="Grocery" type="replace" use="raw">
  882.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  883.                             <parameter name="PromoID" datatype="integer" direction="in"/>
  884.                         </insert>
  885.                         <delete name="DELETE FROM Coupon
  886. WHERE CouponID = @CouponID
  887. " connection="Grocery" type="replace" use="raw">
  888.                             <parameter name="CouponID" datatype="integer" direction="in"/>
  889.                         </delete>
  890.                     </query>
  891.                 </datasource>
  892.                 <properties>
  893.                     <property name="CouponID" alias="CouponID" datatype="integer" nullable="false" pkey="true"/>
  894.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="false"/>
  895.                     <property name="PromoID" alias="PromoID" datatype="integer" nullable="false" pkey="false"/>
  896.                 </properties>
  897.             </object>
  898.             <object name="CreditCardScheme">
  899.                 <datasource>
  900.                     <query id="CreditCardScheme" default="true">
  901.                         <select name="NOT_USED_OFFLINE" type="replace" use="raw" connection="Grocery">
  902.                             <parameter name="CCNo" datatype="string" direction="in"/>
  903.                         </select>
  904.                     </query>
  905.                 </datasource>
  906.                 <properties>
  907.                     <property name="CardType" alias="CardType" datatype="string"/>
  908.                     <property name="PANLength" alias="PANLength" datatype="integer"/>
  909.                     <property name="ExpDate" alias="ExpDate" datatype="boolean"/>
  910.                     <property name="IssueNo" alias="IssueNo" datatype="boolean"/>
  911.                     <property name="FromDate" alias="FromDate" datatype="boolean"/>
  912.                     <property name="Accepted" alias="Accepted" datatype="boolean"/>
  913.                     <property name="IssueLength" alias="IssueLength" datatype="integer"/>
  914.                 </properties>
  915.                 <relationships/>
  916.             </object>
  917.             <object name="Customer">
  918.                 <datasource>
  919.                     <query id="Customer" default="true">
  920.                         <select name="SELECT 
  921.     CustomerID, 
  922.     SessionGuid, 
  923.     LastLogin, 
  924.     CreationDate, 
  925.     Title, 
  926.     Surname, 
  927.     Forename, 
  928.     EMail, 
  929.     Password, 
  930.     HomeTel, 
  931.     CustomerType, 
  932.     Status, 
  933.     GuestPostcode, 
  934.     LoyaltyPoints,
  935.     LoginID,
  936.     LastAddressID,
  937.     IsAdmin,
  938.     CCNo,
  939.     CCName,
  940.     CCFromDate,
  941.     CCExpDate,
  942.     CCIssueNo,
  943.     CCSave,
  944.     RecieveInfoIceland,
  945.     RecieveInfoOther,
  946.     UpdateFlag,
  947.     Source
  948. FROM Customer
  949. WHERE 
  950.     CustomerID = @CustomerID
  951. " connection="Grocery" type="replace" use="raw">
  952.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  953.                         </select>
  954.                         <insert name="INSERT INTO Customer
  955.     (
  956.     SessionGuid, 
  957.     LastLogin, 
  958.     CreationDate, 
  959.     Title, 
  960.     Surname, 
  961.     Forename, 
  962.     EMail, 
  963.     Password, 
  964.     HomeTel, 
  965.     CustomerType, 
  966.     Status, 
  967.     GuestPostCode,
  968.     LoginID,
  969.     LastAddressID,
  970.     IsAdmin,
  971.     CCNo,
  972.     CCName,
  973.     CCFromDate,
  974.     CCExpDate,
  975.     CCIssueNo,
  976.     CCSave,
  977.     RecieveInfoIceland,
  978.     RecieveInfoOther,
  979.     UpdateFlag,
  980.     Source
  981.     )
  982. VALUES
  983.     (
  984.     @SessionGuid, 
  985.     @LastLogin, 
  986.     @CreationDate, 
  987.     @Title, 
  988.     @Surname, 
  989.     @Forename, 
  990.     @EMail, 
  991.     @Password, 
  992.     @HomeTel, 
  993.     @CustomerType, 
  994.     @Status, 
  995.     @GuestPostCode,
  996.     @LoginID,
  997.     @LastAddressID,
  998.     @IsAdmin,
  999.     @CCNo,
  1000.     @CCName,
  1001.     @CCFromDate,
  1002.     @CCExpDate,
  1003.     @CCIssueNo,
  1004.     @CCSave,
  1005.     @RecieveInfoIceland,
  1006.     @RecieveInfoOther,
  1007.     @UpdateFlag,
  1008.     @Source
  1009.     )
  1010. " connection="Grocery" type="replace" use="raw">
  1011.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1012.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1013.                             <parameter name="CreationDate" datatype="date" direction="in"/>
  1014.                             <parameter name="Title" datatype="string" direction="in"/>
  1015.                             <parameter name="Surname" datatype="string" direction="in"/>
  1016.                             <parameter name="Forename" datatype="string" direction="in"/>
  1017.                             <parameter name="EMail" datatype="string" direction="in"/>
  1018.                             <parameter name="Password" datatype="string" direction="in"/>
  1019.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1020.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1021.                             <parameter name="Status" datatype="short" direction="in"/>
  1022.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1023.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1024.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1025.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1026.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1027.                             <parameter name="CCName" datatype="string" direction="in"/>
  1028.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1029.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1030.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1031.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1032.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1033.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1034.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1035.                             <parameter name="Source" datatype="string" direction="in"/>
  1036.                         </insert>
  1037.                         <update name="UPDATE Customer
  1038. SET 
  1039.     SessionGuid = @SessionGuid,
  1040.     LastLogIn = @LastLogIn,
  1041.     Title = @Title,
  1042.     Surname = @Surname,
  1043.     Forename = @Forename,
  1044.     EMail = @EMail,
  1045.     Password = @Password,
  1046.     HomeTel = @HomeTel,
  1047.     CustomerType = @CustomerType,
  1048.     Status = @Status,
  1049.     GuestPostCode = @GuestPostCode,
  1050.     LoyaltyPoints = @LoyaltyPoints,
  1051.     LoginID = @LoginID,
  1052.     LastAddressID = @LastAddressID,
  1053.     IsAdmin = @IsAdmin,
  1054.     CCNo = @CCNo,
  1055.     CCName = @CCName,
  1056.     CCFromDate = @CCFromDate,
  1057.     CCExpDate = @CCExpDate,
  1058.     CCIssueNo = @CCIssueNo,
  1059.     CCSave = @CCSave,
  1060.     RecieveInfoIceland = @RecieveInfoIceland,    
  1061.     RecieveInfoOther = @RecieveInfoOther,
  1062.     UpdateFlag = @UpdateFlag,
  1063.     Source=@Source
  1064. WHERE CustomerID = @CustomerID
  1065. " connection="Grocery" type="replace" use="raw">
  1066.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1067.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1068.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1069.                             <parameter name="Title" datatype="string" direction="in"/>
  1070.                             <parameter name="Surname" datatype="string" direction="in"/>
  1071.                             <parameter name="Forename" datatype="string" direction="in"/>
  1072.                             <parameter name="EMail" datatype="string" direction="in"/>
  1073.                             <parameter name="Password" datatype="string" direction="in"/>
  1074.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1075.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1076.                             <parameter name="Status" datatype="short" direction="in"/>
  1077.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1078.                             <parameter name="LoyaltyPoints" datatype="float" direction="in"/>
  1079.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1080.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1081.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1082.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1083.                             <parameter name="CCName" datatype="string" direction="in"/>
  1084.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1085.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1086.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1087.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1088.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1089.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1090.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1091.                             <parameter name="Source" datatype="string" direction="in"/>
  1092.                         </update>
  1093.                         <delete name="DELETE FROM Customer WHERE CustomerID = @CustomerID" connection="Grocery" type="replace" use="raw">
  1094.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1095.                         </delete>
  1096.                     </query>
  1097.                     <query id="CustomerByGuid" default="false">
  1098.                         <select name="SELECT 
  1099.     CustomerID, 
  1100.     SessionGuid, 
  1101.     LastLogin, 
  1102.     CreationDate, 
  1103.     Title, 
  1104.     Surname, 
  1105.     Forename, 
  1106.     EMail, 
  1107.     Password, 
  1108.     HomeTel, 
  1109.     CustomerType, 
  1110.     Status, 
  1111.     GuestPostcode, 
  1112.     LoyaltyPoints,
  1113.     LoginID,
  1114.     LastAddressID,
  1115.     IsAdmin,
  1116.     CCNo,
  1117.     CCName,
  1118.     CCFromDate,
  1119.     CCExpDate,
  1120.     CCIssueNo,
  1121.     CCSave,
  1122.     RecieveInfoIceland,
  1123.     RecieveInfoOther,
  1124.     UpdateFlag,
  1125.     Source
  1126. FROM Customer
  1127. WHERE SessionGuid = @SessionGuid" connection="Grocery" type="replace" use="raw">
  1128.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1129.                         </select>
  1130.                         <insert name="INSERT INTO Customer
  1131.     (
  1132.     SessionGuid, 
  1133.     LastLogin, 
  1134.     CreationDate, 
  1135.     Title, 
  1136.     Surname, 
  1137.     Forename, 
  1138.     EMail, 
  1139.     Password, 
  1140.     HomeTel, 
  1141.     CustomerType, 
  1142.     Status, 
  1143.     GuestPostCode,
  1144.     LoginID,
  1145.     LastAddressID,
  1146.     IsAdmin,
  1147.     CCNo,
  1148.     CCName,
  1149.     CCFromDate,
  1150.     CCExpDate,
  1151.     CCIssueNo,
  1152.     CCSave,
  1153.     RecieveInfoIceland,
  1154.     RecieveInfoOther,
  1155.     UpdateFlag,
  1156.     Source
  1157.     )
  1158. VALUES
  1159.     (
  1160.     @SessionGuid, 
  1161.     @LastLogin, 
  1162.     @CreationDate, 
  1163.     @Title, 
  1164.     @Surname, 
  1165.     @Forename, 
  1166.     @EMail, 
  1167.     @Password, 
  1168.     @HomeTel, 
  1169.     @CustomerType, 
  1170.     @Status, 
  1171.     @GuestPostCode,
  1172.     @LoginID,
  1173.     @LastAddressID,
  1174.     @IsAdmin,
  1175.     @CCNo,
  1176.     @CCName,
  1177.     @CCFromDate,
  1178.     @CCExpDate,
  1179.     @CCIssueNo,
  1180.     @CCSave,
  1181.     @RecieveInfoIceland,
  1182.     @RecieveInfoOther,
  1183.     @UpdateFlag,
  1184.     @Source
  1185.     )
  1186. " connection="Grocery" type="replace" use="raw">
  1187.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1188.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1189.                             <parameter name="CreationDate" datatype="date" direction="in"/>
  1190.                             <parameter name="Title" datatype="string" direction="in"/>
  1191.                             <parameter name="Surname" datatype="string" direction="in"/>
  1192.                             <parameter name="Forename" datatype="string" direction="in"/>
  1193.                             <parameter name="EMail" datatype="string" direction="in"/>
  1194.                             <parameter name="Password" datatype="string" direction="in"/>
  1195.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1196.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1197.                             <parameter name="Status" datatype="short" direction="in"/>
  1198.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1199.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1200.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1201.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1202.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1203.                             <parameter name="CCName" datatype="string" direction="in"/>
  1204.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1205.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1206.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1207.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1208.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1209.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1210.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1211.                             <parameter name="Source" datatype="string" direction="in"/>
  1212.                         </insert>
  1213.                         <update name="UPDATE Customer
  1214. SET 
  1215.     SessionGuid = @SessionGuid,
  1216.     LastLogIn = @LastLogIn,
  1217.     Title = @Title,
  1218.     Surname = @Surname,
  1219.     Forename = @Forename,
  1220.     EMail = @EMail,
  1221.     Password = @Password,
  1222.     HomeTel = @HomeTel,
  1223.     CustomerType = @CustomerType,
  1224.     Status = @Status,
  1225.     GuestPostCode = @GuestPostCode,
  1226.     LoyaltyPoints = @LoyaltyPoints,
  1227.     LoginID = @LoginID,
  1228.     LastAddressID = @LastAddressID,
  1229.     IsAdmin = @IsAdmin,
  1230.     CCNo = @CCNo,
  1231.     CCName = @CCName,
  1232.     CCFromDate = @CCFromDate,
  1233.     CCExpDate = @CCExpDate,
  1234.     CCIssueNo = @CCIssueNo,
  1235.     CCSave = @CCSave,
  1236.     RecieveInfoIceland = @RecieveInfoIceland,    
  1237.     RecieveInfoOther = @RecieveInfoOther,
  1238.     UpdateFlag = @UpdateFlag,
  1239.     Source=@Source
  1240. WHERE CustomerID = @CustomerID
  1241. " connection="Grocery" type="replace" use="raw">
  1242.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1243.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1244.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1245.                             <parameter name="Title" datatype="string" direction="in"/>
  1246.                             <parameter name="Surname" datatype="string" direction="in"/>
  1247.                             <parameter name="Forename" datatype="string" direction="in"/>
  1248.                             <parameter name="EMail" datatype="string" direction="in"/>
  1249.                             <parameter name="Password" datatype="string" direction="in"/>
  1250.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1251.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1252.                             <parameter name="Status" datatype="short" direction="in"/>
  1253.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1254.                             <parameter name="LoyaltyPoints" datatype="float" direction="in"/>
  1255.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1256.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1257.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1258.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1259.                             <parameter name="CCName" datatype="string" direction="in"/>
  1260.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1261.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1262.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1263.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1264.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1265.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1266.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1267.                             <parameter name="Source" datatype="string" direction="in"/>
  1268.                         </update>
  1269.                         <delete name="DELETE FROM Customer WHERE CustomerID = @CustomerID
  1270. " connection="Grocery" type="replace" use="raw">
  1271.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1272.                         </delete>
  1273.                     </query>
  1274.                     <query id="CustomerByEMail" default="false">
  1275.                         <select name="SELECT
  1276.     CustomerID, 
  1277.     SessionGuid, 
  1278.     LastLogin, 
  1279.     CreationDate, 
  1280.     Title, 
  1281.     Surname, 
  1282.     Forename, 
  1283.     EMail, 
  1284.     Password, 
  1285.     HomeTel, 
  1286.     CustomerType, 
  1287.     Status, 
  1288.     GuestPostcode, 
  1289.     LoyaltyPoints,
  1290.     LoginID,
  1291.     LastAddressID,
  1292.     IsAdmin,
  1293.     CCNo,
  1294.     CCName,
  1295.     CCFromDate,
  1296.     CCExpDate,
  1297.     CCIssueNo,
  1298.     CCSave,
  1299.     RecieveInfoIceland,
  1300.     RecieveInfoOther,
  1301.     UpdateFlag,
  1302.     Source
  1303.  
  1304. FROM Customer
  1305.  
  1306. WHERE EMail = @EMail
  1307. " connection="Grocery" type="replace" use="raw">
  1308.                             <parameter name="EMail" datatype="string" direction="in"/>
  1309.                         </select>
  1310.                         <insert name="INSERT INTO Customer
  1311.     (
  1312.     SessionGuid, 
  1313.     LastLogin, 
  1314.     CreationDate, 
  1315.     Title, 
  1316.     Surname, 
  1317.     Forename, 
  1318.     EMail, 
  1319.     Password, 
  1320.     HomeTel, 
  1321.     CustomerType, 
  1322.     Status, 
  1323.     GuestPostCode,
  1324.     LoginID,
  1325.     LastAddressID,
  1326.     IsAdmin,
  1327.     CCNo,
  1328.     CCName,
  1329.     CCFromDate,
  1330.     CCExpDate,
  1331.     CCIssueNo,
  1332.     CCSave,
  1333.     RecieveInfoIceland,
  1334.     RecieveInfoOther,
  1335.     UpdateFlag,
  1336.     Source
  1337.     )
  1338. VALUES
  1339.     (
  1340.     @SessionGuid, 
  1341.     @LastLogin, 
  1342.     @CreationDate, 
  1343.     @Title, 
  1344.     @Surname, 
  1345.     @Forename, 
  1346.     @EMail, 
  1347.     @Password, 
  1348.     @HomeTel, 
  1349.     @CustomerType, 
  1350.     @Status, 
  1351.     @GuestPostCode,
  1352.     @LoginID,
  1353.     @LastAddressID,
  1354.     @IsAdmin,
  1355.     @CCNo,
  1356.     @CCName,
  1357.     @CCFromDate,
  1358.     @CCExpDate,
  1359.     @CCIssueNo,
  1360.     @CCSave,
  1361.     @RecieveInfoIceland,
  1362.     @RecieveInfoOther,
  1363.     @UpdateFlag,
  1364.     @Source
  1365.     )
  1366. " connection="Grocery" type="replace" use="raw">
  1367.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1368.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1369.                             <parameter name="CreationDate" datatype="date" direction="in"/>
  1370.                             <parameter name="Title" datatype="string" direction="in"/>
  1371.                             <parameter name="Surname" datatype="string" direction="in"/>
  1372.                             <parameter name="Forename" datatype="string" direction="in"/>
  1373.                             <parameter name="EMail" datatype="string" direction="in"/>
  1374.                             <parameter name="Password" datatype="string" direction="in"/>
  1375.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1376.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1377.                             <parameter name="Status" datatype="short" direction="in"/>
  1378.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1379.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1380.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1381.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1382.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1383.                             <parameter name="CCName" datatype="string" direction="in"/>
  1384.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1385.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1386.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1387.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1388.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1389.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1390.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1391.                             <parameter name="Source" datatype="string" direction="in"/>
  1392.                         </insert>
  1393.                         <update name="UPDATE Customer
  1394. SET 
  1395.     SessionGuid = @SessionGuid,
  1396.     LastLogIn = @LastLogIn,
  1397.     Title = @Title,
  1398.     Surname = @Surname,
  1399.     Forename = @Forename,
  1400.     EMail = @EMail,
  1401.     Password = @Password,
  1402.     HomeTel = @HomeTel,
  1403.     CustomerType = @CustomerType,
  1404.     Status = @Status,
  1405.     GuestPostCode = @GuestPostCode,
  1406.     LoyaltyPoints = @LoyaltyPoints,
  1407.     LoginID = @LoginID,
  1408.     LastAddressID = @LastAddressID,
  1409.     IsAdmin = @IsAdmin,
  1410.     CCNo = @CCNo,
  1411.     CCName = @CCName,
  1412.     CCFromDate = @CCFromDate,
  1413.     CCExpDate = @CCExpDate,
  1414.     CCIssueNo = @CCIssueNo,
  1415.     CCSave = @CCSave,
  1416.     RecieveInfoIceland = @RecieveInfoIceland,    
  1417.     RecieveInfoOther = @RecieveInfoOther,
  1418.     UpdateFlag = @UpdateFlag,
  1419.     Source=@Source
  1420. WHERE CustomerID = @CustomerID" connection="Grocery" type="replace" use="raw">
  1421.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1422.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1423.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1424.                             <parameter name="Title" datatype="string" direction="in"/>
  1425.                             <parameter name="Surname" datatype="string" direction="in"/>
  1426.                             <parameter name="Forename" datatype="string" direction="in"/>
  1427.                             <parameter name="EMail" datatype="string" direction="in"/>
  1428.                             <parameter name="Password" datatype="string" direction="in"/>
  1429.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1430.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1431.                             <parameter name="Status" datatype="short" direction="in"/>
  1432.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1433.                             <parameter name="LoyaltyPoints" datatype="float" direction="in"/>
  1434.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1435.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1436.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1437.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1438.                             <parameter name="CCName" datatype="string" direction="in"/>
  1439.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1440.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1441.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1442.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1443.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1444.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1445.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1446.                             <parameter name="Source" datatype="string" direction="in"/>
  1447.                         </update>
  1448.                         <delete name="DELETE FROM Customer WHERE CustomerID = @CustomerID" connection="Grocery" type="replace" use="raw">
  1449.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1450.                         </delete>
  1451.                     </query>
  1452.                     <query id="CustomerByLoginID" default="false">
  1453.                         <select name="SELECT
  1454.     CustomerID, 
  1455.     SessionGuid, 
  1456.     LastLogin, 
  1457.     CreationDate, 
  1458.     Title, 
  1459.     Surname, 
  1460.     Forename, 
  1461.     EMail, 
  1462.     Password, 
  1463.     HomeTel, 
  1464.     CustomerType, 
  1465.     Status, 
  1466.     GuestPostcode, 
  1467.     LoyaltyPoints,
  1468.     LoginID,
  1469.     LastAddressID,
  1470.     IsAdmin,
  1471.     CCNo,
  1472.     CCName,
  1473.     CCFromDate,
  1474.     CCExpDate,
  1475.     CCIssueNo,
  1476.     CCSave,
  1477.     RecieveInfoIceland,
  1478.     RecieveInfoOther,
  1479.     UpdateFlag,
  1480.     Source
  1481.  
  1482. FROM Customer
  1483. WHERE LoginID = @LoginID" connection="Grocery" type="replace" use="raw">
  1484.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1485.                         </select>
  1486.                         <insert name="INSERT INTO Customer
  1487.     (
  1488.     SessionGuid, 
  1489.     LastLogin, 
  1490.     CreationDate, 
  1491.     Title, 
  1492.     Surname, 
  1493.     Forename, 
  1494.     EMail, 
  1495.     Password, 
  1496.     HomeTel, 
  1497.     CustomerType, 
  1498.     Status, 
  1499.     GuestPostCode,
  1500.     LoginID,
  1501.     LastAddressID,
  1502.     IsAdmin,
  1503.     CCNo,
  1504.     CCName,
  1505.     CCFromDate,
  1506.     CCExpDate,
  1507.     CCIssueNo,
  1508.     CCSave,
  1509.     RecieveInfoIceland,
  1510.     RecieveInfoOther,
  1511.     UpdateFlag,
  1512.     Source
  1513.     )
  1514. VALUES
  1515.     (
  1516.     @SessionGuid, 
  1517.     @LastLogin, 
  1518.     @CreationDate, 
  1519.     @Title, 
  1520.     @Surname, 
  1521.     @Forename, 
  1522.     @EMail, 
  1523.     @Password, 
  1524.     @HomeTel, 
  1525.     @CustomerType, 
  1526.     @Status, 
  1527.     @GuestPostCode,
  1528.     @LoginID,
  1529.     @LastAddressID,
  1530.     @IsAdmin,
  1531.     @CCNo,
  1532.     @CCName,
  1533.     @CCFromDate,
  1534.     @CCExpDate,
  1535.     @CCIssueNo,
  1536.     @CCSave,
  1537.     @RecieveInfoIceland,
  1538.     @RecieveInfoOther,
  1539.     @UpdateFlag,
  1540.     @Source
  1541.     )
  1542. " connection="Grocery" type="replace" use="raw">
  1543.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1544.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1545.                             <parameter name="CreationDate" datatype="date" direction="in"/>
  1546.                             <parameter name="Title" datatype="string" direction="in"/>
  1547.                             <parameter name="Surname" datatype="string" direction="in"/>
  1548.                             <parameter name="Forename" datatype="string" direction="in"/>
  1549.                             <parameter name="EMail" datatype="string" direction="in"/>
  1550.                             <parameter name="Password" datatype="string" direction="in"/>
  1551.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1552.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1553.                             <parameter name="Status" datatype="short" direction="in"/>
  1554.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1555.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1556.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1557.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1558.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1559.                             <parameter name="CCName" datatype="string" direction="in"/>
  1560.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1561.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1562.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1563.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1564.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1565.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1566.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1567.                             <parameter name="Source" datatype="string" direction="in"/>
  1568.                         </insert>
  1569.                         <update name="UPDATE Customer
  1570. SET 
  1571.     SessionGuid = @SessionGuid,
  1572.     LastLogIn = @LastLogIn,
  1573.     Title = @Title,
  1574.     Surname = @Surname,
  1575.     Forename = @Forename,
  1576.     EMail = @EMail,
  1577.     Password = @Password,
  1578.     HomeTel = @HomeTel,
  1579.     CustomerType = @CustomerType,
  1580.     Status = @Status,
  1581.     GuestPostCode = @GuestPostCode,
  1582.     LoyaltyPoints = @LoyaltyPoints,
  1583.     LoginID = @LoginID,
  1584.     LastAddressID = @LastAddressID,
  1585.     IsAdmin = @IsAdmin,
  1586.     CCNo = @CCNo,
  1587.     CCName = @CCName,
  1588.     CCFromDate = @CCFromDate,
  1589.     CCExpDate = @CCExpDate,
  1590.     CCIssueNo = @CCIssueNo,
  1591.     CCSave = @CCSave,
  1592.     RecieveInfoIceland = @RecieveInfoIceland,    
  1593.     RecieveInfoOther = @RecieveInfoOther,
  1594.     UpdateFlag = @UpdateFlag,
  1595.     Source=@Source
  1596. WHERE CustomerID = @CustomerID
  1597. " connection="Grocery" type="replace" use="raw">
  1598.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1599.                             <parameter name="SessionGuid" datatype="guid" direction="in"/>
  1600.                             <parameter name="LastLogin" datatype="date" direction="in"/>
  1601.                             <parameter name="Title" datatype="string" direction="in"/>
  1602.                             <parameter name="Surname" datatype="string" direction="in"/>
  1603.                             <parameter name="Forename" datatype="string" direction="in"/>
  1604.                             <parameter name="EMail" datatype="string" direction="in"/>
  1605.                             <parameter name="Password" datatype="string" direction="in"/>
  1606.                             <parameter name="HomeTel" datatype="string" direction="in"/>
  1607.                             <parameter name="CustomerType" datatype="short" direction="in"/>
  1608.                             <parameter name="Status" datatype="short" direction="in"/>
  1609.                             <parameter name="GuestPostcode" datatype="string" direction="in"/>
  1610.                             <parameter name="LoyaltyPoints" datatype="float" direction="in"/>
  1611.                             <parameter name="LoginID" datatype="string" direction="in"/>
  1612.                             <parameter name="LastAddressID" datatype="integer" direction="in"/>
  1613.                             <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1614.                             <parameter name="CCNo" datatype="string" direction="in"/>
  1615.                             <parameter name="CCName" datatype="string" direction="in"/>
  1616.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  1617.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  1618.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  1619.                             <parameter name="CCSave" datatype="boolean" direction="in"/>
  1620.                             <parameter name="RecieveInfoIceland" datatype="boolean" direction="in"/>
  1621.                             <parameter name="RecieveInfoOther" datatype="boolean" direction="in"/>
  1622.                             <parameter name="UpdateFlag" datatype="boolean" direction="in"/>
  1623.                             <parameter name="Source" datatype="string" direction="in"/>
  1624.                         </update>
  1625.                         <delete name="DELETE FROM Customer WHERE CustomerID = @CustomerID" connection="Grocery" type="replace" use="raw">
  1626.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1627.                         </delete>
  1628.                     </query>
  1629.                     <query id="Customers" default="false">
  1630.                         <select name="SELECT 
  1631.     CustomerID, 
  1632.     SessionGuid, 
  1633.     LastLogin, 
  1634.     CreationDate, 
  1635.     Title, 
  1636.     Surname, 
  1637.     Forename, 
  1638.     EMail, 
  1639.     Password, 
  1640.     HomeTel, 
  1641.     CustomerType, 
  1642.     Status, 
  1643.     GuestPostcode, 
  1644.     LoyaltyPoints,
  1645.     LoginID,
  1646.     LastAddressID,
  1647.     IsAdmin,
  1648.     CCNo,
  1649.     CCName,
  1650.     CCFromDate,
  1651.     CCExpDate,
  1652.     CCIssueNo,
  1653.     CCSave,
  1654.     RecieveInfoIceland,
  1655.     RecieveInfoOther,
  1656.     UpdateFlag,
  1657.     Source
  1658. FROM Customer
  1659. " connection="Grocery" type="replace" use="raw">
  1660.                         </select>
  1661.                     </query>
  1662.                 </datasource>
  1663.                 <properties>
  1664.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  1665.                     <property name="SessionGuid" alias="SessionGuid" datatype="guid" nullable="false"/>
  1666.                     <property name="LastLogin" alias="LastLogin" datatype="date" nullable="false"/>
  1667.                     <property name="CreationDate" alias="CreationDate" datatype="date" nullable="true"/>
  1668.                     <property name="Title" alias="Title" datatype="string" nullable="false"/>
  1669.                     <property name="Surname" alias="Surname" datatype="string" nullable="false"/>
  1670.                     <property name="Forename" alias="Forename" datatype="string" nullable="false"/>
  1671.                     <property name="EMail" alias="EMail" datatype="string" nullable="true"/>
  1672.                     <property name="Password" alias="Password" datatype="string" nullable="true"/>
  1673.                     <property name="HomeTel" alias="HomeTel" datatype="string" nullable="true"/>
  1674.                     <property name="CustomerType" alias="CustomerType" datatype="short" nullable="true"/>
  1675.                     <property name="Status" alias="Status" datatype="short" nullable="true"/>
  1676.                     <property name="GuestPostcode" alias="GuestPostcode" datatype="string" nullable="true"/>
  1677.                     <property name="LoyaltyPoints" alias="LoyaltyPoints" datatype="float" nullable="true"/>
  1678.                     <property name="LoginID" alias="LoginID" datatype="string" nullable="true"/>
  1679.                     <property name="LastAddressID" alias="LastAddressID" datatype="integer" nullable="true"/>
  1680.                     <property name="IsAdmin" alias="IsAdmin" datatype="boolean" nullable="true"/>
  1681.                     <property name="CCNo" alias="CCNo" datatype="string" nullable="true"/>
  1682.                     <property name="CCName" alias="CCName" datatype="string" nullable="true"/>
  1683.                     <property name="CCFromDate" alias="CCFromDate" datatype="date" nullable="true"/>
  1684.                     <property name="CCExpDate" alias="CCExpDate" datatype="date" nullable="true"/>
  1685.                     <property name="CCIssueNo" alias="CCIssueNo" datatype="string" nullable="true"/>
  1686.                     <property name="CCSave" alias="CCSave" datatype="boolean" nullable="true"/>
  1687.                     <property name="RecieveInfoIceland" alias="RecieveInfoIceland" datatype="boolean" nullable="true"/>
  1688.                     <property name="RecieveInfoOther" alias="RecieveInfoOther" datatype="boolean" nullable="true"/>
  1689.                     <property name="UpdateFlag" alias="UpdateFlag" datatype="boolean" nullable="true"/>
  1690.                     <property name="Source" alias="Source" datatype="string" nullable="true"/>
  1691.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="date" nullable="true"/>
  1692.                 </properties>
  1693.                 <relationships>
  1694.                     <relationship name="Customers" object="Customer" keyprop="down" collection="true" query="Customers"/>
  1695.                     <relationship name="Addresses" object="Address" keyprop="down" collection="true" query="CustomerAddresses">
  1696.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1697.                     </relationship>
  1698.                     <relationship name="Orders" object="Order" keyprop="down" collection="true" query="CustomerOrders">
  1699.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1700.                     </relationship>
  1701.                     <relationship name="CurrentOrder" object="Order" keyprop="down" collection="false" query="CustomerCurrentOrder">
  1702.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1703.                     </relationship>
  1704.                     <relationship name="CustomerByEMail" object="Customer" keyprop="down" collection="false" query="CustomerByEMail">
  1705.                         <key pkey="EMail" fkey="EMail" from="parent" to="child"/>
  1706.                     </relationship>
  1707.                     <relationship name="CustomerByLoginID" object="Customer" keyprop="down" collection="false" query="CustomerByLoginID">
  1708.                         <key pkey="LoginID" fkey="LoginID" from="parent" to="child"/>
  1709.                     </relationship>
  1710.                     <relationship name="CustomerByGuid" object="Customer" keyprop="none" collection="false" query="CustomerByGuid">
  1711.                         <key pkey="SessionGuid" fkey="SessionGuid" from="parent" to="child"/>
  1712.                     </relationship>
  1713.                     <relationship name="Favourites" object="Favourite" keyprop="none" collection="true" query="CustomerFavourites">
  1714.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1715.                     </relationship>
  1716.                     <relationship name="FavouriteProducts" object="Favourite" keyprop="down" collection="true" query="CustomerFavouriteProducts">
  1717.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1718.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  1719.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  1720.                     </relationship>
  1721.                     <relationship name="CouponsBasket" object="Promo" keyprop="down" collection="true" query="CustomerBasketCoupons">
  1722.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1723.                     </relationship>
  1724.                     <relationship name="CouponsProduct" object="Promo" keyprop="down" collection="true" query="CustomerProductCoupons">
  1725.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1726.                     </relationship>
  1727.                     <relationship name="Coupons" object="Promo" keyprop="down" collection="true" query="CustomerAllCoupons">
  1728.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1729.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  1730.                     </relationship>
  1731.                     <relationship name="ProductCoupons" object="Promo" keyprop="down" collection="true" query="CustomerStoreProductCoupons">
  1732.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1733.                         <key pkey="StoreID" fkey="CustomerID" from="parent" to="child"/>
  1734.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  1735.                     </relationship>
  1736.                     <relationship name="Lists" object="List" keyprop="down" collection="true" query="CustomerLists">
  1737.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1738.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  1739.                     </relationship>
  1740.                     <relationship name="UsedOneTimePromo" object="UsedOneTimePromo" keyprop="none" collection="false" query="UsedOneTimePromo">
  1741.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1742.                         <key pkey="PromoID" fkey="PromoID" from="parent" to="child"/>
  1743.                     </relationship>
  1744.                     <relationship name="Questionnaires" object="Questionnaire" keyprop="none" collection="true" query="CustomerQuestionnaire">
  1745.                         <key pkey="CustomerID" fkey="CustomerID" from="parent" to="child"/>
  1746.                     </relationship>
  1747.                 </relationships>
  1748.                 <methods>
  1749.                     <method name="Login" returntype="boolean" uuid="IcelandGrocery.Customer" implname="Login">
  1750.                         <parameter name="LoginID" datatype="string" direction="in"/>
  1751.                         <parameter name="Password" datatype="string" direction="in"/>
  1752.                         <parameter name="IsAdmin" datatype="boolean" direction="in"/>
  1753.                         <parameter name="IsCaseSensitive" datatype="boolean" direction="in"/>
  1754.                     </method>
  1755.                     <method name="Basket" returntype="UPRObject" uuid="IcelandGrocery.Customer" implname="ReturnBasket">
  1756.                         <parameter name="StoreID" datatype="integer" direction="out"/>
  1757.                     </method>
  1758.                     <method name="LocateStore" returntype="Integer" uuid="IcelandGrocery.Customer" implname="LocateStore">
  1759.                         <parameter name="Postcode" datatype="string" direction="in"/>
  1760.                     </method>
  1761.                     <method name="LocateZone" returntype="Integer" uuid="IcelandGrocery.Customer" implname="LocateZone">
  1762.                         <parameter name="Postcode" datatype="string" direction="in"/>
  1763.                     </method>
  1764.                     <method name="GuestLogin" returntype="Integer" uuid="IcelandGrocery.Customer" implname="GuestLogin">
  1765.                         <parameter name="Postcode" datatype="string" direction="in"/>
  1766.                     </method>
  1767.                     <method name="MakeNewSessionGuid" returntype="string" uuid="IcelandGrocery.Customer" implname="MakeNewSessionGuid"/>
  1768.                 </methods>
  1769.             </object>
  1770.             <object name="Delivery">
  1771.                 <datasource>
  1772.                     <query id="Deliveries" default="false">
  1773.                         <select name="SELECT DeliveryID, StartDate, EndDate, Cost, SlotCount, ZoneID, CutoffDate
  1774. FROM Delivery
  1775. WHERE ZoneID = @ZoneID AND CutoffDate >= GetDate()  AND SlotCount > 0 AND StartDate > @startDate AND StartDate< @endDate
  1776. ORDER BY startDate
  1777. " connection="Grocery" type="replace" use="raw">
  1778.                             <parameter name="ZoneID" datatype="integer" direction="in"/>
  1779.                             <parameter name="StartDate" datatype="date" direction="in"/>
  1780.                             <parameter name="EndDate" datatype="date" direction="in"/>
  1781.                         </select>
  1782.                     </query>
  1783.                     <query id="Delivery" default="true">
  1784.                         <select name="SELECT DeliveryID, StartDate, EndDate, Cost, SlotCount, ZoneID, CutoffDate
  1785. FROM Delivery
  1786. WHERE DeliveryID = @DeliveryID
  1787. " connection="Grocery" type="replace" use="raw">
  1788.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  1789.                         </select>
  1790.                         <update name="UPDATE  Delivery 
  1791. SET     SlotCount=@SlotCount
  1792. WHERE DeliveryID = @DeliveryID
  1793. " connection="Grocery" type="replace" use="raw">
  1794.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  1795.                             <parameter name="SlotCount" datatype="short" direction="in"/>
  1796.                         </update>
  1797.                         <delete name="DeleteDelivery" connection="Grocery" type="proc" use="raw">
  1798.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  1799.                         </delete>
  1800.                     </query>
  1801.                     <query id="OrderDelivery" default="false">
  1802.                         <select name="SELECT 
  1803.     Delivery.DeliveryID, 
  1804.     Delivery.StartDate, 
  1805.     Delivery.EndDate, 
  1806.     Delivery.Cost, 
  1807.     Delivery.SlotCount, 
  1808.     Delivery.ZoneID, 
  1809.     Delivery.CutoffDate
  1810. FROM Delivery
  1811. INNER JOIN
  1812.     Orders
  1813.     ON Delivery.DeliveryID = Orders.DeliveryID 
  1814. WHERE
  1815.     Orders.OrderID=@OrderID
  1816. " connection="Grocery" type="replace" use="raw">
  1817.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  1818.                         </select>
  1819.                     </query>
  1820.                 </datasource>
  1821.                 <properties>
  1822.                     <property name="DeliveryID" alias="DeliveryID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  1823.                     <property name="ZoneID" alias="ZoneID" datatype="integer" nullable="true"/>
  1824.                     <property name="StartDate" alias="StartDate" datatype="date" nullable="true"/>
  1825.                     <property name="EndDate" alias="EndDate" datatype="date" nullable="true"/>
  1826.                     <property name="Cost" alias="Cost" datatype="money" nullable="true"/>
  1827.                     <property name="SlotCount" alias="SlotCount" datatype="short" nullable="true"/>
  1828.                     <property name="CutoffDate" alias="CutoffDate" datatype="date" nullable="true"/>
  1829.                 </properties>
  1830.                 <relationships/>
  1831.             </object>
  1832.             <object name="Favourite">
  1833.                 <datasource>
  1834.                     <query id="CustomerFavourites" default="false">
  1835.                         <select name="SELECT 
  1836. CustomerID, 
  1837. ProductID, 
  1838. NumberOfOrders, 
  1839. TotalQtyBought, 
  1840. LastPurchaseDate,
  1841. IsVisible
  1842. FROM Favourite
  1843. WHERE Favourite.CustomerID = @CustomerID
  1844. " connection="Grocery" type="replace" use="raw">
  1845.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1846.                         </select>
  1847.                         <insert name="INSERT INTO Favourite(CustomerID, ProductID,TotalQtyBought, NumberOfOrders, LastPurchaseDate, FirstPurchaseDate, IsVisible)
  1848. VALUES(@CustomerID, @ProductID, @TotalQtyBought, @NumberOfOrders, @LastPurchaseDate, @FirstPurchaseDate, @IsVisible)
  1849. " connection="Grocery" type="replace" use="raw">
  1850.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1851.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  1852.                             <parameter name="TotalQtyBought" datatype="float" direction="in"/>
  1853.                             <parameter name="NumberOfOrders" datatype="integer" direction="in"/>
  1854.                             <parameter name="LastPurchaseDate" datatype="date" direction="in"/>
  1855.                             <parameter name="FirstPurchaseDate" datatype="date" direction="in"/>
  1856.                             <parameter name="IsVisible" datatype="boolean" direction="in"/>
  1857.                         </insert>
  1858.                         <update name="UPDATE Favourite
  1859. SET IsVisible = @IsVisible,
  1860. TotalQtyBought = @TotalQtyBought,
  1861. NumberOfOrders = @NumberOfOrders,
  1862. LastPurchaseDate = @LastPurchaseDate
  1863.  
  1864. WHERE CustomerID = @CustomerID AND ProductID = @ProductID
  1865. " connection="Grocery" type="replace" use="raw">
  1866.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1867.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  1868.                             <parameter name="TotalQtyBought" datatype="float" direction="in"/>
  1869.                             <parameter name="NumberOfOrders" datatype="integer" direction="in"/>
  1870.                             <parameter name="LastPurchaseDate" datatype="date" direction="in"/>
  1871.                             <parameter name="IsVisible" datatype="boolean" direction="in"/>
  1872.                         </update>
  1873.                     </query>
  1874.                     <query id="CustomerFavouriteProducts" default="false">
  1875.                         <select name="SELECT DISTINCT
  1876.     Favourite.ProductID,
  1877.     Favourite.CustomerID,
  1878.     Favourite.NumberOfOrders,
  1879.     Favourite.LastPurchaseDate,
  1880.     Favourite.FirstPurchaseDate,
  1881.     Favourite.IsVisible,
  1882.     Product.Name,
  1883.     Product.Description,
  1884.     Product.PackSize,
  1885.     Product.UnitSize,
  1886.     Product.UnitID,
  1887.     Product.HasLabelData,
  1888.     ProductInStore.IsCaseDealParent,
  1889.     ProductInStore.CaseDealImageID,
  1890.     Product.CaseDealParentID,
  1891.     ProductInStore.ComparativeSizeInfo,
  1892.     ProductInStore.AddedVal,
  1893.     ProductInStore.Saving,
  1894.     ProductInStore.IsNew,
  1895.     ProductInStore.Price,
  1896.     ProductInStore.StoreID AS IsAvailable,
  1897.     ProductInStore.IntroductionDate,
  1898.     ProductOptionValue.ProductID AS HasOptions
  1899. FROM   Favourite
  1900. INNER JOIN Product
  1901. ON Product.ProductID = Favourite.ProductID         
  1902. LEFT JOIN ProductInStore
  1903. ON ProductInStore.ProductID = Product.ProductID
  1904. LEFT JOIN ProductOptionValue
  1905. ON ProductOptionValue.ProductID = Product.ProductID
  1906. WHERE   Favourite.CustomerID = @CustomerID
  1907. AND @IntroductionDate != NULL
  1908. AND ProductInStore.StoreID = @StoreID
  1909. AND ProductInStore.IntroductionDate <= @IntroductionDate
  1910.  
  1911. ORDER BY Favourite.ProductID ASC,
  1912. ProductInStore.IntroductionDate DESC
  1913. " connection="Grocery" type="replace" use="raw">
  1914.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1915.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  1916.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  1917.                         </select>
  1918.                     </query>
  1919.                     <query id="CustomerFavourite" default="true">
  1920.                         <select name="SELECT 
  1921.     CustomerID,
  1922.     ProductID,
  1923.     NumberOfOrders,
  1924.     TotalQtyBought,
  1925.     LastPurchaseDate,
  1926.     FirstPurchaseDate,
  1927.     IsVisible
  1928.  
  1929. FROM Favourite
  1930. WHERE Favourite.CustomerID = @CustomerID 
  1931. AND Favourite.ProductID = @ProductID
  1932. " connection="Grocery" type="replace" use="raw">
  1933.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1934.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  1935.                         </select>
  1936.                         <insert name="INSERT INTO Favourite(CustomerID, ProductID,TotalQtyBought, NumberOfOrders, LastPurchaseDate, FirstPurchaseDate, IsVisible)
  1937. VALUES(@CustomerID, @ProductID, @TotalQtyBought, @NumberOfOrders, @LastPurchaseDate, @FirstPurchaseDate, @IsVisible)
  1938. " connection="Grocery" type="replace" use="raw">
  1939.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1940.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  1941.                             <parameter name="TotalQtyBought" datatype="float" direction="in"/>
  1942.                             <parameter name="NumberOfOrders" datatype="integer" direction="in"/>
  1943.                             <parameter name="LastPurchaseDate" datatype="date" direction="in"/>
  1944.                             <parameter name="FirstPurchaseDate" datatype="date" direction="in"/>
  1945.                             <parameter name="IsVisible" datatype="boolean" direction="in"/>
  1946.                         </insert>
  1947.                         <update name="UPDATE Favourite
  1948. SET IsVisible = @IsVisible,
  1949. TotalQtyBought = @TotalQtyBought,
  1950. NumberOfOrders = @NumberOfOrders,
  1951. LastPurchaseDate = @LastPurchaseDate
  1952.  
  1953. WHERE CustomerID = @CustomerID AND ProductID = @ProductID
  1954. " connection="Grocery" type="replace" use="raw">
  1955.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1956.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  1957.                             <parameter name="TotalQtyBought" datatype="float" direction="in"/>
  1958.                             <parameter name="NumberOfOrders" datatype="integer" direction="in"/>
  1959.                             <parameter name="LastPurchaseDate" datatype="date" direction="in"/>
  1960.                             <parameter name="IsVisible" datatype="boolean" direction="in"/>
  1961.                         </update>
  1962.                         <delete name="DELETE FROM
  1963.     Favourite
  1964. WHERE
  1965.     CustomerID = @CustomerID
  1966.     AND ProductID = @ProductID
  1967. " type="replace" use="raw" connection="Grocery">
  1968.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  1969.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  1970.                         </delete>
  1971.                     </query>
  1972.                 </datasource>
  1973.                 <properties>
  1974.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="true"/>
  1975.                     <property name="TotalQtyBought" alias="TotalQtyBought" datatype="float" nullable="true"/>
  1976.                     <property name="NumberOfOrders" alias="NumberOfOrders" datatype="integer" nullable="true"/>
  1977.                     <property name="LastPurchaseDate" alias="LastPurchaseDate" datatype="date" nullable="true"/>
  1978.                     <property name="FirstPurchaseDate" alias="FirstPurchaseDate" datatype="date" nullable="true"/>
  1979.                     <property name="IsVisible" alias="IsVisible" datatype="integer" nullable="true"/>
  1980.                     <property name="Quantity" alias="Quantity" datatype="float" nullable="false"/>
  1981.                     <property name="ItemNo" alias="ItemNo" datatype="short" nullable="true"/>
  1982.                     <property name="Note" alias="Note" datatype="string" nullable="true"/>
  1983.                     <property name="ItemUnitID" alias="BasketUnitID" datatype="integer" nullable="false"/>
  1984.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false"/>
  1985.                     <property name="Name" alias="Name" datatype="string" nullable="true"/>
  1986.                     <property name="Description" alias="Description" datatype="string" nullable="true"/>
  1987.                     <property name="PackSize" alias="PackSize" datatype="short" nullable="true"/>
  1988.                     <property name="UnitSize" alias="UnitSize" datatype="float" nullable="true"/>
  1989.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="false"/>
  1990.                     <property name="ComparativeSizeInfo" alias="ComparativeSizeInfo" datatype="String" nullable="true"/>
  1991.                     <property name="AddedVal" alias="AddedVal" datatype="string" nullable="true"/>
  1992.                     <property name="Saving" alias="Saving" datatype="money" nullable="true"/>
  1993.                     <property name="IsNew" alias="IsNew" datatype="boolean" nullable="true"/>
  1994.                     <property name="HasLabelData" alias="HasLabelData" datatype="boolean" nullable="false"/>
  1995.                     <property name="Price" alias="Price" datatype="money" nullable="true"/>
  1996.                     <property name="ItemCost" alias="ItemCost" datatype="money" nullable="true"/>
  1997.                     <property name="IsAvailable" alias="IsAvailable" datatype="integer" nullable="true"/>
  1998.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="false"/>
  1999.                     <property name="HasOptions" alias="HasOptions" datatype="integer" nullable="true"/>
  2000.                     <property name="IsCaseDealParent" alias="IsCaseDealParent" datatype="boolean" nullable="false"/>
  2001.                     <property name="CaseDealParentID" alias="CaseDealParentID" datatype="integer" nullable="true"/>
  2002.                     <property name="CaseDealImageID" alias="CaseDealImageID" datatype="string" nullable="true"/>
  2003.                     <property name="CategoryRank" alias="CategoryRank" datatype="integer" nullable="true"/>
  2004.                 </properties>
  2005.                 <relationships>
  2006.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="ProductCategories">
  2007.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  2008.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  2009.                     </relationship>
  2010.                     <relationship name="CaseDealProducts" object="Product" keyprop="none" collection="true" query="StoreProductCaseDealProducts">
  2011.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  2012.                         <key pkey="ProductID" fkey="CaseDealParentID" from="parent" to="child"/>
  2013.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  2014.                     </relationship>
  2015.                 </relationships>
  2016.             </object>
  2017.             <object name="LabelData">
  2018.                 <datasource>
  2019.                     <query id="ProductLabelData" default="true">
  2020.                         <select name="SELECT
  2021.     AttributeMap.AttributeMapID AS MapID,
  2022.     AttributeMap.AttributeMapName AS MapName,
  2023.     AttributeGroup.Name AS AttributeGroupName,
  2024.     Attribute.AttributeID,    
  2025.     Attribute.Name AS AttributeName,
  2026.     ProductAttributeValue.AttributeValue,
  2027.     ProductAttributeValue.PartName,
  2028.     ProductAttributeValue.ColumnNumber,
  2029.     ProductAttributeValue.OrderNumber
  2030.  
  2031.  
  2032. FROM
  2033. AttributeMap
  2034. INNER JOIN AttributeGroup
  2035. ON AttributeGroup.AttributeMapID = AttributeMap.AttributeMapID
  2036. INNER JOIN Attribute
  2037. ON AttributeGroup.AttributeGroupID = Attribute.AttributeGroupID
  2038. INNER JOIN ProductAttributeValue
  2039. ON Attribute.AttributeID = ProductAttributeValue.AttributeID
  2040. WHERE
  2041. ProductAttributeValue.ProductID=@ProductID
  2042.  
  2043. ORDER BY MapID, AttributeGroupName,
  2044. ProductAttributeValue.OrderNumber
  2045. " type="replace" use="raw" connection="Grocery">
  2046.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2047.                         </select>
  2048.                     </query>
  2049.                 </datasource>
  2050.                 <properties>
  2051.                     <property name="MapName" alias="MapName" datatype="string"/>
  2052.                     <property name="MapID" alias="MapID" datatype="integer"/>
  2053.                     <property name="AttributeGroupName" alias="AttributeGroupName" datatype="string"/>
  2054.                     <property name="AttributeID" alias="AttributeID" datatype="integer"/>
  2055.                     <property name="AttributeName" alias="AttributeName" datatype="string"/>
  2056.                     <property name="PartName" alias="PartName" datatype="string"/>
  2057.                     <property name="AttributeValue" alias="AttributeValue" datatype="string"/>
  2058.                     <property name="ColumnNumber" alias="ColumnNumber" datatype="integer"/>
  2059.                 </properties>
  2060.             </object>
  2061.             <object name="List">
  2062.                 <datasource>
  2063.                     <query id="CustomerLists" default="false">
  2064.                         <select name="SELECT 
  2065. ListID, 
  2066. CustomerID, 
  2067. Name, 
  2068. @StoreID AS StoreID
  2069. FROM List
  2070. WHERE CustomerID = @CustomerID
  2071. " connection="Grocery" type="replace" use="raw">
  2072.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  2073.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2074.                         </select>
  2075.                     </query>
  2076.                     <query id="CustomerList" default="true">
  2077.                         <select name="SELECT     ListID,
  2078.         CustomerID,
  2079.         Name,
  2080.         @StoreID AS StoreID
  2081. FROM List
  2082. WHERE ListID = @ListID
  2083. " connection="Grocery" type="replace" use="raw">
  2084.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2085.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2086.                         </select>
  2087.                         <insert name="INSERT INTO List(CustomerID, Name)
  2088. VALUES(@CustomerID, @Name)
  2089. SELECT @@IDENTITY AS ListID
  2090. " connection="Grocery" type="replace" use="raw">
  2091.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  2092.                             <parameter name="Name" datatype="string" direction="in"/>
  2093.                         </insert>
  2094.                         <update name="UPDATE List SET    Name = @Name
  2095. WHERE ListID = @ListID" connection="Grocery" type="replace" use="raw">
  2096.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2097.                             <parameter name="Name" datatype="string" direction="in"/>
  2098.                         </update>
  2099.                         <delete name="DELETE FROM List WHERE ListID = @ListID
  2100. " connection="Grocery" type="replace" use="raw">
  2101.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2102.                         </delete>
  2103.                     </query>
  2104.                 </datasource>
  2105.                 <properties>
  2106.                     <property name="ListID" alias="ListID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  2107.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false"/>
  2108.                     <property name="Name" alias="Name" datatype="string" nullable="true"/>
  2109.                     <property name="StoreID" alias="StoreID" datatype="string" nullable="true"/>
  2110.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="true"/>
  2111.                 </properties>
  2112.                 <relationships>
  2113.                     <relationship name="Items" object="ListItem" keyprop="down" collection="true" query="CustomerListItems">
  2114.                         <key pkey="ListID" fkey="ListID" from="parent" to="child"/>
  2115.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  2116.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  2117.                     </relationship>
  2118.                 </relationships>
  2119.             </object>
  2120.             <object name="ListItem">
  2121.                 <datasource>
  2122.                     <query id="CustomerListItems" default="false">
  2123.                         <select name="SELECT DISTINCT
  2124.     ListItem.ListItemID,
  2125.     ListItem.ListID,
  2126.     ListItem.Quantity,
  2127.     ListItem.ItemNo,
  2128.     ListItem.Note,
  2129.     ListItem.UnitID AS ListUnitID,
  2130.     Product.ProductID,
  2131.     Product.Name,
  2132.     Product.Description,
  2133.     Product.PackSize,
  2134.     Product.UnitSize,
  2135.     Product.UnitID,
  2136.     Product.HasLabelData,
  2137.     ProductInStore.IsCaseDealParent,
  2138.     ProductInStore.CaseDealImageID,
  2139.     Product.CaseDealParentID,
  2140.     ProductInStore.ComparativeSizeInfo,
  2141.     ProductInStore.AddedVal,
  2142.     ProductInStore.Saving,
  2143.     ProductInStore.IsNew,
  2144.     ProductInStore.Price,
  2145.     ProductInStore.StoreID AS IsAvailable,
  2146.     ProductInStore.IntroductionDate,
  2147.     ProductOptionValue.ProductID AS HasOptions
  2148.  
  2149. FROM ListItem
  2150. INNER JOIN Product
  2151. ON ListItem.ProductID = Product.ProductID
  2152. LEFT  JOIN ProductInStore
  2153. ON Product.ProductID = ProductInStore.ProductID 
  2154. LEFT JOIN ProductOptionValue
  2155. ON ProductOptionValue.ProductID = Product.ProductID
  2156. WHERE     ListItem.ListID = @ListID
  2157. AND @IntroductionDate != NULL
  2158. AND ProductInStore.StoreID = @StoreID
  2159. AND ProductInStore.IntroductionDate <= @IntroductionDate
  2160.  
  2161. ORDER BY ListItem.ItemNo DESC,
  2162. ProductInStore.IntroductionDate DESC
  2163. " connection="Grocery" type="replace" use="raw">
  2164.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2165.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2166.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  2167.                         </select>
  2168.                         <insert name="
  2169. INSERT INTO ListItem(ListID, ProductID, Quantity, UnitID, ItemNo, Note)
  2170. VALUES(@ListID, @ProductID, @Quantity, @UnitID, @ItemNo, @Note)
  2171. SELECT @@IDENTITY AS ListItemID
  2172. " connection="Grocery" type="replace" use="raw">
  2173.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2174.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2175.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2176.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2177.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2178.                             <parameter name="Note" datatype="string" direction="in"/>
  2179.                         </insert>
  2180.                         <update name="UPDATE ListItem
  2181.     SET ProductID = @ProductID,
  2182.     Quantity = @Quantity,
  2183.     UnitID = @UnitID,
  2184.     Note = @Note
  2185. WHERE ListID = @ListID AND ItemNo = @ItemNo
  2186. " connection="Grocery" type="replace" use="raw">
  2187.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2188.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2189.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2190.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2191.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2192.                             <parameter name="Note" datatype="string" direction="in"/>
  2193.                         </update>
  2194.                         <delete name="DELETE FROM ListItem WHERE ListID = @ListID AND ItemNo = @ItemNo" connection="Grocery" type="replace" use="raw">
  2195.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2196.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2197.                         </delete>
  2198.                     </query>
  2199.                     <query id="CustomerListItem" default="true">
  2200.                         <select name="SELECT DISTINCT
  2201.     ListItem.ListItemID,
  2202.     ListItem.ListID,
  2203.     ListItem.Quantity,
  2204.     ListItem.ItemNo,
  2205.     ListItem.Note,
  2206.     ListItem.UnitID AS ListUnitID,
  2207.     Product.ProductID,
  2208.     Product.Name,
  2209.     Product.Description,
  2210.     Product.PackSize,
  2211.     Product.UnitSize,
  2212.     Product.UnitID,
  2213.     Product.HasLabelData,
  2214.     ProductInStore.IsCaseDealParent,
  2215.     ProductInStore.CaseDealImageID,
  2216.     Product.CaseDealParentID,
  2217.     ProductInStore.ComparativeSizeInfo,
  2218.     ProductInStore.AddedVal,
  2219.     ProductInStore.Saving,
  2220.     ProductInStore.IsNew,
  2221.     ProductInStore.Price,
  2222.     ProductInStore.StoreID AS IsAvailable,
  2223.     ProductInStore.IntroductionDate,
  2224.     ProductOptionValue.ProductID AS HasOptions
  2225.  
  2226. FROM ListItem
  2227. INNER JOIN Product
  2228. ON ListItem.ProductID = Product.ProductID
  2229. LEFT  JOIN ProductInStore
  2230. ON Product.ProductID = ProductInStore.ProductID 
  2231. LEFT JOIN ProductOptionValue
  2232. ON ProductOptionValue.ProductID = Product.ProductID
  2233. WHERE
  2234. ListItem.ListID = @ListID
  2235. AND ListItem.ItemNo = @ItemNo
  2236. AND @IntroductionDate != NULL
  2237. AND ProductInStore.StoreID = @StoreID
  2238. AND ProductInStore.IntroductionDate <= @IntroductionDate
  2239. ORDER BY ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  2240.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2241.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2242.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2243.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  2244.                         </select>
  2245.                         <delete name="DELETE FROM ListItem WHERE ListID = @ListID AND ItemNo = @ItemNo" connection="Grocery" type="replace" use="raw">
  2246.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2247.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2248.                         </delete>
  2249.                         <insert name="INSERT INTO ListItem(ListID, ProductID, Quantity, UnitID, ItemNo, Note)
  2250. VALUES(@ListID, @ProductID, @Quantity, @UnitID, @ItemNo, @Note)
  2251. SELECT @@IDENTITY AS ListItemID
  2252.  
  2253. " connection="Grocery" type="replace" use="raw">
  2254.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2255.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2256.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2257.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2258.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2259.                             <parameter name="Note" datatype="string" direction="in"/>
  2260.                         </insert>
  2261.                         <update name="UPDATE ListItem
  2262.     SET ProductID = @ProductID,
  2263.     Quantity = @Quantity,
  2264.     UnitID = @UnitID,
  2265.     Note = @Note
  2266. WHERE ListID = @ListID AND ItemNo = @ItemNo" connection="Grocery" type="replace" use="raw">
  2267.                             <parameter name="ListID" datatype="integer" direction="in"/>
  2268.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2269.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2270.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2271.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2272.                             <parameter name="Note" datatype="string" direction="in"/>
  2273.                         </update>
  2274.                     </query>
  2275.                 </datasource>
  2276.                 <properties>
  2277.                     <property name="ItemID" alias="ListItemID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  2278.                     <property name="ListID" alias="ListID" datatype="integer" nullable="true"/>
  2279.                     <property name="Quantity" alias="Quantity" datatype="float" nullable="false"/>
  2280.                     <property name="ItemNo" alias="ItemNo" datatype="short" nullable="true"/>
  2281.                     <property name="Note" alias="Note" datatype="string" nullable="true"/>
  2282.                     <property name="ItemUnitID" alias="ListUnitID" datatype="integer" nullable="false"/>
  2283.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false"/>
  2284.                     <property name="Name" alias="Name" datatype="string" nullable="true"/>
  2285.                     <property name="Description" alias="Description" datatype="string" nullable="true"/>
  2286.                     <property name="PackSize" alias="PackSize" datatype="short" nullable="true"/>
  2287.                     <property name="UnitSize" alias="UnitSize" datatype="float" nullable="true"/>
  2288.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="false"/>
  2289.                     <property name="ComparativeSizeInfo" alias="ComparativeSizeInfo" datatype="String" nullable="true"/>
  2290.                     <property name="AddedVal" alias="AddedVal" datatype="String" nullable="true"/>
  2291.                     <property name="Saving" alias="Saving" datatype="money" nullable="true"/>
  2292.                     <property name="IsNew" alias="IsNew" datatype="boolean" nullable="true"/>
  2293.                     <property name="HasLabelData" alias="HasLabelData" datatype="boolean" nullable="false"/>
  2294.                     <property name="Price" alias="Price" datatype="money" nullable="true"/>
  2295.                     <property name="ItemCost" alias="ItemCost" datatype="money" nullable="true"/>
  2296.                     <property name="IsAvailable" alias="IsAvailable" datatype="integer" nullable="true"/>
  2297.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="false"/>
  2298.                     <property name="HasOptions" alias="HasOptions" datatype="integer" nullable="true"/>
  2299.                     <property name="IsCaseDealParent" alias="IsCaseDealParent" datatype="boolean" nullable="false"/>
  2300.                     <property name="CaseDealParentID" alias="CaseDealParentID" datatype="integer" nullable="true"/>
  2301.                     <property name="CaseDealImageID" alias="CaseDealImageID" datatype="string" nullable="true"/>
  2302.                     <property name="CategoryRank" alias="CategoryRank" datatype="integer" nullable="true"/>
  2303.                 </properties>
  2304.                 <relationships>
  2305.                     <relationship name="OptionValues" object="ListItemOptionValue" keyprop="down" collection="true" query="ListItemOptionValues">
  2306.                         <key pkey="ItemID" fkey="ListItemID" from="parent" to="child"/>
  2307.                     </relationship>
  2308.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="ProductCategories">
  2309.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  2310.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  2311.                     </relationship>
  2312.                     <relationship name="CaseDealProducts" object="Product" keyprop="none" collection="true" query="StoreProductCaseDealProducts">
  2313.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  2314.                         <key pkey="ProductID" fkey="CaseDealParentID" from="parent" to="child"/>
  2315.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  2316.                     </relationship>
  2317.                 </relationships>
  2318.             </object>
  2319.             <object name="ListItemOptionValue">
  2320.                 <datasource>
  2321.                     <query id="ListItemOptionValues" default="true">
  2322.                         <select name="SELECT ListItemID, ProductOptionID, OptionValue 
  2323. FROM ListItemOptionValue
  2324. WHERE ListItemID = @ListItemID
  2325. " connection="Grocery" type="replace" use="raw">
  2326.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2327.                         </select>
  2328.                         <insert name="INSERT INTO ListItemOptionValue(ListItemID, ProductOptionID, OptionValue)
  2329. VALUES(@ListItemID, @ProductOptionID, @OptionValue)
  2330. " connection="Grocery" type="replace" use="raw">
  2331.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2332.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2333.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2334.                         </insert>
  2335.                         <update name="UPDATE ListItemOptionValue
  2336. SET OptionValue = @OptionValue
  2337. WHERE ListItemID = @ListItemID AND ProductOptionID = @ProductOptionID
  2338. " connection="Grocery" type="replace" use="raw">
  2339.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2340.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2341.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2342.                         </update>
  2343.                         <delete name="DELETE FROM ListItemOptionValue
  2344. WHERE ListItemID = @ListItemID
  2345. " connection="Grocery" type="replace" use="raw">
  2346.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2347.                         </delete>
  2348.                     </query>
  2349.                     <query id="ListItemOptionValue" default="false">
  2350.                         <select name="SELECT ListItemID, ProductOptionID, OptionValue 
  2351. FROM ListItemOptionValue
  2352. WHERE ListItemID = @ListItemID AND ProductOptionID = @ProductOptionID
  2353. " connection="Grocery" type="replace" use="raw">
  2354.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2355.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2356.                         </select>
  2357.                         <insert name="INSERT INTO ListItemOptionValue(ListItemID, ProductOptionID, OptionValue)
  2358. VALUES(@ListItemID, @ProductOptionID, @OptionValue)" connection="Grocery" type="replace" use="raw">
  2359.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2360.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2361.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2362.                         </insert>
  2363.                         <update name="UPDATE ListItemOptionValue
  2364. SET OptionValue = @OptionValue
  2365. WHERE ListItemID = @ListItemID AND ProductOptionID = @ProductOptionID
  2366. " connection="Grocery" type="replace" use="raw">
  2367.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2368.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2369.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2370.                         </update>
  2371.                         <delete name="DELETE FROM ListItemOptionValue
  2372. WHERE ListItemID = @ListItemID AND ProductOptionID = @ProductOptionID
  2373. " connection="Grocery" type="replace" use="raw">
  2374.                             <parameter name="ListItemID" datatype="integer" direction="in"/>
  2375.                             <parameter name="OptionID" datatype="integer" direction="in"/>
  2376.                         </delete>
  2377.                     </query>
  2378.                 </datasource>
  2379.                 <properties>
  2380.                     <property name="ListItemID" alias="ListItemID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  2381.                     <property name="ProductOptionID" alias="ProductOptionID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  2382.                     <property name="OptionValue" alias="OptionValue" datatype="string" nullable="false"/>
  2383.                 </properties>
  2384.                 <relationships/>
  2385.             </object>
  2386.             <object name="OrderItem">
  2387.                 <datasource>
  2388.                     <query id="OrderItems" default="false">
  2389.                         <select name="SELECT DISTINCT
  2390.     OrderItem.OrderItemID,
  2391.     OrderItem.OrderID,
  2392.     OrderItem.Quantity,
  2393.     OrderItem.ItemNo,
  2394.     OrderItem.Note,
  2395.     OrderItem.ItemCost,
  2396.     OrderItem.UnitID AS OrderUnitID,
  2397.     Product.ProductID,
  2398.     Product.Name,
  2399.     Product.Description,
  2400.     Product.PackSize,
  2401.     Product.UnitSize,
  2402.     Product.UnitID,
  2403.     Product.HasLabelData,
  2404.     ProductInStore.IsCaseDealParent,
  2405.     ProductInStore.CaseDealImageID,
  2406.     Product.CaseDealParentID,
  2407.     ProductInStore.ComparativeSizeInfo,
  2408.     ProductInStore.AddedVal,
  2409.     ProductInStore.Saving,
  2410.     ProductInStore.IsNew,
  2411.     ProductInStore.Price,
  2412.     ProductInStore.StoreID AS IsAvailable,
  2413.     ProductInStore.IntroductionDate,
  2414.     ProductOptionValue.ProductID AS HasOptions
  2415.  
  2416. FROM OrderItem
  2417. INNER JOIN Product
  2418. ON Product.ProductID = OrderItem.ProductID 
  2419. LEFT JOIN ProductInStore
  2420. ON Product.ProductID = ProductInStore.ProductID
  2421. LEFT JOIN ProductOptionValue
  2422. ON ProductOptionValue.ProductID = Product.ProductID
  2423. WHERE OrderItem.OrderID = @OrderID
  2424. AND @IntroductionDate != NULL
  2425. AND ProductInStore.StoreID = @StoreID
  2426. AND ProductInStore.IntroductionDate <= @IntroductionDate
  2427.  
  2428. ORDER BY OrderItem.ItemNo ASC,
  2429. ProductInStore.IntroductionDate DESC
  2430. " connection="Grocery" type="replace" use="raw">
  2431.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2432.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2433.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  2434.                         </select>
  2435.                         <insert name="INSERT INTO OrderItem(
  2436.     OrderID,
  2437.     ProductID,
  2438.     Quantity,
  2439.     UnitID,
  2440.     ItemCost,
  2441.     ItemNo,
  2442.     Note,
  2443.     PromoReduction )
  2444.  
  2445. VALUES(
  2446.     @OrderID,
  2447.     @ProductID,
  2448.     @Quantity,
  2449.     @UnitID,
  2450.     @ItemCost,
  2451.     @ItemNo,
  2452.     @Note,
  2453.     @PromoReduction )
  2454. " connection="Grocery" type="replace" use="raw">
  2455.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2456.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2457.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2458.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2459.                             <parameter name="ItemCost" datatype="money" direction="in"/>
  2460.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2461.                             <parameter name="Note" datatype="string" direction="in"/>
  2462.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  2463.                         </insert>
  2464.                         <update name="UPDATE OrderItem
  2465.     SET    OrderID=@OrderID,
  2466.         ProductID=@ProductID,
  2467.         Quantity=@Quantity,
  2468.         UnitID=@UnitID,
  2469.         ItemCost=@ItemCost,
  2470.         ItemNo=@ItemNo,
  2471.         Note=@Note,
  2472.         PromoReduction = @PromoReduction
  2473.     WHERE OrderItemID = @OrderItemID
  2474. " connection="Grocery" type="replace" use="raw">
  2475.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2476.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2477.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2478.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2479.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2480.                             <parameter name="ItemCost" datatype="money" direction="in"/>
  2481.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2482.                             <parameter name="Note" datatype="string" direction="in"/>
  2483.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  2484.                         </update>
  2485.                         <delete name="DELETE FROM OrderItem WHERE OrderItemID = @OrderItemID" connection="Grocery" type="replace" use="raw">
  2486.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2487.                         </delete>
  2488.                     </query>
  2489.                     <query id="OrderItem" default="true">
  2490.                         <select name="SELECT DISTINCT
  2491.     OrderItem.OrderItemID,
  2492.     OrderItem.OrderID,
  2493.     OrderItem.Quantity,
  2494.     OrderItem.ItemNo,
  2495.     OrderItem.Note,
  2496.     OrderItem.UnitID AS OrderUnitID,
  2497.     OrderItem.ItemCost,
  2498.     Product.ProductID,
  2499.     Product.Name,
  2500.     Product.Description,
  2501.     Product.PackSize,
  2502.     Product.UnitSize,
  2503.     Product.UnitID,
  2504.     Product.HasLabelData,
  2505.     ProductInStore.IsCaseDealParent,
  2506.     ProductInStore.CaseDealImageID,
  2507.     Product.CaseDealParentID,
  2508.     ProductInStore.ComparativeSizeInfo,
  2509.     ProductInStore.AddedVal,
  2510.     ProductInStore.Saving,
  2511.     ProductInStore.IsNew,
  2512.     ProductInStore.Price,
  2513.     ProductInStore.StoreID AS IsAvailable,
  2514.     ProductInStore.IntroductionDate,
  2515.     ProductOptionValue.ProductID AS HasOptions
  2516.  
  2517. FROM OrderItem
  2518. INNER JOIN Product
  2519. ON Product.ProductID = OrderItem.ProductID 
  2520. LEFT JOIN ProductInStore
  2521. ON Product.ProductID = ProductInStore.ProductID
  2522. LEFT JOIN ProductOptionValue
  2523. ON ProductOptionValue.ProductID = Product.ProductID
  2524.  
  2525. WHERE    OrderItem.OrderItemID = @OrderItemID
  2526. AND @IntroductionDate != NULL
  2527. AND ProductInStore.StoreID = @StoreID
  2528. AND ProductInStore.IntroductionDate <= @IntroductionDate
  2529.  
  2530. ORDER BY OrderItem.ItemNo ASC,
  2531. ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  2532.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2533.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2534.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  2535.                         </select>
  2536.                         <insert name="INSERT INTO OrderItem(
  2537.     OrderID,
  2538.     ProductID,
  2539.     Quantity,
  2540.     UnitID,
  2541.     ItemCost,
  2542.     ItemNo,
  2543.     Note,
  2544.     PromoReduction )
  2545.  
  2546. VALUES(
  2547.     @OrderID,
  2548.     @ProductID,
  2549.     @Quantity,
  2550.     @UnitID,
  2551.     @ItemCost,
  2552.     @ItemNo,
  2553.     @Note,
  2554.     @PromoReduction )
  2555. " connection="Grocery" type="replace" use="raw">
  2556.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2557.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2558.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2559.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2560.                             <parameter name="ItemCost" datatype="money" direction="in"/>
  2561.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2562.                             <parameter name="Note" datatype="string" direction="in"/>
  2563.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  2564.                         </insert>
  2565.                         <update name="UPDATE OrderItem
  2566.     SET    OrderID=@OrderID,
  2567.         ProductID=@ProductID,
  2568.         Quantity=@Quantity,
  2569.         UnitID=@UnitID,
  2570.         ItemCost=@ItemCost,
  2571.         ItemNo=@ItemNo,
  2572.         Note=@Note,
  2573.         PromoReduction = @PromoReduction
  2574.     WHERE OrderItemID = @OrderItemID
  2575. " connection="Grocery" type="replace" use="raw">
  2576.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2577.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2578.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  2579.                             <parameter name="Quantity" datatype="float" direction="in"/>
  2580.                             <parameter name="UnitID" datatype="integer" direction="in"/>
  2581.                             <parameter name="ItemCost" datatype="money" direction="in"/>
  2582.                             <parameter name="ItemNo" datatype="short" direction="in"/>
  2583.                             <parameter name="Note" datatype="string" direction="in"/>
  2584.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  2585.                         </update>
  2586.                         <delete name="DELETE FROM OrderItem WHERE OrderItemID = @OrderItemID" connection="Grocery" type="replace" use="raw">
  2587.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2588.                         </delete>
  2589.                     </query>
  2590.                 </datasource>
  2591.                 <properties>
  2592.                     <property name="ItemID" alias="OrderItemID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  2593.                     <property name="OrderID" alias="OrderID" datatype="integer" nullable="false"/>
  2594.                     <property name="Quantity" alias="Quantity" datatype="float" nullable="false"/>
  2595.                     <property name="ItemNo" alias="ItemNo" datatype="short" nullable="true"/>
  2596.                     <property name="Note" alias="Note" datatype="string" nullable="true"/>
  2597.                     <property name="ItemUnitID" alias="OrderUnitID" datatype="integer" nullable="false"/>
  2598.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false"/>
  2599.                     <property name="Name" alias="Name" datatype="string" nullable="true"/>
  2600.                     <property name="Description" alias="Description" datatype="string" nullable="true"/>
  2601.                     <property name="PackSize" alias="PackSize" datatype="short" nullable="true"/>
  2602.                     <property name="UnitSize" alias="UnitSize" datatype="float" nullable="true"/>
  2603.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="false"/>
  2604.                     <property name="ComparativeSizeInfo" alias="ComparativeSizeInfo" datatype="String" nullable="true"/>
  2605.                     <property name="AddedVal" alias="AddedVal" datatype="string" nullable="true"/>
  2606.                     <property name="Saving" alias="Saving" datatype="money" nullable="true"/>
  2607.                     <property name="IsNew" alias="IsNew" datatype="boolean" nullable="true"/>
  2608.                     <property name="HasLabelData" alias="HasLabelData" datatype="boolean" nullable="false"/>
  2609.                     <property name="Price" alias="Price" datatype="money" nullable="true"/>
  2610.                     <property name="ItemCost" alias="ItemCost" datatype="money" nullable="true"/>
  2611.                     <property name="IsAvailable" alias="IsAvailable" datatype="integer" nullable="true"/>
  2612.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="false"/>
  2613.                     <property name="HasOptions" alias="HasOptions" datatype="integer" nullable="true"/>
  2614.                     <property name="PromoReduction" alias="PromoReduction" datatype="money" nullable="true"/>
  2615.                     <property name="IsCaseDealParent" alias="IsCaseDealParent" datatype="boolean" nullable="false"/>
  2616.                     <property name="CaseDealParentID" alias="CaseDealParentID" datatype="integer" nullable="true"/>
  2617.                     <property name="CaseDealImageID" alias="CaseDealImageID" datatype="string" nullable="true"/>
  2618.                     <property name="CategoryRank" alias="CategoryRank" datatype="integer" nullable="true"/>
  2619.                 </properties>
  2620.                 <relationships>
  2621.                     <relationship name="OptionValues" object="OrderItemOptionValue" keyprop="down" collection="true" query="OrderItemOptionValues">
  2622.                         <key pkey="ItemID" fkey="OrderItemID" from="parent" to="child"/>
  2623.                     </relationship>
  2624.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="ProductCategories">
  2625.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  2626.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  2627.                     </relationship>
  2628.                     <relationship name="CaseDealProducts" object="Product" keyprop="none" collection="true" query="StoreProductCaseDealProducts">
  2629.                         <key pkey="IsAvailable" fkey="StoreID" from="parent" to="child"/>
  2630.                         <key pkey="ProductID" fkey="CaseDealParentID" from="parent" to="child"/>
  2631.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  2632.                     </relationship>
  2633.                 </relationships>
  2634.             </object>
  2635.             <object name="OrderItemOptionValue">
  2636.                 <datasource>
  2637.                     <query id="OrderItemOptionValues" default="false">
  2638.                         <select name="SELECT OrderItemID, ProductOptionID, OptionValue 
  2639. FROM OrderItemOptionValue
  2640. WHERE OrderItemID = @OrderItemID
  2641. " connection="Grocery" type="replace" use="raw">
  2642.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2643.                         </select>
  2644.                         <insert name="INSERT INTO OrderItemOptionValue(OrderItemID, ProductOptionID, OptionValue)
  2645. VALUES(@OrderItemID, @ProductOptionID, @OptionValue)
  2646. " connection="Grocery" type="replace" use="raw">
  2647.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2648.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2649.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2650.                         </insert>
  2651.                         <update name="NOT_USED" connection="Grocery" type="replace" use="raw">
  2652.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2653.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2654.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2655.                         </update>
  2656.                         <delete name="DELETE FROM OrderItemOptionValue
  2657. WHERE OrderItemID = @OrderItemID" connection="Grocery" type="replace" use="raw">
  2658.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2659.                         </delete>
  2660.                     </query>
  2661.                     <query id="OrderItemOptionValue" default="true">
  2662.                         <select name="SELECT OrderItemID, ProductOptionID, OptionValue 
  2663. FROM OrderItemOptionValue
  2664. WHERE OrderItemID = @OrderItemID AND ProductOptionID = @ProductOptionID
  2665. " connection="Grocery" type="replace" use="raw">
  2666.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2667.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2668.                         </select>
  2669.                         <insert name="INSERT INTO OrderItemOptionValue(OrderItemID, ProductOptionID, OptionValue)
  2670. VALUES(@OrderItemID, @ProductOptionID, @OptionValue)
  2671. " connection="Grocery" type="replace" use="raw">
  2672.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2673.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2674.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2675.                         </insert>
  2676.                         <update name="UpdateOrderItemOptionValue" connection="Grocery" type="proc" use="raw">
  2677.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2678.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2679.                             <parameter name="OptionValue" datatype="string" direction="in"/>
  2680.                         </update>
  2681.                         <delete name="DELETE FROM OrderItemOptionValue
  2682. WHERE OrderItemID = @OrderItemID AND ProductOptionID = @ProductOptionID
  2683. " connection="Grocery" type="replace" use="raw">
  2684.                             <parameter name="OrderItemID" datatype="integer" direction="in"/>
  2685.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  2686.                         </delete>
  2687.                     </query>
  2688.                 </datasource>
  2689.                 <properties>
  2690.                     <property name="OrderItemID" alias="OrderItemID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  2691.                     <property name="ProductOptionID" alias="ProductOptionID" datatype="integer" nullable="false" pkey="true" identity="false"/>
  2692.                     <property name="OptionValue" alias="OptionValue" datatype="string" nullable="false"/>
  2693.                     <property name="OptionType" alias="OptionType" datatype="string" nullable="false"/>
  2694.                     <property name="SelectedOptionValue" alias="SelectedOptionValue" datatype="string" nullable="false"/>
  2695.                 </properties>
  2696.                 <relationships/>
  2697.             </object>
  2698.             <object name="Order">
  2699.                 <datasource>
  2700.                     <query id="CustomerOrders" default="false">
  2701.                         <select name="SELECT     Orders.OrderID,
  2702.         Orders.CustomerID, 
  2703.         Orders.StoreID,
  2704.         Orders.OrderCost,
  2705.         Orders.TotalItemCost,
  2706.         Orders.TotalItems,
  2707.         Orders.OrderDate,
  2708.         Orders.Status,
  2709.         Orders.PromoReduction,
  2710.         Orders.LoyaltyPoints,
  2711.         Orders.InvoiceAddress,
  2712.         Orders.DeliveryHouseName,
  2713.         Orders.DeliveryStreet,
  2714.         Orders.DeliveryArea,
  2715.         Orders.DeliveryTown,
  2716.         Orders.DeliveryCounty,
  2717.         Orders.DeliveryPostcode,
  2718.         Orders.IsMailingAddress,
  2719.         Orders.DeliveryID,
  2720.         Orders.DeliveryStartDate,
  2721.         Orders.DeliveryEndDate,
  2722.         Orders.AcceptSubs,
  2723.         Orders.Instructions,
  2724.         Orders.DeliveryInstructions,
  2725.         Orders.CCNo,
  2726.         Orders.CCName,
  2727.         Orders.CCFromDate,
  2728.         Orders.CCExpDate,
  2729.         Orders.CCIssueNo,
  2730.         Orders.CCType,
  2731.         Orders.Source
  2732. FROM Orders
  2733. WHERE CustomerID = @CustomerID
  2734. ORDER BY OrderDate DESC
  2735. " connection="Grocery" type="replace" use="raw">
  2736.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  2737.                         </select>
  2738.                     </query>
  2739.                     <query id="CustomerCurrentOrder" default="false">
  2740.                         <select name="SELECT     Orders.OrderID,
  2741.         Orders.CustomerID, 
  2742.         Orders.StoreID,
  2743.         Orders.OrderCost,
  2744.         Orders.TotalItemCost,
  2745.         Orders.TotalItems,
  2746.         Orders.OrderDate,
  2747.         Orders.Status,
  2748.         Orders.PromoReduction,
  2749.         Orders.LoyaltyPoints,
  2750.         Orders.InvoiceAddress,
  2751.         Orders.DeliveryHouseName,
  2752.         Orders.DeliveryStreet,
  2753.         Orders.DeliveryArea,
  2754.         Orders.DeliveryTown,
  2755.         Orders.DeliveryCounty,
  2756.         Orders.DeliveryPostcode,
  2757.         Orders.IsMailingAddress,
  2758.         Orders.DeliveryID,
  2759.         Orders.DeliveryStartDate,
  2760.         Orders.DeliveryEndDate,
  2761.         Orders.AcceptSubs,
  2762.         Orders.Instructions,
  2763.         Orders.DeliveryInstructions,
  2764.         Orders.CCNo,
  2765.         Orders.CCName,
  2766.         Orders.CCFromDate,
  2767.         Orders.CCExpDate,
  2768.         Orders.CCIssueNo,
  2769.         Orders.CCType,
  2770.         Orders.Source
  2771. FROM Orders
  2772. WHERE CustomerID = @CustomerID
  2773. AND Status = 1
  2774. ORDER BY OrderDate DESC" connection="Grocery" type="replace" use="raw">
  2775.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  2776.                         </select>
  2777.                         <insert name="INSERT INTO Orders
  2778.     (
  2779.     CustomerID, 
  2780.     StoreID, 
  2781.     OrderCost,
  2782.     TotalItemCost,
  2783.     TotalItems, 
  2784.     OrderDate,   
  2785.     Status, 
  2786.     PromoReduction, 
  2787.     LoyaltyPoints, 
  2788.     InvoiceAddress, 
  2789.     DeliveryHouseName, 
  2790.     DeliveryStreet,
  2791.     DeliveryArea,
  2792.     DeliveryTown,
  2793.     DeliveryCounty,
  2794.     DeliveryPostcode,
  2795.     IsMailingAddress,
  2796.     DeliveryID,
  2797.     DeliveryStartDate,
  2798.     DeliveryEndDate,
  2799.     AcceptSubs,
  2800.     Instructions,
  2801.     DeliveryInstructions,
  2802.     CCNo,
  2803.     CCName,
  2804.     CCFromDate,
  2805.     CCExpDate,
  2806.     CCIssueNo,
  2807.     CCType,    
  2808.     Source
  2809.     )
  2810. VALUES
  2811.     (
  2812.     @CustomerID, 
  2813.     @StoreID, 
  2814.     @OrderCost,
  2815.     @TotalItemCost,
  2816.     @TotalItems,
  2817.     @OrderDate,   
  2818.     @Status, 
  2819.     @PromoReduction,
  2820.     @LoyaltyPoints,
  2821.     @InvoiceAddress, 
  2822.     @DeliveryHouseName, 
  2823.     @DeliveryStreet,
  2824.     @DeliveryArea,
  2825.     @DeliveryTown,
  2826.     @DeliveryCounty,
  2827.     @DeliveryPostcode, 
  2828.     @IsMailingAddress,
  2829.     @DeliveryID,
  2830.     @DeliveryStartDate,
  2831.     @DeliveryEndDate,
  2832.     @AcceptSubs,
  2833.     @Instructions,
  2834.     @DeliveryInstructions,
  2835.     @CCNo,
  2836.     @CCName,
  2837.     @CCFromDate,
  2838.     @CCExpDate,
  2839.     @CCIssueNo,
  2840.     @CCType,
  2841.     @Source
  2842.     )
  2843. " connection="Grocery" type="replace" use="raw">
  2844.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  2845.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2846.                             <parameter name="OrderCost" datatype="money" direction="in"/>
  2847.                             <parameter name="TotalItemCost" datatype="money" direction="in"/>
  2848.                             <parameter name="TotalItems" datatype="short" direction="in"/>
  2849.                             <parameter name="OrderDate" datatype="date" direction="in"/>
  2850.                             <parameter name="Status" datatype="integer" direction="in"/>
  2851.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  2852.                             <parameter name="LoyaltyPoints" datatype="integer" direction="in"/>
  2853.                             <parameter name="InvoiceAddress" datatype="string" direction="in"/>
  2854.                             <parameter name="DeliveryHouseName" datatype="string" direction="in"/>
  2855.                             <parameter name="DeliveryStreet" datatype="string" direction="in"/>
  2856.                             <parameter name="DeliveryArea" datatype="string" direction="in"/>
  2857.                             <parameter name="DeliveryTown" datatype="string" direction="in"/>
  2858.                             <parameter name="DeliveryCounty" datatype="string" direction="in"/>
  2859.                             <parameter name="DeliveryPostcode" datatype="string" direction="in"/>
  2860.                             <parameter name="IsMailingAddress" datatype="boolean" direction="in"/>
  2861.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  2862.                             <parameter name="DeliveryStartDate" datatype="date" direction="in"/>
  2863.                             <parameter name="DeliveryEndDate" datatype="date" direction="in"/>
  2864.                             <parameter name="AcceptSubs" datatype="boolean" direction="in"/>
  2865.                             <parameter name="Instructions" datatype="string" direction="in"/>
  2866.                             <parameter name="DeliveryInstructions" datatype="string" direction="in"/>
  2867.                             <parameter name="CCNo" datatype="string" direction="in"/>
  2868.                             <parameter name="CCName" datatype="string" direction="in"/>
  2869.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  2870.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  2871.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  2872.                             <parameter name="CCType" datatype="string" direction="in"/>
  2873.                             <parameter name="Source" datatype="string" direction="in"/>
  2874.                         </insert>
  2875.                         <update name="UPDATE Orders 
  2876. SET 
  2877.     StoreID=@StoreID,
  2878.     OrderCost=@OrderCost,
  2879.     TotalItemCost=@TotalItemCost,
  2880.     TotalItems=@TotalItems,
  2881.     OrderDate=@OrderDate,
  2882.     Status = @Status,
  2883.     PromoReduction=@PromoReduction,
  2884.     LoyaltyPoints=@LoyaltyPoints,
  2885.     InvoiceAddress=@InvoiceAddress,
  2886.     DeliveryHouseName=@DeliveryHouseName,
  2887.     DeliveryStreet=@DeliveryStreet,
  2888.     DeliveryArea=@DeliveryArea,
  2889.     DeliveryTown=@DeliveryTown,
  2890.     DeliveryCounty=@DeliveryCounty,
  2891.     DeliveryPostcode=@DeliveryPostcode,
  2892.     IsMailingAddress=@IsMailingAddress,
  2893.     DeliveryID=@DeliveryID,
  2894.     DeliveryStartDate=@DeliveryStartDate,
  2895.     DeliveryEndDate=@DeliveryEndDate,
  2896.     AcceptSubs=@AcceptSubs,
  2897.     Instructions=@Instructions,
  2898.     DeliveryInstructions=@DeliveryInstructions,
  2899.     CCNo=@CCNo,
  2900.     CCName=@CCName,
  2901.     CCFromDate=@CCFromDate,
  2902.     CCExpDate=@CCExpDate,
  2903.     CCIssueNo=@CCIssueNo,
  2904.     CCType=@CCType,
  2905.     Source=@Source
  2906. WHERE Orders.OrderID = @OrderID
  2907. " connection="Grocery" type="replace" use="raw">
  2908.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2909.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  2910.                             <parameter name="OrderCost" datatype="money" direction="in"/>
  2911.                             <parameter name="TotalItemCost" datatype="money" direction="in"/>
  2912.                             <parameter name="TotalItems" datatype="short" direction="in"/>
  2913.                             <parameter name="OrderDate" datatype="date" direction="in"/>
  2914.                             <parameter name="Status" datatype="integer" direction="in"/>
  2915.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  2916.                             <parameter name="LoyaltyPoints" datatype="integer" direction="in"/>
  2917.                             <parameter name="InvoiceAddress" datatype="string" direction="in"/>
  2918.                             <parameter name="DeliveryHouseName" datatype="string" direction="in"/>
  2919.                             <parameter name="DeliveryStreet" datatype="string" direction="in"/>
  2920.                             <parameter name="DeliveryArea" datatype="string" direction="in"/>
  2921.                             <parameter name="DeliveryTown" datatype="string" direction="in"/>
  2922.                             <parameter name="DeliveryCounty" datatype="string" direction="in"/>
  2923.                             <parameter name="DeliveryPostcode" datatype="string" direction="in"/>
  2924.                             <parameter name="IsMailingAddress" datatype="boolean" direction="in"/>
  2925.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  2926.                             <parameter name="DeliveryStartDate" datatype="date" direction="in"/>
  2927.                             <parameter name="DeliveryEndDate" datatype="date" direction="in"/>
  2928.                             <parameter name="AcceptSubs" datatype="boolean" direction="in"/>
  2929.                             <parameter name="Instructions" datatype="string" direction="in"/>
  2930.                             <parameter name="DeliveryInstructions" datatype="string" direction="in"/>
  2931.                             <parameter name="CCNo" datatype="string" direction="in"/>
  2932.                             <parameter name="CCName" datatype="string" direction="in"/>
  2933.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  2934.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  2935.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  2936.                             <parameter name="CCType" datatype="string" direction="in"/>
  2937.                             <parameter name="Source" datatype="string" direction="in"/>
  2938.                         </update>
  2939.                         <delete name="NOT_USED" connection="Grocery" type="replace" use="raw">
  2940.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2941.                         </delete>
  2942.                     </query>
  2943.                     <query id="CustomerOrder" default="true">
  2944.                         <select name="SELECT     Orders.OrderID, 
  2945.         Orders.CustomerID,
  2946.         Orders.StoreID,
  2947.         Orders.OrderCost,
  2948.         Orders.TotalItemCost,
  2949.         Orders.TotalItems,
  2950.         Orders.OrderDate,
  2951.         Orders.Status,
  2952.         Orders.PromoReduction,
  2953.         Orders.LoyaltyPoints,
  2954.         Orders.InvoiceAddress,
  2955.         Orders.DeliveryHouseName,
  2956.         Orders.DeliveryStreet,
  2957.         Orders.DeliveryArea,
  2958.         Orders.DeliveryTown,
  2959.         Orders.DeliveryCounty,
  2960.         Orders.DeliveryPostcode,
  2961.         Orders.IsMailingAddress,
  2962.         Orders.DeliveryID,
  2963.         Orders.DeliveryStartDate,
  2964.         Orders.DeliveryEndDate,
  2965.         Orders.AcceptSubs,
  2966.         Orders.Instructions,
  2967.         Orders.DeliveryInstructions,
  2968.         Orders.CCNo,
  2969.         Orders.CCName,
  2970.         Orders.CCFromDate,
  2971.         Orders.CCExpDate,
  2972.         Orders.CCIssueNo,
  2973.         Orders.CCType,
  2974.         Orders.Source
  2975. FROM Orders
  2976. WHERE OrderID = @OrderID" connection="Grocery" type="replace" use="raw">
  2977.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  2978.                         </select>
  2979.                         <insert name="INSERT INTO Orders
  2980.     (
  2981.     CustomerID, 
  2982.     StoreID, 
  2983.     OrderCost,
  2984.     TotalItemCost,
  2985.     TotalItems, 
  2986.     OrderDate,   
  2987.     Status, 
  2988.     PromoReduction, 
  2989.     LoyaltyPoints, 
  2990.     InvoiceAddress, 
  2991.     DeliveryHouseName, 
  2992.     DeliveryStreet,
  2993.     DeliveryArea,
  2994.     DeliveryTown,
  2995.     DeliveryCounty,
  2996.     DeliveryPostcode,
  2997.     IsMailingAddress,
  2998.     DeliveryID,
  2999.     DeliveryStartDate,
  3000.     DeliveryEndDate,
  3001.     AcceptSubs,
  3002.     Instructions,
  3003.     DeliveryInstructions,
  3004.     CCNo,
  3005.     CCName,
  3006.     CCFromDate,
  3007.     CCExpDate,
  3008.     CCIssueNo,
  3009.     CCType,    
  3010.     Source
  3011.     )
  3012. VALUES
  3013.     (
  3014.     @CustomerID, 
  3015.     @StoreID, 
  3016.     @OrderCost,
  3017.     @TotalItemCost,
  3018.     @TotalItems,
  3019.     @OrderDate,   
  3020.     @Status, 
  3021.     @PromoReduction,
  3022.     @LoyaltyPoints,
  3023.     @InvoiceAddress, 
  3024.     @DeliveryHouseName, 
  3025.     @DeliveryStreet,
  3026.     @DeliveryArea,
  3027.     @DeliveryTown,
  3028.     @DeliveryCounty,
  3029.     @DeliveryPostcode, 
  3030.     @IsMailingAddress,
  3031.     @DeliveryID,
  3032.     @DeliveryStartDate,
  3033.     @DeliveryEndDate,
  3034.     @AcceptSubs,
  3035.     @Instructions,
  3036.     @DeliveryInstructions,
  3037.     @CCNo,
  3038.     @CCName,
  3039.     @CCFromDate,
  3040.     @CCExpDate,
  3041.     @CCIssueNo,
  3042.     @CCType,
  3043.     @Source
  3044.     )
  3045. " connection="Grocery" type="replace" use="raw">
  3046.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  3047.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3048.                             <parameter name="OrderCost" datatype="money" direction="in"/>
  3049.                             <parameter name="TotalItemCost" datatype="money" direction="in"/>
  3050.                             <parameter name="TotalItems" datatype="short" direction="in"/>
  3051.                             <parameter name="OrderDate" datatype="date" direction="in"/>
  3052.                             <parameter name="Status" datatype="integer" direction="in"/>
  3053.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  3054.                             <parameter name="LoyaltyPoints" datatype="integer" direction="in"/>
  3055.                             <parameter name="InvoiceAddress" datatype="string" direction="in"/>
  3056.                             <parameter name="DeliveryHouseName" datatype="string" direction="in"/>
  3057.                             <parameter name="DeliveryStreet" datatype="string" direction="in"/>
  3058.                             <parameter name="DeliveryArea" datatype="string" direction="in"/>
  3059.                             <parameter name="DeliveryTown" datatype="string" direction="in"/>
  3060.                             <parameter name="DeliveryCounty" datatype="string" direction="in"/>
  3061.                             <parameter name="DeliveryPostcode" datatype="string" direction="in"/>
  3062.                             <parameter name="IsMailingAddress" datatype="boolean" direction="in"/>
  3063.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  3064.                             <parameter name="DeliveryStartDate" datatype="date" direction="in"/>
  3065.                             <parameter name="DeliveryEndDate" datatype="date" direction="in"/>
  3066.                             <parameter name="AcceptSubs" datatype="boolean" direction="in"/>
  3067.                             <parameter name="Instructions" datatype="string" direction="in"/>
  3068.                             <parameter name="DeliveryInstructions" datatype="string" direction="in"/>
  3069.                             <parameter name="CCNo" datatype="string" direction="in"/>
  3070.                             <parameter name="CCName" datatype="string" direction="in"/>
  3071.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  3072.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  3073.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  3074.                             <parameter name="CCType" datatype="string" direction="in"/>
  3075.                             <parameter name="Source" datatype="string" direction="in"/>
  3076.                         </insert>
  3077.                         <update name="UPDATE Orders 
  3078. SET 
  3079.     StoreID=@StoreID,
  3080.     OrderCost=@OrderCost,
  3081.     TotalItemCost=@TotalItemCost,
  3082.     TotalItems=@TotalItems,
  3083.     OrderDate=@OrderDate,
  3084.     Status = @Status,
  3085.     PromoReduction=@PromoReduction,
  3086.     LoyaltyPoints=@LoyaltyPoints,
  3087.     InvoiceAddress=@InvoiceAddress,
  3088.     DeliveryHouseName=@DeliveryHouseName,
  3089.     DeliveryStreet=@DeliveryStreet,
  3090.     DeliveryArea=@DeliveryArea,
  3091.     DeliveryTown=@DeliveryTown,
  3092.     DeliveryCounty=@DeliveryCounty,
  3093.     DeliveryPostcode=@DeliveryPostcode,
  3094.     IsMailingAddress=@IsMailingAddress,
  3095.     DeliveryID=@DeliveryID,
  3096.     DeliveryStartDate=@DeliveryStartDate,
  3097.     DeliveryEndDate=@DeliveryEndDate,
  3098.     AcceptSubs=@AcceptSubs,
  3099.     Instructions=@Instructions,
  3100.     DeliveryInstructions=@DeliveryInstructions,
  3101.     CCNo=@CCNo,
  3102.     CCName=@CCName,
  3103.     CCFromDate=@CCFromDate,
  3104.     CCExpDate=@CCExpDate,
  3105.     CCIssueNo=@CCIssueNo,
  3106.     CCType=@CCType,
  3107.     Source=@Source
  3108. WHERE Orders.OrderID = @OrderID
  3109. " connection="Grocery" type="replace" use="raw">
  3110.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  3111.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3112.                             <parameter name="OrderCost" datatype="money" direction="in"/>
  3113.                             <parameter name="TotalItemCost" datatype="money" direction="in"/>
  3114.                             <parameter name="TotalItems" datatype="short" direction="in"/>
  3115.                             <parameter name="OrderDate" datatype="date" direction="in"/>
  3116.                             <parameter name="Status" datatype="integer" direction="in"/>
  3117.                             <parameter name="PromoReduction" datatype="money" direction="in"/>
  3118.                             <parameter name="LoyaltyPoints" datatype="integer" direction="in"/>
  3119.                             <parameter name="InvoiceAddress" datatype="string" direction="in"/>
  3120.                             <parameter name="DeliveryHouseName" datatype="string" direction="in"/>
  3121.                             <parameter name="DeliveryStreet" datatype="string" direction="in"/>
  3122.                             <parameter name="DeliveryArea" datatype="string" direction="in"/>
  3123.                             <parameter name="DeliveryTown" datatype="string" direction="in"/>
  3124.                             <parameter name="DeliveryCounty" datatype="string" direction="in"/>
  3125.                             <parameter name="DeliveryPostcode" datatype="string" direction="in"/>
  3126.                             <parameter name="IsMailingAddress" datatype="boolean" direction="in"/>
  3127.                             <parameter name="DeliveryID" datatype="integer" direction="in"/>
  3128.                             <parameter name="DeliveryStartDate" datatype="date" direction="in"/>
  3129.                             <parameter name="DeliveryEndDate" datatype="date" direction="in"/>
  3130.                             <parameter name="AcceptSubs" datatype="boolean" direction="in"/>
  3131.                             <parameter name="Instructions" datatype="string" direction="in"/>
  3132.                             <parameter name="DeliveryInstructions" datatype="string" direction="in"/>
  3133.                             <parameter name="CCNo" datatype="string" direction="in"/>
  3134.                             <parameter name="CCName" datatype="string" direction="in"/>
  3135.                             <parameter name="CCFromDate" datatype="date" direction="in"/>
  3136.                             <parameter name="CCExpDate" datatype="date" direction="in"/>
  3137.                             <parameter name="CCIssueNo" datatype="String" direction="in"/>
  3138.                             <parameter name="CCType" datatype="string" direction="in"/>
  3139.                             <parameter name="Source" datatype="string" direction="in"/>
  3140.                         </update>
  3141.                         <delete name="NOT_USED" connection="Grocery" type="replace" use="raw">
  3142.                             <parameter name="OrderID" datatype="integer" direction="in"/>
  3143.                         </delete>
  3144.                     </query>
  3145.                 </datasource>
  3146.                 <properties>
  3147.                     <property name="OrderID" alias="OrderID" datatype="integer" nullable="false" pkey="true" identity="true"/>
  3148.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="false"/>
  3149.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="true"/>
  3150.                     <property name="OrderCost" alias="OrderCost" datatype="money" nullable="true"/>
  3151.                     <property name="TotalItemCost" alias="TotalItemCost" datatype="money" nullable="true"/>
  3152.                     <property name="TotalItems" alias="TotalItems" datatype="short" nullable="true"/>
  3153.                     <property name="OrderDate" alias="OrderDate" datatype="date" nullable="true"/>
  3154.                     <property name="Status" alias="Status" datatype="short" nullable="true"/>
  3155.                     <property name="PromoReduction" alias="PromoReduction" datatype="money" nullable="true"/>
  3156.                     <property name="LoyaltyPoints" alias="LoyaltyPoints" datatype="integer" nullable="true"/>
  3157.                     <property name="InvoiceAddress" alias="InvoiceAddress" datatype="string" nullable="true"/>
  3158.                     <property name="DeliveryHouseName" alias="DeliveryHouseName" datatype="string" nullable="true"/>
  3159.                     <property name="DeliveryStreet" alias="DeliveryStreet" datatype="string" nullable="true"/>
  3160.                     <property name="DeliveryArea" alias="DeliveryArea" datatype="string" nullable="true"/>
  3161.                     <property name="DeliveryTown" alias="DeliveryTown" datatype="string" nullable="true"/>
  3162.                     <property name="DeliveryCounty" alias="DeliveryCounty" datatype="string" nullable="true"/>
  3163.                     <property name="DeliveryPostcode" alias="DeliveryPostcode" datatype="string" nullable="true"/>
  3164.                     <property name="IsMailingAddress" alias="IsMailingAddress" datatype="boolean" nullable="true"/>
  3165.                     <property name="DeliveryID" alias="DeliveryID" datatype="integer" nullable="true"/>
  3166.                     <property name="DeliveryStartDate" alias="DeliveryStartDate" datatype="date" nullable="true"/>
  3167.                     <property name="DeliveryEndDate" alias="DeliveryEndDate" datatype="date" nullable="true"/>
  3168.                     <property name="AcceptSubs" alias="AcceptSubs" datatype="boolean" nullable="true"/>
  3169.                     <property name="Instructions" alias="Instructions" datatype="string" nullable="true"/>
  3170.                     <property name="DeliveryInstructions" alias="DeliveryInstructions" datatype="string" nullable="true"/>
  3171.                     <property name="CCNo" alias="CCNo" datatype="string" nullable="true"/>
  3172.                     <property name="CCName" alias="CCName" datatype="string" nullable="true"/>
  3173.                     <property name="CCFromDate" alias="CCFromDate" datatype="date" nullable="true"/>
  3174.                     <property name="CCExpDate" alias="CCExpDate" datatype="date" nullable="true"/>
  3175.                     <property name="CCIssueNo" alias="CCIssueNo" datatype="string" nullable="true"/>
  3176.                     <property name="CCType" alias="CCType" datatype="string" nullable="true"/>
  3177.                     <property name="Source" alias="Source" datatype="string" nullable="true"/>
  3178.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="true"/>
  3179.                 </properties>
  3180.                 <relationships>
  3181.                     <relationship name="Items" object="OrderItem" keyprop="down" collection="true" query="OrderItems">
  3182.                         <key pkey="OrderID" fkey="OrderID" from="parent" to="child"/>
  3183.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  3184.                     </relationship>
  3185.                     <relationship name="ItemsInStore" object="OrderItem" keyprop="down" collection="true" query="OrderItems">
  3186.                         <key pkey="OrderID" fkey="OrderID" from="parent" to="child"/>
  3187.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  3188.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  3189.                     </relationship>
  3190.                     <relationship name="InvoiceAddress" object="Address" keyprop="down" collection="false" query="AddressByID">
  3191.                         <key pkey="InvoiceAddressID" fkey="AddressID" from="parent" to="child"/>
  3192.                     </relationship>
  3193.                     <relationship name="Delivery" object="Delivery" keyprop="down" collection="false" query="OrderDelivery">
  3194.                         <key pkey="OrderID" fkey="OrderID" from="parent" to="child"/>
  3195.                     </relationship>
  3196.                 </relationships>
  3197.                 <methods>
  3198.                     <method name="CancelOrder" returntype="boolean" uuid="IcelandGrocery.Order" implname="CancelOrder">
  3199.                         <parameter name="OrderID" datatype="integer" direction="in"/>
  3200.                         <parameter name="Status" datatype="integer" direction="in"/>
  3201.                     </method>
  3202.                 </methods>
  3203.             </object>
  3204.             <object name="Parameter">
  3205.                 <datasource>
  3206.                     <query id="SiteParameter" default="true">
  3207.                         <select name="SELECT
  3208.     Parameter.ParameterID,
  3209.     Parameter.Name,
  3210.     Parameter.ParameterValue
  3211. FROM
  3212.     Parameter
  3213. WHERE
  3214.     Parameter.Name = @Name
  3215. " connection="Grocery" type="replace" use="raw">
  3216.                             <parameter name="Name" datatype="string" direction="in"/>
  3217.                         </select>
  3218.                         <update name="UPDATE Parameter
  3219. SET ParameterValue = @ParameterValue
  3220. WHERE Name = @Name
  3221. " connection="Grocery" type="replace" use="raw">
  3222.                             <parameter name="Name" datatype="string" direction="in"/>
  3223.                             <parameter name="ParameterValue" datatype="string" direction="in"/>
  3224.                         </update>
  3225.                     </query>
  3226.                     <query id="SiteParameters" default="false">
  3227.                         <select name="SELECT
  3228.     Parameter.ParameterID,
  3229.     Parameter.Name,
  3230.     Parameter.ParameterValue
  3231. FROM
  3232.     Parameter
  3233. " connection="Grocery" type="replace" use="raw"/>
  3234.                     </query>
  3235.                 </datasource>
  3236.                 <properties>
  3237.                     <property name="ParameterID" alias="ParameterID" datatype="int" nullable="false" identity="true" pkey="true"/>
  3238.                     <property name="Name" alias="Name" datatype="string" nullable="false"/>
  3239.                     <property name="ParameterValue" alias="ParameterValue" datatype="string" nullable="true"/>
  3240.                 </properties>
  3241.                 <relationships>
  3242.                     <relationship object="Parameter" name="Parameters" keyprop="none" collection="true" query="SiteParameters"/>
  3243.                 </relationships>
  3244.             </object>
  3245.             <object name="PostcodeZone">
  3246.                 <datasource>
  3247.                     <query id="PostcodeStore" default="true">
  3248.                         <select name="SelectPostcodeStore" connection="Grocery" type="proc" use="raw">
  3249.                             <parameter name="Postcode" datatype="string" direction="in"/>
  3250.                         </select>
  3251.                     </query>
  3252.                 </datasource>
  3253.                 <properties>
  3254.                     <property name="Postcode" alias="Postcode" datatype="string" nullable="false" pkey="false"/>
  3255.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="false" pkey="false"/>
  3256.                     <property name="ZoneID" alias="ZoneID" datatype="integer" nullable="false" pkey="false"/>
  3257.                 </properties>
  3258.                 <relationships>
  3259.                     <relationship name="DeliverySlots" object="Delivery" keyprop="none" collection="true" query="Deliveries">
  3260.                         <key pkey="ZoneID" fkey="ZoneID" from="parent" to="child"/>
  3261.                     </relationship>
  3262.                 </relationships>
  3263.             </object>
  3264.             <object name="PriceChange">
  3265.                 <datasource>
  3266.                     <query id="NextChange" default="true">
  3267.                         <select name="SELECT 
  3268.     PriceChangeDate
  3269. FROM
  3270.     PriceChange
  3271. WHERE
  3272.     PriceChangeDate>=GetDate()
  3273. ORDER BY PriceChangeDate
  3274. " connection="Grocery" use="raw" type="replace"/>
  3275.                         <update name="UPDATE PriceChange
  3276. SET PriceChangeDate=@PriceChangeDate
  3277. WHERE PriceChangeID = @PriceChangeID" connection="Grocery" use="raw" type="replace">
  3278.                             <parameter name="PriceChangeID" datatype="integer" direction="in"/>
  3279.                             <parameter name="PriceChangeDate" datatype="date" direction="in"/>
  3280.                         </update>
  3281.                         <insert name="INSERT INTO PriceChange
  3282. (PriceChangeDate)
  3283. VALUES
  3284. (@PriceChangeDate)" connection="Grocery" use="raw" type="replace">
  3285.                             <parameter name="PriceChangeDate" datatype="date" direction="in"/>
  3286.                         </insert>
  3287.                         <delete name="DELETE FROM PriceChange
  3288. WHERE PriceChangeID=@PriceChangeID" connection="Grocery" type="replace" use="raw">
  3289.                             <parameter name="PriceChangeID" datatype="integer" direction="in"/>
  3290.                         </delete>
  3291.                     </query>
  3292.                     <query id="PriceChangeDates" default="false">
  3293.                         <select name="SELECT PriceChangeID,PriceChangeDate
  3294. FROM PriceChange" connection="Grocery" use="raw" type="replace"/>
  3295.                         <update name="UPDATE PriceChange
  3296. SET PriceChangeDate=@PriceChangeDate
  3297. WHERE PriceChangeID = @PriceChangeID
  3298. " connection="Grocery" use="raw" type="replace">
  3299.                             <parameter name="PriceChangeID" datatype="integer" direction="in"/>
  3300.                             <parameter name="PriceChangeDate" datatype="date" direction="in"/>
  3301.                         </update>
  3302.                         <insert name="INSERT INTO PriceChange
  3303. (PriceChangeDate)
  3304. VALUES
  3305. (@PriceChangeDate)" connection="Grocery" use="raw" type="replace">
  3306.                             <parameter name="PriceChangeDate" datatype="date" direction="in"/>
  3307.                         </insert>
  3308.                         <delete name="DELETE FROM PriceChange
  3309. WHERE PriceChangeID=@PriceChangeID" connection="Grocery" type="replace" use="raw">
  3310.                             <parameter name="PriceChangeID" datatype="integer" direction="in"/>
  3311.                         </delete>
  3312.                     </query>
  3313.                 </datasource>
  3314.                 <properties>
  3315.                     <property name="PriceChangeID" alias="PriceChangeID" datatype="integer" pkey="true" identity="true" nullable="false"/>
  3316.                     <property name="PriceChangeDate" alias="PriceChangeDate" datatype="date"/>
  3317.                 </properties>
  3318.                 <relationships>
  3319.                     <relationship name="PriceChangeDates" query="PriceChangeDates" object="PriceChange" collection="true" keyprop="none"/>
  3320.                 </relationships>
  3321.             </object>
  3322.             <object name="Product">
  3323.                 <datasource>
  3324.                     <query id="StoreCategoryProducts" default="false">
  3325.                         <select name="SELECT DISTINCT
  3326.     Product.ProductID,
  3327.     NULL AS ProductGroupID,       
  3328.     NULL AS GroupName,  
  3329.     Product.Name,
  3330.     Product.Description,
  3331.     Product.PackSize,
  3332.     Product.UnitSize,
  3333.     Product.UnitID,
  3334.     Product.HasLabelData,
  3335.     ProductInStore.IsCaseDealParent,
  3336.     ProductInStore.CaseDealImageID,
  3337.     ProductInStore.ComparativeSizeInfo,
  3338.     ProductInStore.AddedVal,
  3339.     ProductInStore.Saving,
  3340.     ProductInStore.IsNew,
  3341.     ProductInStore.Price,
  3342.     ProductInStore.StoreID,
  3343.     ProductInStore.IntroductionDate,
  3344.     ProductOptionValue.ProductID AS HasOptions
  3345.     
  3346. FROM   
  3347. ProductInCategory
  3348. INNER JOIN ProductInStore
  3349. ON ProductInCategory.ProductID = ProductInStore.ProductID 
  3350. INNER JOIN Product
  3351. ON ProductInCategory.ProductID = Product.ProductID 
  3352. LEFT JOIN ProductOptionValue
  3353. ON ProductOptionValue.ProductID = Product.ProductID
  3354. WHERE
  3355. ProductInStore.StoreID = @StoreID AND ProductInCategory.CategoryID = @CategoryID
  3356. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3357. AND Product.CaseDealParentID = NULL
  3358. ORDER BY Product.ProductID ASC,
  3359. ProductInStore.IntroductionDate DESC
  3360. " connection="Grocery" type="replace" use="raw">
  3361.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3362.                             <parameter name="CategoryID" datatype="integer" direction="in"/>
  3363.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3364.                         </select>
  3365.                     </query>
  3366.                     <query id="StoreCategoryProductsWithAV" default="false">
  3367.                         <select name="SELECT DISTINCT
  3368.     Product.ProductID,
  3369.     NULL AS ProductGroupID, 
  3370.        NULL AS GroupName, 
  3371.     Product.Name,
  3372.     Product.Description,
  3373.     Product.PackSize,
  3374.     Product.UnitSize,
  3375.     Product.UnitID,
  3376.     Product.HasLabelData,
  3377.     ProductInStore.IsCaseDealParent,
  3378.     ProductInStore.CaseDealImageID,
  3379.     ProductInStore.ComparativeSizeInfo,
  3380.     ProductInStore.AddedVal,
  3381.     ProductInStore.Saving,
  3382.     ProductInStore.IsNew,
  3383.     ProductInStore.Price,
  3384.     ProductInStore.StoreID,
  3385.     ProductInStore.IntroductionDate,
  3386.     ProductOptionValue.ProductID AS HasOptions,
  3387.     ProductAttributeValue.AttributeValue,
  3388.     ProductAttributeValue.UnitID AS AttributeUnitID
  3389.  
  3390. FROM   
  3391. ProductInCategory
  3392. INNER JOIN ProductInStore
  3393. ON ProductInCategory.ProductID = ProductInStore.ProductID 
  3394. INNER JOIN Product
  3395. ON ProductInCategory.ProductID = Product.ProductID 
  3396. LEFT JOIN ProductOptionValue
  3397. ON ProductOptionValue.ProductID = Product.ProductID
  3398. LEFT JOIN ProductAttributeValue
  3399. ON ProductAttributeValue.ProductID = Product.ProductID
  3400. WHERE
  3401. ProductInStore.StoreID = @StoreID 
  3402. AND ProductInCategory.CategoryID = @CategoryID
  3403. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3404. AND Product.CaseDealParentID = NULL
  3405. AND ProductAttributeValue.AttributeID = @AttributeID
  3406. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC
  3407. " connection="Grocery" type="replace" use="raw">
  3408.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3409.                             <parameter name="CategoryID" datatype="integer" direction="in"/>
  3410.                             <parameter name="AttributeID" datatype="integer" direction="in"/>
  3411.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3412.                         </select>
  3413.                     </query>
  3414.                     <query id="StoreProduct" default="true">
  3415.                         <select name="SELECT DISTINCT
  3416.     Product.ProductID,
  3417.     NULL AS ProductGroupID, 
  3418.     Product.Name,
  3419.     Product.Description,
  3420.     Product.PackSize,
  3421.     Product.UnitSize,
  3422.     Product.UnitID,
  3423.     Product.HasLabelData,
  3424.     ProductInStore.IsCaseDealParent,
  3425.     ProductInStore.CaseDealImageID,
  3426.     Product.CaseDealParentID,
  3427.     ProductInStore.ComparativeSizeInfo,
  3428.     ProductInStore.AddedVal,
  3429.     ProductInStore.Saving,
  3430.     ProductInStore.IsNew,
  3431.     ProductInStore.Price,
  3432.     ProductInStore.StoreID,
  3433.     ProductInStore.IntroductionDate,
  3434.     ProductOptionValue.ProductID AS HasOptions
  3435.  
  3436. FROM   
  3437. Product
  3438. INNER JOIN ProductInStore
  3439. ON Product.ProductID = ProductInStore.ProductID 
  3440. LEFT JOIN ProductOptionValue
  3441. ON ProductOptionValue.ProductID = Product.ProductID
  3442. WHERE ProductInStore.StoreID = @StoreID 
  3443. AND Product.ProductID = @ProductID
  3444. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3445. ORDER BY ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  3446.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3447.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  3448.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3449.                         </select>
  3450.                     </query>
  3451.                     <query id="StoreProductCaseDealProducts" default="false">
  3452.                         <select name="SELECT DISTINCT
  3453.     Product.ProductID,
  3454.     Product.Name,
  3455.     Product.Description,
  3456.     Product.PackSize,
  3457.     Product.UnitSize,
  3458.     Product.UnitID,
  3459.     Product.HasLabelData,
  3460.     ProductInStore.IsCaseDealParent,
  3461.     Product.CaseDealParentID,
  3462.     ProductInStore.ComparativeSizeInfo,
  3463.     ProductInStore.AddedVal,
  3464.     ProductInStore.Saving,
  3465.     ProductInStore.IsNew,
  3466.     ProductInStore.Price,
  3467.     ProductInStore.StoreID,
  3468.     ProductInStore.IntroductionDate,
  3469.     ProductOptionValue.ProductID AS HasOptions
  3470. FROM         
  3471. Product
  3472. INNER JOIN ProductInStore
  3473. ON Product.ProductID = ProductInStore.ProductID 
  3474. LEFT JOIN ProductOptionValue
  3475. ON ProductOptionValue.ProductID = Product.ProductID
  3476. WHERE
  3477. ProductInStore.StoreID = @StoreID
  3478. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3479. AND Product.CaseDealParentID = @CaseDealParentID
  3480. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  3481.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3482.                             <parameter name="CaseDealParentID" datatype="integer" direction="in"/>
  3483.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3484.                         </select>
  3485.                     </query>
  3486.                     <query id="StoreProductRelatedProducts" default="false">
  3487.                         <select name="
  3488. SELECT DISTINCT
  3489.     Product.ProductID,
  3490.     Product.Name,
  3491.     Product.Description,
  3492.     Product.PackSize,
  3493.     Product.UnitSize,
  3494.     Product.UnitID,
  3495.     Product.HasLabelData,
  3496.     ProductInStore.IsCaseDealParent,
  3497.     ProductInStore.CaseDealImageID,
  3498.     Product.CaseDealParentID,
  3499.     ProductInStore.ComparativeSizeInfo,
  3500.     ProductInStore.AddedVal,
  3501.     ProductInStore.Saving,
  3502.     ProductInStore.IsNew,
  3503.     ProductInStore.Price,
  3504.     ProductInStore.StoreID,
  3505.     ProductInStore.IntroductionDate,
  3506.     ProductOptionValue.ProductID AS HasOptions
  3507. FROM         
  3508. RelatedProductInProduct
  3509. INNER JOIN Product
  3510. ON Product.ProductID = RelatedProductInProduct.RelatedProductID
  3511. INNER JOIN ProductInStore
  3512. ON Product.ProductID = ProductInStore.ProductID 
  3513. LEFT JOIN ProductOptionValue
  3514. ON ProductOptionValue.ProductID = Product.ProductID
  3515. WHERE
  3516. ProductInStore.StoreID = @StoreID
  3517. AND RelatedProductInProduct.ProductID = @ProductID
  3518. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3519. AND Product.CaseDealParentID = NULL
  3520.  
  3521. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC
  3522. " connection="Grocery" type="replace" use="raw">
  3523.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3524.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  3525.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3526.                         </select>
  3527.                     </query>
  3528.                     <query id="StoreProductSubstituteProducts" default="false">
  3529.                         <select name="SELECT DISTINCT
  3530.     Product.ProductID,
  3531.     Product.Name,
  3532.     Product.Description,
  3533.     Product.PackSize,
  3534.     Product.UnitSize,
  3535.     Product.UnitID,
  3536.     Product.HasLabelData,
  3537.     ProductInStore.IsCaseDealParent,
  3538.     ProductInStore.CaseDealImageID,
  3539.     Product.CaseDealParentID,
  3540.     ProductInStore.ComparativeSizeInfo,
  3541.     ProductInStore.AddedVal,
  3542.     ProductInStore.Saving,
  3543.     ProductInStore.IsNew,
  3544.     ProductInStore.Price,
  3545.     ProductInStore.StoreID,
  3546.     ProductInStore.IntroductionDate,
  3547.     ProductOptionValue.ProductID AS HasOptions
  3548.  
  3549. FROM         
  3550. SubstituteProductInProduct
  3551. INNER JOIN Product
  3552. ON Product.ProductID = SubstituteProductInProduct.SubstituteProductID
  3553. INNER JOIN ProductInStore
  3554. ON Product.ProductID = ProductInStore.ProductID 
  3555. LEFT JOIN ProductOptionValue
  3556. ON ProductOptionValue.ProductID = Product.ProductID
  3557. WHERE
  3558. ProductInStore.StoreID = @StoreID
  3559. AND SubstituteProductInProduct.ProductID = @ProductID
  3560. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3561. AND Product.CaseDealParentID = NULL
  3562.  
  3563. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC
  3564. " connection="Grocery" type="replace" use="raw">
  3565.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3566.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  3567.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3568.                         </select>
  3569.                     </query>
  3570.                     <query id="AdvancedSearchStoreProductsWithAV" default="false">
  3571.                         <select name="SELECT DISTINCT
  3572.     Product.ProductID,
  3573.     NULL AS ProductGroupID, 
  3574.        NULL AS GroupName, 
  3575.     Product.Name,
  3576.     Product.Description,
  3577.     Product.PackSize,
  3578.     Product.UnitSize,
  3579.     Product.UnitID,
  3580.     Product.HasLabelData,
  3581.     ProductInStore.IsCaseDealParent,
  3582.     ProductInStore.CaseDealImageID,
  3583.     ProductInStore.ComparativeSizeInfo,
  3584.     ProductInStore.AddedVal,
  3585.     ProductInStore.Saving,
  3586.     ProductInStore.IsNew,
  3587.     ProductInStore.Price,
  3588.     ProductInStore.StoreID,
  3589.     ProductInStore.IntroductionDate,
  3590.     CategoryRank.RANK As CategoryRank,
  3591.     Category.CategoryID,
  3592.     Category.ParentID,
  3593.     Category.LevelNo,
  3594.     ProductOptionValue.ProductID AS HasOptions,
  3595.     ProductAttributeValue.AttributeValue,
  3596.     ProductAttributeValue.UnitID AS AttributeUnitID
  3597.  
  3598. FROM         
  3599.     Product
  3600.     INNER JOIN ProductInCategory
  3601.         ON ProductInCategory.ProductID = Product.ProductID
  3602.     INNER JOIN Category
  3603.         ON Category.CategoryID = ProductInCategory.CategoryID
  3604.     INNER JOIN ProductInStore
  3605.         ON Product.ProductID = ProductInStore.ProductID 
  3606.     LEFT JOIN ProductOptionValue
  3607.         ON ProductOptionValue.ProductID = Product.ProductID
  3608.     LEFT JOIN  ProductAttributeValue
  3609.         ON ProductAttributeValue.ProductID = Product.ProductID
  3610.         
  3611.  
  3612. WHERE
  3613.     ProductInStore.StoreID = @StoreID
  3614.     AND   CONTAINS(Product.Name, @SearchString) 
  3615.         OR CONTAINS(Product.ProductCode, @SearchString) 
  3616.     AND Category.TopLevelID = @TopLevelID
  3617.     AND ProductInStore.IntroductionDate <= @IntroductionDate
  3618.     AND Product.CaseDealParentID = NULL
  3619.     AND ProductAttributeValue.AttributeID = @AttributeID
  3620.  
  3621. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  3622.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3623.                             <parameter name="TopLevelID" datatype="integer" direction="in"/>
  3624.                             <parameter name="AttributeID" datatype="integer" direction="in"/>
  3625.                             <parameter name="SearchString" datatype="string" direction="in"/>
  3626.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3627.                         </select>
  3628.                     </query>
  3629.                     <query id="AdvancedSearchStoreProducts" default="false">
  3630.                         <select name="SELECT DISTINCT
  3631.     Product.ProductID,
  3632.     NULL AS ProductGroupID, 
  3633.        NULL AS GroupName, 
  3634.     Product.Name,
  3635.     Product.Description,
  3636.     Product.PackSize,
  3637.     Product.UnitSize,
  3638.     Product.UnitID,
  3639.     Product.HasLabelData,
  3640.     ProductInStore.IsCaseDealParent,
  3641.     ProductInStore.CaseDealImageID,
  3642.     ProductInStore.ComparativeSizeInfo,
  3643.     ProductInStore.AddedVal,
  3644.     ProductInStore.Saving,
  3645.     ProductInStore.IsNew,
  3646.     ProductInStore.Price,
  3647.     ProductInStore.StoreID,
  3648.     ProductInStore.IntroductionDate,
  3649.     Category.CategoryID,
  3650.     Category.ParentID,
  3651.     Category.LevelNo,
  3652.     ProductOptionValue.ProductID AS HasOptions
  3653.  
  3654. FROM         
  3655.     Product
  3656.     INNER JOIN ProductInCategory
  3657.         ON ProductInCategory.ProductID = Product.ProductID
  3658.     INNER JOIN Category
  3659.         ON Category.CategoryID = ProductInCategory.CategoryID
  3660.     INNER JOIN ProductInStore
  3661.         ON Product.ProductID = ProductInStore.ProductID 
  3662.     LEFT JOIN ProductOptionValue
  3663.         ON ProductOptionValue.ProductID = Product.ProductID
  3664.  
  3665. WHERE
  3666.     ProductInStore.StoreID = @StoreID
  3667.     AND CONTAINS(Product.Name, @SearchString) 
  3668.         OR CONTAINS(Product.ProductCode, @SearchString) 
  3669.     AND Category.TopLevelID = @TopLevelID
  3670.     AND ProductInStore.IntroductionDate <= @IntroductionDate
  3671.     AND Product.CaseDealParentID = NULL
  3672.  
  3673. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  3674.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3675.                             <parameter name="TopLevelID" datatype="integer" direction="in"/>
  3676.                             <parameter name="SearchString" datatype="string" direction="in"/>
  3677.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3678.                         </select>
  3679.                     </query>
  3680.                     <query id="SearchStoreProductsWithAV" default="false">
  3681.                         <select name="SELECT DISTINCT
  3682.     Product.ProductID,
  3683.     NULL AS ProductGroupID, 
  3684.        NULL AS GroupName,     
  3685.     Product.Name,
  3686.     Product.Description,
  3687.     Product.PackSize,
  3688.     Product.UnitSize,
  3689.     Product.UnitID,
  3690.     Product.HasLabelData,
  3691.     ProductInStore.IsCaseDealParent,
  3692.     ProductInStore.CaseDealImageID,
  3693.     ProductInStore.ComparativeSizeInfo,
  3694.     ProductInStore.AddedVal,
  3695.     ProductInStore.Saving,
  3696.     ProductInStore.IsNew,
  3697.     ProductInStore.Price,
  3698.     ProductInStore.StoreID,
  3699.     ProductInStore.IntroductionDate,
  3700.     ProductOptionValue.ProductID AS HasOptions,
  3701.     Category.TopLevelID,
  3702.     Category.CategoryID,
  3703.     Category.ParentID,
  3704.     Category.LevelNo,
  3705.     CategoryTop.Name AS TopLevelName,
  3706.     ProductAttributeValue.AttributeValue,
  3707.     ProductAttributeValue.UnitID AS AttributeUnitID
  3708.  
  3709. FROM         
  3710.     Product
  3711.     INNER JOIN ProductInCategory
  3712.         ON ProductInCategory.ProductID = Product.ProductID
  3713.     INNER JOIN Category
  3714.         ON Category.CategoryID = ProductInCategory.CategoryID
  3715.     INNER JOIN Category CategoryTop
  3716.         ON Category.TopLevelID = CategoryTop.CategoryID
  3717.     INNER JOIN ProductInStore
  3718.         ON Product.ProductID = ProductInStore.ProductID 
  3719.     LEFT JOIN ProductOptionValue
  3720.         ON ProductOptionValue.ProductID = Product.ProductID
  3721.     LEFT JOIN  ProductAttributeValue
  3722.         ON ProductAttributeValue.ProductID = Product.ProductID
  3723.         
  3724.  
  3725. WHERE
  3726.     ProductInStore.StoreID = @StoreID
  3727.     AND   CONTAINS(Product.Name, @SearchString) 
  3728.         OR CONTAINS(Product.ProductCode, @SearchString) 
  3729.     AND ProductInStore.IntroductionDate <= @IntroductionDate
  3730.     AND Product.CaseDealParentID = NULL
  3731.     AND ProductAttributeValue.AttributeID = @AttributeID
  3732.  
  3733. ORDER BY 
  3734.     TopLevelName LIKE @SearchString, Category.TopLevelID ASC,Product.ProductID ASC,ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  3735.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3736.                             <parameter name="AttributeID" datatype="integer" direction="in"/>
  3737.                             <parameter name="SearchString" datatype="string" direction="in"/>
  3738.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3739.                         </select>
  3740.                     </query>
  3741.                     <query id="SearchStoreProducts" default="false">
  3742.                         <select name="SELECT DISTINCT
  3743.     Product.ProductID,
  3744.     NULL AS ProductGroupID, 
  3745.        NULL AS GroupName,    
  3746.     Product.Name,
  3747.     Product.Description,
  3748.     Product.PackSize,
  3749.     Product.UnitSize,
  3750.     Product.UnitID,
  3751.     Product.HasLabelData,
  3752.     ProductInStore.IsCaseDealParent,
  3753.     ProductInStore.CaseDealImageID,
  3754.     ProductInStore.ComparativeSizeInfo,
  3755.     ProductInStore.AddedVal,
  3756.     ProductInStore.Saving,
  3757.     ProductInStore.IsNew,
  3758.     ProductInStore.Price,
  3759.     ProductInStore.StoreID,
  3760.     ProductInStore.IntroductionDate,
  3761.     ProductOptionValue.ProductID AS HasOptions,
  3762.     Category.TopLevelID,
  3763.     Category.CategoryID,
  3764.     Category.ParentID,
  3765.     Category.LevelNo,
  3766.     CategoryTop.Name AS TopLevelName
  3767.  
  3768. FROM         
  3769.     Product
  3770.     INNER JOIN ProductInCategory
  3771.         ON ProductInCategory.ProductID = Product.ProductID
  3772.     INNER JOIN Category
  3773.         ON Category.CategoryID = ProductInCategory.CategoryID
  3774.     INNER JOIN Category CategoryTop 
  3775.         ON Category.TopLevelID = CategoryTop.Categoryid
  3776.     INNER JOIN ProductInStore
  3777.         ON Product.ProductID = ProductInStore.ProductID 
  3778.     LEFT JOIN ProductOptionValue
  3779.         ON ProductOptionValue.ProductID = Product.ProductID
  3780.  
  3781. WHERE
  3782.     ProductInStore.StoreID = @StoreID
  3783.     AND   CONTAINS(Product.Name, @SearchString) 
  3784.         OR CONTAINS(Product.ProductCode, @SearchString) 
  3785.     AND ProductInStore.IntroductionDate <= @IntroductionDate
  3786.     AND Product.CaseDealParentID = NULL
  3787.  
  3788. ORDER BY TopLevelName LIKE @SearchString, Product.ProductID ASC,ProductInStore.IntroductionDate DESC
  3789. " connection="Grocery" type="replace" use="raw">
  3790.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3791.                             <parameter name="SearchString" datatype="string" direction="in"/>
  3792.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3793.                         </select>
  3794.                     </query>
  3795.                     <query id="StorePromoProducts" default="false">
  3796.                         <select name="SELECT
  3797.     DISTINCT Product.ProductID,
  3798.     ProductInStore.StoreID,
  3799.     NULL AS ProductGroupID, 
  3800.     Product.Name,
  3801.     Product.Description,
  3802.     Product.PackSize,
  3803.     Product.UnitSize,
  3804.        NULL AS GroupName, 
  3805.     ProductInStore.Price,
  3806.     ProductInStore.IntroductionDate,
  3807.     Product.UnitID,
  3808.     Product.HasLabelData,
  3809.     ProductInStore.IsCaseDealParent,
  3810.     Unit.Name AS UnitName,
  3811.     Unit.ConvertRate,
  3812.     Unit.IsInteger,
  3813.     Product.IsUnitSelectable,
  3814.     Product.CaseDealParentID,
  3815.     ProductInStore.CaseDealImageID,
  3816.     ProductInStore.ComparativeSizeInfo,
  3817.     ProductInStore.AddedVal,
  3818.     ProductInStore.Saving,
  3819.     ProductInStore.IsNew,
  3820.     1 AS HasPromos,
  3821.     ProductOptionValue.ProductID AS HasOptions
  3822.  
  3823. FROM         
  3824. Promo
  3825. INNER JOIN PromoSet
  3826. ON PromoSet.PromoID = Promo.PromoID
  3827. INNER JOIN ProductInPromoSet
  3828. ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  3829. INNER JOIN Product
  3830. ON Product.ProductID = ProductInPromoSet.ProductID
  3831. INNER JOIN ProductInStore
  3832. ON Product.ProductID = ProductInStore.ProductID 
  3833. LEFT JOIN Unit
  3834. ON Unit.UnitID = Product.UnitID
  3835. LEFT JOIN ProductOptionValue
  3836. ON ProductOptionValue.ProductID = Product.ProductID
  3837. WHERE
  3838. ProductInStore.StoreID = @StoreID
  3839. AND Promo.PromoID = @PromoID
  3840. AND ProductInStore.IntroductionDate <= @IntroductionDate
  3841. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC
  3842. " connection="Grocery" type="replace" use="raw">
  3843.                             <parameter name="PromoID" datatype="integer" direction="in"/>
  3844.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3845.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3846.                         </select>
  3847.                     </query>
  3848.                     <query id="StoreDynamicProducts" default="false">
  3849.                         <select name="SELECT DISTINCT
  3850.     Product.ProductID,
  3851.     NULL AS ProductGroupID, 
  3852.        NULL AS GroupName,    
  3853.     Product.Name,
  3854.     Product.Description,
  3855.     Product.PackSize,
  3856.     Product.UnitSize,
  3857.     Product.UnitID,
  3858.     Product.HasLabelData,
  3859.     ProductInStore.IsCaseDealParent,
  3860.     ProductInStore.CaseDealImageID,
  3861.     ProductInStore.ComparativeSizeInfo,
  3862.     ProductInStore.AddedVal,
  3863.     ProductInStore.Saving,
  3864.     ProductInStore.IsNew,
  3865.     ProductInStore.Price,
  3866.     ProductInStore.StoreID,
  3867.     ProductInStore.IntroductionDate,
  3868.     ProductOptionValue.ProductID AS HasOptions
  3869.  
  3870. FROM         
  3871.     Product
  3872.     INNER JOIN ProductInCategory
  3873.         ON ProductInCategory.ProductID = Product.ProductID
  3874.     INNER JOIN ProductInStore
  3875.         ON Product.ProductID = ProductInStore.ProductID 
  3876.     LEFT JOIN ProductOptionValue
  3877.         ON ProductOptionValue.ProductID = Product.ProductID
  3878.  
  3879. WHERE
  3880.     ProductInStore.StoreID = @StoreID
  3881.     AND CONTAINS(Product.ProductCode, @SearchString) 
  3882.     AND ProductInStore.IntroductionDate <= @IntroductionDate
  3883.     AND Product.CaseDealParentID = NULL
  3884.  
  3885. ORDER BY Product.ProductID ASC,ProductInStore.IntroductionDate DESC" connection="Grocery" type="replace" use="raw">
  3886.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  3887.                             <parameter name="SearchString" datatype="string" direction="in"/>
  3888.                             <parameter name="IntroductionDate" datatype="Date" direction="in"/>
  3889.                         </select>
  3890.                     </query>
  3891.                 </datasource>
  3892.                 <properties>
  3893.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false" pkey="true"/>
  3894.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="true"/>
  3895.                     <property name="AttributeValue" alias="AttributeValue" datatype="string" nullable="true"/>
  3896.                     <property name="AttributeUnitID" alias="AttributeUnitID" datatype="integer" nullable="true"/>
  3897.                     <property name="ProductGroupID" alias="ProductGroupID" datatype="integer" nullable="true"/>
  3898.                     <property name="GroupName" alias="GroupName" datatype="string" nullable="false"/>
  3899.                     <property name="Name" alias="Name" datatype="string" nullable="false"/>
  3900.                     <property name="Description" alias="Description" datatype="string" nullable="true"/>
  3901.                     <property name="PackSize" alias="PackSize" datatype="short" nullable="true"/>
  3902.                     <property name="UnitSize" alias="UnitSize" datatype="float" nullable="true"/>
  3903.                     <property name="Price" alias="Price" datatype="money" nullable="false"/>
  3904.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="Date" nullable="false"/>
  3905.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="true"/>
  3906.                     <property name="ComparativeSizeInfo" alias="ComparativeSizeInfo" datatype="String" nullable="true"/>
  3907.                     <property name="AddedVal" alias="AddedVal" datatype="string" nullable="true"/>
  3908.                     <property name="Saving" alias="Saving" datatype="money" nullable="true"/>
  3909.                     <property name="IsNew" alias="IsNew" datatype="boolean" nullable="true"/>
  3910.                     <property name="HasLabelData" alias="HasLabelData" datatype="boolean" nullable="false"/>
  3911.                     <property name="CategoryID" alias="CategoryID" datatype="integer" nullable="true"/>
  3912.                     <property name="ParentID" alias="ParentID" datatype="integer" nullable="true"/>
  3913.                     <property name="LevelNo" alias="LevelNo" datatype="integer" nullable="true"/>
  3914.                     <property name="TopLevelID" alias="TopLevelID" datatype="Integer" nullable="false"/>
  3915.                     <property name="TopLevelName" alias="TopLevelName" datatype="String" nullable="false"/>
  3916.                     <property name="HasOptions" alias="HasOptions" datatype="boolean" nullable="false"/>
  3917.                     <property name="HasPromos" alias="HasPromos" datatype="boolean" nullable="false"/>
  3918.                     <property name="IsCaseDealParent" alias="IsCaseDealParent" datatype="boolean" nullable="false"/>
  3919.                     <property name="CaseDealParentID" alias="CaseDealParentID" datatype="integer" nullable="true"/>
  3920.                     <property name="CaseDealImageID" alias="CaseDealImageID" datatype="string" nullable="true"/>
  3921.                     <property name="CategoryRank" alias="CategoryRank" datatype="integer" nullable="true"/>
  3922.                 </properties>
  3923.                 <relationships>
  3924.                     <relationship name="Options" object="ProductOption" keyprop="none" collection="true" query="ProductOptions">
  3925.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  3926.                     </relationship>
  3927.                     <relationship name="SelectableAttributeValues" object="ProductAttributeValue" keyprop="none" collection="true" query="SelectableAttributeValues">
  3928.                         <key pkey="GroupID" fkey="GroupID" from="parent" to="child"/>
  3929.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  3930.                     </relationship>
  3931.                     <relationship name="CaseDealProducts" object="Product" keyprop="none" collection="true" query="StoreProductCaseDealProducts">
  3932.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  3933.                         <key pkey="ProductID" fkey="CaseDealParentID" from="parent" to="child"/>
  3934.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  3935.                     </relationship>
  3936.                     <relationship name="RelatedProducts" object="Product" keyprop="none" collection="true" query="StoreProductRelatedProducts">
  3937.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  3938.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  3939.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  3940.                     </relationship>
  3941.                     <relationship name="SubstituteProducts" object="Product" keyprop="none" collection="true" query="StoreProductSubstituteProducts">
  3942.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  3943.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  3944.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  3945.                     </relationship>
  3946.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="ProductCategories">
  3947.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  3948.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  3949.                     </relationship>
  3950.                     <relationship name="AttributeGroupMaps" object="ProductAttributeGroupMap" keyprop="none" collection="true" query="ProductAttributeGroupMaps">
  3951.                         <key fkey="ProductID" pkey="ProductID" to="child" from="parent"/>
  3952.                     </relationship>
  3953.                     <relationship name="LabelData" object="LabelData" keyprop="none" collection="true" query="ProductLabelData">
  3954.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  3955.                     </relationship>
  3956.                 </relationships>
  3957.             </object>
  3958.             <object name="ProductAttribute">
  3959.                 <datasource>
  3960.                     <query id="AttributeGroupAttributes" default="false">
  3961.                         <select name="SELECT
  3962.     Attribute.AttributeID,
  3963.     Attribute.AttributeGroupID,
  3964.     Attribute.SortValue,
  3965.     Attribute.Name
  3966. FROM
  3967. Attribute
  3968. INNER JOIN AttributeGroup
  3969. ON Attribute.AttributeGroupID = AttributeGroup.AttributeGroupID
  3970. INNER JOIN ProductAttributeValue
  3971. ON Attribute.AttributeID = ProductAttributeValue.AttributeID
  3972. WHERE
  3973. AttributeGroup.AttributeGroupID = @AttributeGroupID
  3974. AND ProductAttributeValue.productID = @ProductID
  3975. " type="replace" use="raw" connection="Grocery">
  3976.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  3977.                             <parameter name="AttributeGroupID" datatype="integer" direction="in"/>
  3978.                         </select>
  3979.                     </query>
  3980.                     <query id="ProductGroupAttributes" default="false">
  3981.                         <select name="SELECT SelectableAttributeInProdGroup.ProductGroupID AS ProductGroupID, Attribute.Name , Attribute.AttributeID, Attribute.AttributeGroupID, Attribute.SortValue, Attribute.IsAllowedInList
  3982. FROM Attribute 
  3983. INNER JOIN SelectableAttributeInProdGroup 
  3984. ON SelectableAttributeInProdGroup.AttributeID = Attribute.AttributeID
  3985. WHERE SelectableAttributeInProdGroup.ProductGroupID = @ProductGroupID
  3986. ORDER BY Attribute.SortValue
  3987. " connection="Grocery" type="replace" use="raw">
  3988.                             <parameter name="ProductGroupID" datatype="integer" direction="in"/>
  3989.                         </select>
  3990.                     </query>
  3991.                     <query id="StoreCategoryAttributes" default="false">
  3992.                         <select name="SELECT 
  3993.     DISTINCT Attribute.AttributeID,
  3994.     Attribute.Name
  3995. FROM     
  3996. ProductInCategory
  3997. INNER JOIN ProductInStore
  3998. ON ProductInStore.ProductID = ProductInCategory.ProductID
  3999. INNER JOIN ProductAttributeValue
  4000. ON ProductAttributeValue.ProductID = ProductInCategory.ProductID 
  4001. INNER JOIN Attribute
  4002. ON ProductAttributeValue.AttributeID = Attribute.AttributeID
  4003. WHERE
  4004. ProductInCategory.CategoryID = @CategoryID AND ProductInStore.StoreID = @StoreID AND Attribute.IsAllowedInList <> 0" connection="Grocery" type="replace" use="raw">
  4005.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4006.                             <parameter name="CategoryID" datatype="integer" direction="in"/>
  4007.                         </select>
  4008.                     </query>
  4009.                     <query id="AdvancedSearchStoreAttributes" default="false">
  4010.                         <select name="SELECT
  4011.     DISTINCT Attribute.AttributeID,
  4012.     Attribute.Name
  4013.  
  4014. FROM
  4015.     Attribute
  4016.     INNER JOIN ProductAttributeValue
  4017.         ON ProductAttributeValue.AttributeID = Attribute.AttributeID    
  4018.     INNER JOIN Product
  4019.         ON Product.ProductID = ProductAttributeValue.ProductID
  4020.     INNER JOIN ProductInStore
  4021.         ON Product.ProductID = ProductInStore.ProductID 
  4022.     INNER JOIN ProductInCategory
  4023.         ON ProductInCategory.ProductID = Product.ProductID
  4024.     INNER JOIN Category
  4025.         ON Category.CategoryID = ProductInCategory.CategoryID
  4026.  
  4027. WHERE
  4028.     ProductInStore.StoreID = @StoreID
  4029.     AND CONTAINS(Product.Name, @SearchString)
  4030.     AND Category.TopLevelID = @TopLevelID
  4031.     AND Attribute.IsAllowedInList != 0" connection="Grocery" type="replace" use="raw">
  4032.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4033.                             <parameter name="TopLevelID" datatype="integer" direction="in"/>
  4034.                             <parameter name="SearchString" datatype="string" direction="in"/>
  4035.                         </select>
  4036.                     </query>
  4037.                     <query id="SearchStoreAttributes" default="false">
  4038.                         <select name="SELECT
  4039.     DISTINCT Attribute.AttributeID,
  4040.     Attribute.Name
  4041.  
  4042. FROM
  4043.     Product
  4044.     INNER JOIN ProductInStore
  4045.         ON Product.ProductID = ProductInStore.ProductID
  4046.     INNER JOIN ProductAttributeValue
  4047.         ON Product.ProductID = ProductAttributeValue.ProductID
  4048.     INNER JOIN Attribute
  4049.         ON ProductAttributeValue.AttributeID = Attribute.AttributeID
  4050. WHERE
  4051.     ProductInStore.StoreID = @StoreID
  4052.     AND CONTAINS(Product.Name, @SearchString)
  4053.     AND Attribute.IsAllowedInList != 0" connection="Grocery" type="replace" use="raw">
  4054.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4055.                             <parameter name="SearchString" datatype="string" direction="in"/>
  4056.                         </select>
  4057.                     </query>
  4058.                 </datasource>
  4059.                 <properties>
  4060.                     <property name="AttributeID" alias="AttributeID" datatype="integer" nullable="false" pkey="true"/>
  4061.                     <property name="AttributeGroupID" alias="AttributeGroupID" datatype="integer" nullable="true" pkey="false"/>
  4062.                     <property name="SortValue" alias="SortValue" datatype="short" nullable="true" pkey="false"/>
  4063.                     <property name="Name" alias="Name" datatype="string" nullable="false" pkey="false"/>
  4064.                     <property name="IsAllowedInList" alias="IsAllowedInList" datatype="boolean" nullable="true" pkey="false"/>
  4065.                     <property name="ProductGroupID" alias="ProductGroupID" datatype="integer" nullable="true" pkey="false"/>
  4066.                     <property name="PartName" alias="PartName" datatype="string" nullable="true" pkey="false"/>
  4067.                 </properties>
  4068.                 <relationships>
  4069.                     <relationship name="Values" object="ProductAttributeValue" keyprop="none" collection="true" query="ProductGroupAttributeValues">
  4070.                         <key pkey="ProductGroupID" fkey="ProductGroupID" from="parent" to="child"/>
  4071.                         <key pkey="AttributeID" fkey="AttributeID" from="parent" to="child"/>
  4072.                     </relationship>
  4073.                 </relationships>
  4074.             </object>
  4075.             <object name="ProductAttributeGroup">
  4076.                 <datasource>
  4077.                     <query id="ProductAttributeGroups" default="true">
  4078.                         <select name="NOT_USED_AT_ALL
  4079. " connection="Grocery" type="replace" use="raw">
  4080.                             <parameter name="MapID" datatype="integer" direction="in"/>
  4081.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  4082.                         </select>
  4083.                     </query>
  4084.                 </datasource>
  4085.                 <properties>
  4086.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="true" pkey="false"/>
  4087.                     <property name="AttributeGroupID" alias="AttributeGroupID" datatype="integer" nullable="false" pkey="true"/>
  4088.                     <property name="Name" alias="Name" datatype="string" nullable="false" pkey="false"/>
  4089.                 </properties>
  4090.                 <relationships>
  4091.                     <relationship name="Attributes" object="ProductAttribute" keyprop="none" collection="true" query="AttributeGroupAttributes">
  4092.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  4093.                         <key pkey="AttributeGroupID" fkey="AttributeGroupID" from="parent" to="child"/>
  4094.                     </relationship>
  4095.                     <relationship name="AttributeValues" object="ProductAttributeValue" keyprop="none" collection="true" query="ProductAttributeGroupValues">
  4096.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  4097.                         <key pkey="AttributeGroupID" fkey="AttributeGroupID" from="parent" to="child"/>
  4098.                     </relationship>
  4099.                 </relationships>
  4100.             </object>
  4101.             <object name="ProductAttributeGroupMap">
  4102.                 <datasource>
  4103.                     <query id="ProductAttributeGroupMaps" default="true">
  4104.                         <select name="SELECT
  4105.     AttributeMap.AttributeMapID AS MapID, 
  4106.     AttributeMap.AttributeMapName AS MapName,
  4107.     @ProductID AS ProductID
  4108. FROM AttributeMap 
  4109. " connection="Grocery" type="replace" use="raw">
  4110.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  4111.                         </select>
  4112.                     </query>
  4113.                 </datasource>
  4114.                 <properties>
  4115.                     <property name="MapID" alias="MapID" datatype="integer" nullable="true" pkey="true"/>
  4116.                     <property name="MapName" alias="MapName" datatype="string" nullable="false" pkey="false"/>
  4117.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false" pkey="false"/>
  4118.                 </properties>
  4119.                 <relationships>
  4120.                     <relationship name="AttributeGroups" object="ProductAttributeGroup" keyprop="none" collection="true" query="ProductAttributeGroups">
  4121.                         <key fkey="MapID" pkey="MapID" to="child" from="parent"/>
  4122.                         <key fkey="ProductID" pkey="ProductID" to="child" from="parent"/>
  4123.                     </relationship>
  4124.                 </relationships>
  4125.             </object>
  4126.             <object name="ProductAttributeValue">
  4127.                 <datasource>
  4128.                     <query id="ProductGroupAttributeValues" default="false">
  4129.                         <select name="NOT_USED_AT_ALL" connection="Grocery" type="replace" use="raw">
  4130.                             <parameter name="ProductGroupID" datatype="integer" direction="in"/>
  4131.                             <parameter name="AttributeID" datatype="integer" direction="in"/>
  4132.                         </select>
  4133.                     </query>
  4134.                     <query id="ProductAttributeGroupValues" default="false">
  4135.                         <select name="SELECT
  4136.     Attribute.Name AS AttributeName,
  4137.     Attribute.AttributeID,
  4138.     Attribute.SortValue,
  4139.     PAV.ProductID,
  4140.     PAV.AttributeValue,
  4141.     PAV.UnitID,
  4142.     Unit.Name AS UnitName,
  4143.     Unit.ConvertRate,
  4144.     PAV.PartName
  4145. FROM Attribute
  4146. INNER JOIN ProductAttributeValue PAV
  4147. ON Attribute.AttributeID = PAV.AttributeID
  4148. LEFT JOIN Unit
  4149. ON PAV.UnitID = Unit.UnitID
  4150. WHERE    Attribute.AttributeGroupID = @AttributeGroupID 
  4151. AND ProductAttributeValue.ProductID = @ProductID
  4152. ORDER BY Attribute.SortValue
  4153. " connection="Grocery" type="replace" use="raw">
  4154.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  4155.                             <parameter name="AttributeGroupID" datatype="integer" direction="in"/>
  4156.                         </select>
  4157.                     </query>
  4158.                     <query id="SelectableAttributeValues" default="false">
  4159.                         <select name="SELECT    ProductAttributeValue.ProductID,
  4160.     Attribute.AttributeID,
  4161.     Attribute.SortValue,
  4162.     Attribute.Name As AttributeName ,
  4163.     ProductAttributeValue.AttributeValue,
  4164.     ProductAttributeValue.UnitID,
  4165.     Unit.Name As UnitName,
  4166.     Unit.ConvertRate
  4167.  
  4168. FROM  Attribute
  4169.  INNER JOIN SelectableAttributeInProdGroup
  4170. ON SelectableAttributeInProdGroup.AttributeID = Attribute.AttributeID
  4171. INNER JOIN ProductAttributeValue
  4172. ON ProductAttributeValue.AttributeID = SelectableAttributeInProdGroup.AttributeID
  4173. LEFT JOIN Unit
  4174. ON  Unit.UnitID = ProductAttributeValue.UnitID
  4175. WHERE    SelectableAttributeInProdGroup.ProductGroupID = @GroupID
  4176. AND ProductAttributeValue.ProductID = @ProductID
  4177. ORDER BY Attribute.SortValue
  4178. " connection="Grocery" type="replace" use="raw">
  4179.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  4180.                             <parameter name="GroupID" datatype="integer" direction="in"/>
  4181.                         </select>
  4182.                     </query>
  4183.                 </datasource>
  4184.                 <properties>
  4185.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false" pkey="true"/>
  4186.                     <property name="AttributeID" alias="AttributeID" datatype="integer" nullable="false" pkey="true"/>
  4187.                     <property name="SortValue" alias="SortValue" datatype="short" nullable="true" pkey="false"/>
  4188.                     <property name="AttributeName" alias="AttributeName" datatype="string" nullable="true" pkey="false"/>
  4189.                     <property name="AttributeValue" alias="AttributeValue" datatype="string" nullable="false" pkey="false"/>
  4190.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="true" pkey="false"/>
  4191.                     <property name="UnitName" alias="UnitName" datatype="string" nullable="true" pkey="false"/>
  4192.                     <property name="ConvertRate" alias="ConvertRate" datatype="float" nullable="true" pkey="false"/>
  4193.                     <property name="PartName" alias="PartName" datatype="string" nullable="true" pkey="false"/>
  4194.                 </properties>
  4195.             </object>
  4196.             <object name="ProductGroup">
  4197.                 <datasource>
  4198.                     <query id="ProductGroup" default="true">
  4199.                         <select name="SELECT ProductGroupID, Name FROM ProductGroup WHERE ProductGroupID = @ProductGroupID
  4200. " connection="Grocery" type="replace" use="raw">
  4201.                             <parameter name="ProductGroupID" datatype="integer" direction="in"/>
  4202.                         </select>
  4203.                     </query>
  4204.                 </datasource>
  4205.                 <properties>
  4206.                     <property name="ProductGroupID" alias="ProductGroupID" datatype="integer" nullable="false" pkey="true"/>
  4207.                     <property name="Name" alias="Name" datatype="string" nullable="true" pkey="false"/>
  4208.                 </properties>
  4209.                 <relationships>
  4210.                     <relationship name="SelectableAttributes" object="ProductAttribute" keyprop="none" collection="true" query="ProductGroupAttributes">
  4211.                         <key pkey="ProductGroupID" fkey="ProductGroupID" from="parent" to="child"/>
  4212.                     </relationship>
  4213.                 </relationships>
  4214.             </object>
  4215.             <object name="ProductOption">
  4216.                 <datasource>
  4217.                     <query id="ProductOptions" default="true">
  4218.                         <select name="SELECT DISTINCT ProductOption.ProductOptionID, ProductOption.Name, ProductOption.SortValue, @ProductID AS ProductID
  4219. FROM        
  4220. ProductOptionValue  
  4221. INNER JOIN ProductOption 
  4222. ON ProductOptionValue.ProductOptionID = ProductOption.ProductOptionID
  4223. WHERE     ProductID = @ProductID
  4224. ORDER BY ProductOption.SortValue
  4225. " connection="Grocery" type="replace" use="raw">
  4226.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  4227.                         </select>
  4228.                     </query>
  4229.                 </datasource>
  4230.                 <properties>
  4231.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="true" pkey="false"/>
  4232.                     <property name="ProductOptionID" alias="ProductOptionID" datatype="integer" nullable="false" pkey="true"/>
  4233.                     <property name="Name" alias="Name" datatype="string" nullable="false" pkey="false"/>
  4234.                     <property name="SortValue" alias="SortValue" datatype="short" nullable="false" pkey="false"/>
  4235.                 </properties>
  4236.                 <relationships>
  4237.                     <relationship name="Values" object="ProductOptionValue" keyprop="none" collection="true" query="ProductOptionValues">
  4238.                         <key pkey="ProductID" fkey="ProductID" from="parent" to="child"/>
  4239.                         <key pkey="ProductOptionID" fkey="ProductOptionID" from="parent" to="child"/>
  4240.                     </relationship>
  4241.                 </relationships>
  4242.             </object>
  4243.             <object name="ProductOptionValue">
  4244.                 <datasource>
  4245.                     <query id="ProductOptionValues" default="true">
  4246.                         <select name="SELECT ProductID, ProductOptionID, SortValue, OptionValue, IsDefault
  4247. FROM ProductOptionValue
  4248. WHERE ProductID = @ProductID AND ProductOptionID = @ProductOptionID
  4249. ORDER BY SortValue
  4250. " connection="Grocery" type="replace" use="raw">
  4251.                             <parameter name="ProductID" datatype="integer" direction="in"/>
  4252.                             <parameter name="ProductOptionID" datatype="integer" direction="in"/>
  4253.                         </select>
  4254.                     </query>
  4255.                 </datasource>
  4256.                 <properties>
  4257.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="false" pkey="true"/>
  4258.                     <property name="ProductOptionID" alias="ProductOptionID" datatype="integer" nullable="false" pkey="true"/>
  4259.                     <property name="SortValue" alias="SortValue" datatype="short" nullable="false" pkey="true"/>
  4260.                     <property name="OptionValue" alias="OptionValue" datatype="string" nullable="false" pkey="false"/>
  4261.                     <property name="IsDefault" alias="IsDefault" datatype="boolean" nullable="false" pkey="false"/>
  4262.                 </properties>
  4263.             </object>
  4264.             <object name="Promo">
  4265.                 <datasource>
  4266.                     <query id="Promo" default="true">
  4267.                         <select name="SELECT
  4268.     PromoID,    
  4269.     PromoType,
  4270.     ImageID,
  4271.     Description,
  4272.     StartDate,
  4273.     EndDate,
  4274.     LoyaltyClubOnly,
  4275.     IsOneTime
  4276. FROM Promo
  4277. WHERE PromoID=@PromoID
  4278. " connection="Grocery" type="replace" use="raw">
  4279.                             <parameter name="PromoID" datatype="integer" direction="in"/>
  4280.                         </select>
  4281.                     </query>
  4282.                     <query id="StoreBasketPromos" default="false">
  4283.                         <select name="SELECT DISTINCT
  4284.     BasketItem.ItemNo,
  4285.     Promo.PromoID,
  4286.     PromoType,
  4287.     Description,
  4288.     LoyaltyClubOnly,
  4289.     IsOneTime,
  4290.     ProductInPromoSet.ProductID,
  4291.     PromoSet.PromoSetID,
  4292.     PromoSet.Quantity,
  4293.     PromoSet.MaxQuantity,
  4294.     PromoSet.LoyaltyPointsReward,
  4295.     PromoSet.Reduction,
  4296.     PromoSet.DiscountQuantity,
  4297.     PromoSet.Discount,
  4298.     PromoSet.CostThreshold,
  4299.     PromoSet.CostMultiplier,
  4300.     PromoSet.CostFrom,
  4301.     PromoSet.CostTo,
  4302.     PromoSet.CouponPromoID,
  4303.     0 AS SetCount
  4304.  
  4305. FROM
  4306. Promo
  4307.  
  4308. INNER JOIN PromoInStore
  4309.     ON PromoInStore.PromoID = Promo.PromoID
  4310. INNER JOIN PromoSet
  4311.     ON PromoSet.PromoID = Promo.PromoID
  4312. LEFT JOIN ProductInPromoSet
  4313.     ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  4314. INNER  JOIN BasketItem
  4315.     ON BasketItem.ProductID = ProductInPromoSet.ProductID
  4316. LEFT JOIN PromoSet AS AllSet
  4317.     ON AllSet.PromoID = Promo.PromoID
  4318.  
  4319. WHERE
  4320. PromoInStore.StoreID = @StoreID 
  4321. AND StartDate <= @IntroductionDate 
  4322. AND EndDate > @IntroductionDate
  4323. AND BasketItem.CustomerID = @CustomerID
  4324. ORDER BY
  4325.     Promo.PromoType,
  4326.     Promo.PromoID,
  4327.     PromoSet.PromoSetID" connection="Grocery" type="replace" use="raw">
  4328.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4329.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4330.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4331.                         </select>
  4332.                     </query>
  4333.                     <query id="BasketPromos" default="false">
  4334.                         <select name="SELECT DISTINCT
  4335.     BasketItem.ItemNo,
  4336.     Promo.PromoID,
  4337.     PromoType,
  4338.     Description,
  4339.     LoyaltyClubOnly,
  4340.     IsOneTime,
  4341.     ProductInPromoSet.ProductID,
  4342.     PromoSet.PromoSetID,
  4343.     PromoSet.Quantity,
  4344.     PromoSet.MaxQuantity,
  4345.     PromoSet.LoyaltyPointsReward,
  4346.     PromoSet.Reduction,
  4347.     PromoSet.DiscountQuantity,
  4348.     PromoSet.Discount,
  4349.     PromoSet.CostThreshold,
  4350.     PromoSet.CostMultiplier,
  4351.     PromoSet.CostFrom,
  4352.     PromoSet.CostTo,
  4353.     PromoSet.CouponPromoID,
  4354.     0 AS SetCount
  4355.  
  4356. FROM
  4357. Promo
  4358.  
  4359. INNER JOIN PromoInStore
  4360.     ON PromoInStore.PromoID = Promo.PromoID
  4361. INNER JOIN PromoSet
  4362.     ON PromoSet.PromoID = Promo.PromoID
  4363. LEFT JOIN ProductInPromoSet
  4364.     ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  4365. INNER JOIN BasketItem
  4366.     ON BasketItem.ProductID = ProductInPromoSet.ProductID
  4367. LEFT JOIN PromoSet AS AllSet
  4368.     ON AllSet.PromoID = Promo.PromoID
  4369.  
  4370. WHERE
  4371. PromoInStore.StoreID = @StoreID
  4372. AND StartDate <= @IntroductionDate
  4373. AND EndDate > @IntroductionDate
  4374. AND PromoType > 100
  4375. AND BasketItem.CustomerID = @CustomerID
  4376. ORDER BY
  4377.     Promo.PromoType,
  4378.     Promo.PromoID,
  4379.     PromoSet.PromoSetID" connection="Grocery" type="replace" use="raw">
  4380.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4381.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4382.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4383.                         </select>
  4384.                     </query>
  4385.                     <query id="CustomerStoreProductCoupons" default="false">
  4386.                         <select name="SELECT DISTINCT
  4387.     Promo.PromoID,
  4388.     ProductInPromoSet.ProductID
  4389. FROM
  4390.     Coupon
  4391. INNER JOIN Promo 
  4392. ON Promo.PromoID = Coupon.PromoID
  4393. INNER JOIN PromoInStore 
  4394. ON PromoInStore.PromoID = Coupon.PromoID
  4395. INNER JOIN PromoSet 
  4396. ON PromoSet.PromoID = Promo.PromoID
  4397. INNER JOIN ProductInPromoSet 
  4398. ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  4399. WHERE
  4400.     PromoInStore.StoreID = @StoreID
  4401.     AND CustomerID = @CustomerID
  4402.     AND StartDate <= @IntroductionDate
  4403.     AND EndDate > @IntroductionDate
  4404. " connection="Grocery" type="replace" use="raw">
  4405.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4406.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4407.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4408.                         </select>
  4409.                     </query>
  4410.                     <query id="CustomerBasketCoupons" default="false">
  4411.                         <select name="SELECT DISTINCT
  4412.     BasketItem.ItemNo,
  4413.     Promo.PromoID,
  4414.     PromoType,
  4415.     Description,
  4416.     LoyaltyClubOnly,
  4417.     IsOneTime,
  4418.     ProductInPromoSet.ProductID,
  4419.     PromoSet.PromoSetID,
  4420.     PromoSet.Quantity,
  4421.     PromoSet.MaxQuantity,
  4422.     PromoSet.LoyaltyPointsReward,
  4423.     PromoSet.Reduction,
  4424.     PromoSet.DiscountQuantity,
  4425.     PromoSet.Discount,
  4426.     PromoSet.CostThreshold,
  4427.     PromoSet.CostMultiplier,
  4428.     PromoSet.CostFrom,
  4429.     PromoSet.CostTo,
  4430.     PromoSet.CouponPromoID,
  4431.     Coupon.CouponID,
  4432.     0 AS SetCount
  4433.  
  4434. FROM
  4435. Promo
  4436.  
  4437. INNER JOIN Coupon
  4438. ON Coupon.PromoID = Promo.PromoID
  4439. INNER JOIN PromoSet
  4440. ON PromoSet.PromoID = Promo.PromoID
  4441. LEFT JOIN ProductInPromoSet
  4442. ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  4443. INNER JOIN BasketItem
  4444. ON BasketItem.ProductID = ProductInPromoSet.ProductID
  4445. LEFT JOIN PromoSet AS AllSet
  4446. ON AllSet.PromoID = Promo.PromoID
  4447.  
  4448. WHERE
  4449. Coupon.CustomerID = @CustomerID 
  4450. AND StartDate <= @IntroductionDate
  4451. AND EndDate > @IntroductionDate
  4452. AND PromoType > 100 
  4453. AND BasketItem.CustomerID = @CustomerID 
  4454. ORDER BY
  4455.     Promo.PromoType,
  4456.     Promo.PromoID,
  4457.     PromoSet.PromoSetID
  4458. " connection="Grocery" type="replace" use="raw">
  4459.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4460.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4461.                         </select>
  4462.                     </query>
  4463.                     <query id="CustomerProductCoupons" default="false">
  4464.                         <select name="SELECT DISTINCT
  4465.     BasketItem.ItemNo,
  4466.     Promo.PromoID,
  4467.     PromoType,
  4468.     Description,
  4469.     LoyaltyClubOnly,
  4470.     IsOneTime,
  4471.     ProductInPromoSet.ProductID,
  4472.     PromoSet.PromoSetID,
  4473.     PromoSet.Quantity,
  4474.     PromoSet.MaxQuantity,
  4475.     PromoSet.LoyaltyPointsReward,
  4476.     PromoSet.Reduction,
  4477.     PromoSet.DiscountQuantity,
  4478.     PromoSet.Discount,
  4479.     PromoSet.CostThreshold,
  4480.     PromoSet.CostMultiplier,
  4481.     PromoSet.CostFrom,
  4482.     PromoSet.CostTo,
  4483.     PromoSet.CouponPromoID,
  4484.     Coupon.CouponID,
  4485.     0 AS SetCount
  4486.  
  4487. FROM
  4488. Promo
  4489.  
  4490. INNER JOIN Coupon
  4491. ON Coupon.PromoID = Promo.PromoID
  4492. INNER JOIN PromoSet
  4493. ON PromoSet.PromoID = Promo.PromoID
  4494. LEFT JOIN ProductInPromoSet
  4495. ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  4496. INNER JOIN BasketItem
  4497. ON BasketItem.ProductID = ProductInPromoSet.ProductID
  4498. LEFT JOIN PromoSet AS AllSet
  4499. ON AllSet.PromoID = Promo.PromoID
  4500.  
  4501. WHERE
  4502. Coupon.CustomerID = @CustomerID
  4503. AND StartDate <= @IntroductionDate
  4504. AND EndDate > @IntroductionDate
  4505. AND BasketItem.CustomerID = @CustomerID
  4506.  
  4507. ORDER BY
  4508.     Promo.PromoType,
  4509.     Promo.PromoID,
  4510.     PromoSet.PromoSetID
  4511. " connection="Grocery" type="replace" use="raw">
  4512.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4513.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4514.                         </select>
  4515.                     </query>
  4516.                     <query id="CustomerAllCoupons" default="false">
  4517.                         <select name="SELECT
  4518.     Promo.PromoID,
  4519.     Description,
  4520.     ImageID
  4521. FROM
  4522. Promo
  4523.  
  4524. INNER JOIN Coupon ON Coupon.PromoID = Promo.PromoID
  4525.  
  4526. WHERE
  4527. Coupon.CustomerID = @CustomerID
  4528. AND StartDate <= @IntroductionDate
  4529. AND EndDate > @IntroductionDate" connection="Grocery" type="replace" use="raw">
  4530.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4531.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4532.                         </select>
  4533.                     </query>
  4534.                     <query id="StoreProductPromos" default="false">
  4535.                         <select name="SELECT DISTINCT
  4536.     ProductInPromoSet.ProductID,
  4537.     Promo.PromoID
  4538. FROM
  4539. Promo
  4540. INNER JOIN PromoInStore
  4541. ON PromoInStore.PromoID = Promo.PromoID
  4542. INNER JOIN PromoSet
  4543. ON PromoSet.PromoID = Promo.PromoID
  4544. INNER JOIN ProductInPromoSet
  4545. ON ProductInPromoSet.PromoSetID = PromoSet.PromoSetID
  4546. INNER JOIN ProductInStore
  4547. ON ProductInStore.ProductID = ProductInPromoSet.ProductID
  4548. WHERE
  4549. PromoInStore.StoreID = @StoreID
  4550. AND ProductInStore.StoreID = @StoreID
  4551. AND StartDate <= @IntroductionDate
  4552. AND EndDate > @IntroductionDate" connection="Grocery" type="replace" use="raw">
  4553.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4554.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4555.                         </select>
  4556.                     </query>
  4557.                     <query id="StoreAllPromos" default="false">
  4558.                         <select name="SELECT
  4559.     Promo.PromoID,
  4560.     Description,
  4561.     ImageID
  4562. FROM
  4563. Promo
  4564.  
  4565. INNER JOIN PromoInStore ON PromoInStore.PromoID = Promo.PromoID
  4566.  
  4567. WHERE
  4568. PromoInStore.StoreID = @StoreID
  4569. AND StartDate <= @IntroductionDate
  4570. AND EndDate > @IntroductionDate
  4571. " connection="Grocery" type="replace" use="raw">
  4572.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4573.                             <parameter name="IntroductionDate" datatype="date" direction="in"/>
  4574.                         </select>
  4575.                     </query>
  4576.                 </datasource>
  4577.                 <properties>
  4578.                     <property name="PromoID" alias="PromoID" datatype="integer" nullable="false" pkey="false"/>
  4579.                     <property name="Description" alias="Description" datatype="string" nullable="true" pkey="false"/>
  4580.                     <property name="BasketItemNo" alias="BasketItemNo" datatype="integer" nullable="true" pkey="false"/>
  4581.                     <property name="PromoType" alias="PromoType" datatype="integer" nullable="true" pkey="false"/>
  4582.                     <property name="ImageID" alias="ImageID" datatype="integer" nullable="true" pkey="false"/>
  4583.                     <property name="ProductID" alias="ProductID" datatype="integer" nullable="true" pkey="false"/>
  4584.                     <property name="PromoSetID" alias="PromoSetID" datatype="integer" nullable="true" pkey="false"/>
  4585.                     <property name="Quantity" alias="Quantity" datatype="float" nullable="true" pkey="false"/>
  4586.                     <property name="MaxQuantity" alias="MaxQuantity" datatype="float" nullable="true" pkey="false"/>
  4587.                     <property name="Reduction" alias="Reduction" datatype="money" nullable="true" pkey="false"/>
  4588.                     <property name="DiscountQuantity" alias="DiscountQuantity" datatype="integer" nullable="true" pkey="false"/>
  4589.                     <property name="Discount" alias="Discount" datatype="float" nullable="true" pkey="false"/>
  4590.                     <property name="CostThreshold" alias="CostThreshold" datatype="money" nullable="true" pkey="false"/>
  4591.                     <property name="CostMultiplier" alias="CostMultiplier" datatype="money" nullable="true" pkey="false"/>
  4592.                     <property name="CostFrom" alias="CostFrom" datatype="money" nullable="true" pkey="false"/>
  4593.                     <property name="CostTo" alias="CostTo" datatype="money" nullable="true" pkey="false"/>
  4594.                     <property name="SetCount" alias="SetCount" datatype="integer" nullable="true" pkey="false"/>
  4595.                     <property name="LoyaltyClubOnly" alias="LoyaltyClubOnly" datatype="boolean" nullable="true" pkey="false"/>
  4596.                     <property name="IsOneTime" alias="IsOneTime" datatype="boolean" nullable="true" pkey="false"/>
  4597.                     <property name="ItemNo" alias="ItemNo" datatype="integer" nullable="true" pkey="false"/>
  4598.                     <property name="LoyaltyPointsCost" alias="LoyaltyPointsCost" datatype="money" nullable="true" pkey="false"/>
  4599.                     <property name="LoyaltyPointsReward" alias="LoyaltyPointsReward" datatype="money" nullable="true" pkey="false"/>
  4600.                     <property name="CouponPromoID" alias="CouponPromoID" datatype="integer" nullable="true" pkey="false"/>
  4601.                     <property name="CouponID" alias="CouponID" datatype="integer" nullable="true" pkey="false"/>
  4602.                 </properties>
  4603.                 <relationships>
  4604.                     <relationship name="Products" object="Product" keyprop="none" collection="true" query="StorePromoProducts">
  4605.                         <key pkey="PromoID" fkey="PromoID" from="parent" to="child"/>
  4606.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4607.                     </relationship>
  4608.                     <relationship name="PromoSets" object="PromoSet" keyprop="none" collection="true" query="PromoSets">
  4609.                         <key pkey="PromoID" fkey="PromoID" from="parent" to="child"/>
  4610.                     </relationship>
  4611.                 </relationships>
  4612.             </object>
  4613.             <object name="PromoSet">
  4614.                 <datasource>
  4615.                     <query id="PromoSets" default="false">
  4616.                         <select name="SELECT DISTINCT PromoSetID
  4617. FROM PromoSet
  4618. WHERE PromoID = @PromoID
  4619. " connection="Grocery" type="replace" use="raw">
  4620.                             <parameter name="PromoID" datatype="integer" direction="in"/>
  4621.                         </select>
  4622.                     </query>
  4623.                 </datasource>
  4624.                 <properties>
  4625.                     <property name="PromoID" alias="PromoID" datatype="integer" nullable="true" pkey="false"/>
  4626.                     <property name="PromoSetID" alias="PromoSetID" datatype="integer" nullable="true" pkey="false"/>
  4627.                 </properties>
  4628.             </object>
  4629.             <object name="Questionnaire">
  4630.                 <datasource>
  4631.                     <query id="Questionnaire" default="false">
  4632.                         <select name="SELECT
  4633.     QuestionnaireQuestion.QuestionID,
  4634.     QuestionnaireQuestion.Description,
  4635.     QuestionnaireQuestion.Multichoice AS IsMultichoice,
  4636.     QuestionnaireQuestion.Multiselect AS IsMultiselect,
  4637.     QuestionnaireQuestion.Comment AS IsComment
  4638. FROM QuestionnaireQuestion
  4639. " connection="Grocery" type="replace" use="raw"/>
  4640.                     </query>
  4641.                     <query id="CustomerQuestionnaire" default="true">
  4642.                         <select name="SELECT
  4643.     QuestionnaireQuestion.QuestionID,
  4644.     QuestionnaireQuestion.Description,
  4645.     QuestionnaireQuestion.Multichoice AS IsMultichoice,
  4646.     QuestionnaireQuestion.Multiselect AS IsMultiselect,
  4647.     QuestionnaireQuestion.Comment AS IsComment
  4648. FROM QuestionnaireQuestion
  4649. LEFT JOIN QuestionnaireResponse
  4650. ON QuestionnaireQuestion.QuestionID = QuestionnaireResponse.QuestionID
  4651. WHERE QuestionnaireResponse.CustomerID = NULL
  4652. AND QuestionnaireResponse.CustomerID = @CustomerID
  4653.  
  4654. " connection="Grocery" type="replace" use="raw">
  4655.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4656.                         </select>
  4657.                         <insert name="INSERT INTO 
  4658. QuestionnaireResponse(CustomerID,QuestionID,AnswerID,Comment,CreateDate)
  4659. VALUES(@CustomerID, @QuestionID, @AnswerID, @Comment, GetDate())
  4660. " connection="Grocery" type="replace" use="raw">
  4661.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4662.                             <parameter name="QuestionID" datatype="integer" direction="in"/>
  4663.                             <parameter name="AnswerID" datatype="integer" direction="in"/>
  4664.                             <parameter name="Comment" datatype="string" direction="in"/>
  4665.                         </insert>
  4666.                     </query>
  4667.                 </datasource>
  4668.                 <properties>
  4669.                     <property name="QuestionID" alias="QuestionID" datatype="integer" nullable="false" pkey="true"/>
  4670.                     <property name="Description" alias="Description" datatype="string" nullable="false"/>
  4671.                     <property name="IsMultichoice" alias="IsMultichoice" datatype="boolean" nullable="false"/>
  4672.                     <property name="IsMultiselect" alias="IsMultiselect" datatype="boolean" nullable="false"/>
  4673.                     <property name="IsComment" alias="IsComment" datatype="boolean" nullable="false"/>
  4674.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="true"/>
  4675.                     <property name="AnswerID" alias="ResponseID" datatype="integer" nullable="false" pkey="true"/>
  4676.                     <property name="Comment" alias="Comment" datatype="string" nullable="false"/>
  4677.                 </properties>
  4678.                 <relationships>
  4679.                     <relationship name="QuestionnaireAnswers" object="QuestionnaireAnswer" keyprop="down" collection="true" query="QuestionnaireAnswers">
  4680.                         <key pkey="QuestionID" fkey="QuestionID" from="parent" to="child"/>
  4681.                     </relationship>
  4682.                 </relationships>
  4683.             </object>
  4684.             <object name="QuestionnaireAnswer">
  4685.                 <datasource>
  4686.                     <query id="QuestionnaireAnswers" default="true">
  4687.                         <select name="SELECT
  4688.     QuestionnaireAnswer.QuestionID,
  4689.     QuestionnaireAnswer.AnswerID,
  4690.     QuestionnaireAnswer.Description
  4691. FROM QuestionnaireAnswer
  4692. INNER JOIN QuestionnaireQuestion
  4693. ON QuestionnaireAnswer.QuestionID = QuestionnaireQuestion.QuestionID
  4694. WHERE QuestionnaireQuestion.Comment = 0
  4695. AND QuestionnaireAnswer.QuestionID = @QuestionID
  4696. " connection="Grocery" type="replace" use="raw">
  4697.                             <parameter name="QuestionID" datatype="integer" direction="in"/>
  4698.                         </select>
  4699.                     </query>
  4700.                 </datasource>
  4701.                 <properties>
  4702.                     <property name="QuestionID" alias="QuestionID" datatype="integer" nullable="false" pkey="true"/>
  4703.                     <property name="AnswerID" alias="AnswerID" datatype="integer" nullable="false"/>
  4704.                     <property name="Description" alias="Description" datatype="string" nullable="false"/>
  4705.                 </properties>
  4706.             </object>
  4707.             <object name="Store">
  4708.                 <datasource>
  4709.                     <query id="Store" default="true">
  4710.                         <select name="SELECT 
  4711.     Store.StoreID, 
  4712.     Store.Name,
  4713.     StoreInStoreGroup.StoreGroupID
  4714. FROM 
  4715.     Store
  4716. LEFT JOIN
  4717. StoreInStoreGroup
  4718. ON Store.StoreID  = StoreInStoreGroup.StoreID
  4719. WHERE Store.StoreID = @StoreID
  4720. " connection="Grocery" type="replace" use="raw">
  4721.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4722.                         </select>
  4723.                         <update name="UPDATE Store
  4724. SET Name = @Name
  4725. WHERE StoreID = @StoreID
  4726. " connection="Grocery" type="replace" use="raw">
  4727.                             <parameter name="StoreID" datatype="integer" direction="in"/>
  4728.                             <parameter name="Name" datatype="string" direction="in"/>
  4729.                         </update>
  4730.                     </query>
  4731.                     <query id="SelectStoresInGroup" default="false">
  4732.                         <select name="SELECT
  4733.     Store.StoreID,
  4734.     Store.Name,
  4735.     StoreInStoreGroup.StoreGroupID
  4736. FROM 
  4737. Store
  4738. INNER JOIN StoreInStoreGroup
  4739. ON Store.StoreID = StoreInStoreGroup.StoreID
  4740. WHERE StoreInStoreGroup.StoreGroupID = @StoreGroupID
  4741. " connection="Grocery" type="replace" use="raw">
  4742.                             <parameter name="StoreGroupID" datatype="integer" direction="in"/>
  4743.                         </select>
  4744.                     </query>
  4745.                 </datasource>
  4746.                 <properties>
  4747.                     <property name="StoreID" alias="StoreID" datatype="integer" nullable="false" pkey="true"/>
  4748.                     <property name="Name" alias="Name" datatype="string" nullable="false"/>
  4749.                     <property name="StoreGroupID" alias="StoreGroupID" datatype="integer" nullable="true"/>
  4750.                     <property name="IntroductionDate" alias="IntroductionDate" datatype="date" nullable="true"/>
  4751.                 </properties>
  4752.                 <relationships>
  4753.                     <relationship name="Units" object="Unit" keyprop="none" collection="true" query="Units">
  4754.                         <key fkey="" pkey="" to="" from=""/>
  4755.                     </relationship>
  4756.                     <relationship name="Categories" object="Category" keyprop="none" collection="true" query="StoreCategories">
  4757.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4758.                     </relationship>
  4759.                     <relationship name="AdvancedSearchProductsWithAV" object="Product" keyprop="none" collection="true" query="AdvancedSearchStoreProductsWithAV">
  4760.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4761.                         <key pkey="TopLevelID" fkey="TopLevelID" from="parent" to="child"/>
  4762.                         <key pkey="AttributeID" fkey="AttributeID" from="parent" to="child"/>
  4763.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4764.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4765.                     </relationship>
  4766.                     <relationship name="AdvancedSearchProducts" object="Product" keyprop="none" collection="true" query="AdvancedSearchStoreProducts">
  4767.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4768.                         <key pkey="TopLevelID" fkey="TopLevelID" from="parent" to="child"/>
  4769.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4770.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4771.                     </relationship>
  4772.                     <relationship name="SearchProductsWithAV" object="Product" keyprop="none" collection="true" query="SearchStoreProductsWithAV">
  4773.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4774.                         <key pkey="AttributeID" fkey="AttributeID" from="parent" to="child"/>
  4775.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4776.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4777.                     </relationship>
  4778.                     <relationship name="SearchProducts" object="Product" keyprop="none" collection="true" query="SearchStoreProducts">
  4779.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4780.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4781.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4782.                     </relationship>
  4783.                     <relationship name="AdvancedSearchAttributes" object="ProductAttribute" keyprop="none" collection="true" query="AdvancedSearchStoreAttributes">
  4784.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4785.                         <key pkey="TopLevelID" fkey="TopLevelID" from="parent" to="child"/>
  4786.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4787.                     </relationship>
  4788.                     <relationship name="SearchAttributes" object="ProductAttribute" keyprop="none" collection="true" query="SearchStoreAttributes">
  4789.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4790.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4791.                     </relationship>
  4792.                     <relationship name="ProductPromos" object="Promo" keyprop="none" collection="true" query="StoreProductPromos">
  4793.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4794.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4795.                     </relationship>
  4796.                     <relationship name="Promos" object="Promo" keyprop="down" collection="true" query="StoreAllPromos">
  4797.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4798.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4799.                     </relationship>
  4800.                     <relationship name="DynamicProducts" object="Product" keyprop="none" collection="true" query="StoreDynamicProducts">
  4801.                         <key pkey="StoreID" fkey="StoreID" from="parent" to="child"/>
  4802.                         <key pkey="SearchString" fkey="SearchString" from="parent" to="child"/>
  4803.                         <key pkey="IntroductionDate" fkey="IntroductionDate" from="parent" to="child"/>
  4804.                     </relationship>
  4805.                 </relationships>
  4806.                 <methods>
  4807.                     <method name="FormatSearchClause" returntype="string" uuid="IcelandGrocery.Store" implname="FormatSearchClause">
  4808.                         <parameter name="sString" datatype="string" direction="in"/>
  4809.                     </method>
  4810.                     <method name="FormatDynamicClause" returntype="string" uuid="IcelandGrocery.Store" implname="FormatDynamicClause">
  4811.                         <parameter name="sString" datatype="string" direction="in"/>
  4812.                     </method>
  4813.                 </methods>
  4814.             </object>
  4815.             <object name="StoreGroup">
  4816.                 <datasource>
  4817.                     <query id="StoreGroup" default="true">
  4818.                         <select name="SELECT
  4819.     StoreGroupID,
  4820.     StoreGroupName,
  4821.     ContentPath,
  4822.     AllowProductNotes
  4823. FROM StoreGroup
  4824. WHERE  StoreGroupID = @StoreGroupID
  4825. " connection="Grocery" type="replace" use="raw">
  4826.                             <parameter name="StoreGroupID" datatype="integer" direction="in"/>
  4827.                         </select>
  4828.                     </query>
  4829.                 </datasource>
  4830.                 <properties>
  4831.                     <property name="StoreGroupID" alias="StoreGroupID" datatype="integer" nullable="false" pkey="true"/>
  4832.                     <property name="StoreGroupName" alias="StoreGroupName" datatype="string" nullable="true"/>
  4833.                     <property name="ContentPath" alias="ContentPath" datatype="string" nullable="true"/>
  4834.                     <property name="AllowProductNotes" alias="AllowProductNotes" datatype="boolean" nullable="true"/>
  4835.                 </properties>
  4836.                 <relationships>
  4837.                     <relationship name="Stores" object="Store" keyprop="none" collection="true" query="SelectStoresInGroup">
  4838.                         <key fkey="StoreGroupID" pkey="StoreGroupID" from="parent" to="child"/>
  4839.                     </relationship>
  4840.                 </relationships>
  4841.             </object>
  4842.             <object name="Unit">
  4843.                 <datasource>
  4844.                     <query id="Units" default="true">
  4845.                         <select name="
  4846. SELECT
  4847.     UnitID,
  4848.     UnitGroupID,
  4849.     Name,
  4850.     ConvertRate,
  4851.     IsInteger
  4852.  
  4853. FROM Unit" connection="Grocery" type="replace" use="raw"/>
  4854.                     </query>
  4855.                 </datasource>
  4856.                 <properties>
  4857.                     <property name="UnitID" alias="UnitID" datatype="integer" nullable="false" pkey="true"/>
  4858.                     <property name="UnitGroupID" alias="UnitGroupID" datatype="integer" nullable="false"/>
  4859.                     <property name="Name" alias="Name" datatype="string" nullable="false"/>
  4860.                     <property name="ConvertRate" alias="ConvertRate" datatype="float" nullable="false"/>
  4861.                     <property name="IsInteger" alias="IsInteger" datatype="boolean" nullable="false"/>
  4862.                 </properties>
  4863.                 <relationships/>
  4864.             </object>
  4865.             <object name="UsedOneTimePromo">
  4866.                 <datasource>
  4867.                     <query id="UsedOneTimePromo" default="true">
  4868.                         <select name="SELECT PromoID
  4869. FROM UsedOneTimePromo
  4870. WHERE CustomerID = @CustomerID AND PromoID = @PromoID
  4871. " connection="Grocery" type="replace" use="raw">
  4872.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4873.                             <parameter name="PromoID" datatype="integer" direction="in"/>
  4874.                         </select>
  4875.                         <insert name="INSERT INTO UsedOneTimePromo(CustomerID, PromoID)
  4876. VALUES(@CustomerID, @PromoID)" connection="Grocery" type="replace" use="raw">
  4877.                             <parameter name="CustomerID" datatype="integer" direction="in"/>
  4878.                             <parameter name="PromoID" datatype="integer" direction="in"/>
  4879.                         </insert>
  4880.                     </query>
  4881.                 </datasource>
  4882.                 <properties>
  4883.                     <property name="CustomerID" alias="CustomerID" datatype="integer" nullable="false" pkey="true"/>
  4884.                     <property name="PromoID" alias="PromoID" datatype="integer" nullable="false" pkey="true"/>
  4885.                 </properties>
  4886.             </object>
  4887.             <object name="File">
  4888.                 <datasource>
  4889.                     <query id="WWWRoot" default="true">
  4890.                         <select name="" connection="WWWRoot" type="table" use="raw"/>
  4891.                     </query>
  4892.                     <query id="StoreContent" default="false">
  4893.                         <select name="" connection="StoreContent" type="table" use="raw"/>
  4894.                     </query>
  4895.                 </datasource>
  4896.                 <properties>
  4897.                     <property name="Name" alias="Name" datatype="string" nullable="false" pkey="true"/>
  4898.                     <property name="Size" alias="Size" datatype="integer" nullable="false"/>
  4899.                     <property name="Data" alias="Data" datatype="string" nullable="true"/>
  4900.                     <property name="Revision" alias="" datatype="long" nullable="true"/>
  4901.                 </properties>
  4902.                 <relationships>
  4903.                     <relationship name="WWWRoot" object="File" keyprop="down" collection="true" query="WWWRoot"/>
  4904.                     <relationship name="StoreContent" object="File" keyprop="down" collection="true" query="StoreContent"/>
  4905.                 </relationships>
  4906.             </object>
  4907.         </objects>
  4908.     </model>
  4909. </models>
  4910.