Exemplo n.º 1
0
        public static void SaveProductMap(int varOrderID, int[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [Order Details] WHERE [Order Details].[OrderID] = @OrderID", Order.Schema.Provider.Name);

            cmdDel.AddParameter("@OrderID", varOrderID, DbType.Int32);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (int item in itemList)
            {
                Order_Detail varOrder_Detail = new Order_Detail();
                varOrder_Detail.SetColumnValue("OrderID", varOrderID);
                varOrder_Detail.SetColumnValue("ProductID", item);
                varOrder_Detail.Save();
            }
        }
Exemplo n.º 2
0
        public static void SaveOrderMap(int varProductID, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [Order Details] WHERE [Order Details].[ProductID] = @ProductID", Product.Schema.Provider.Name);

            cmdDel.AddParameter("@ProductID", varProductID, DbType.Int32);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (System.Web.UI.WebControls.ListItem l in itemList)
            {
                if (l.Selected)
                {
                    Order_Detail varOrder_Detail = new Order_Detail();
                    varOrder_Detail.SetColumnValue("ProductID", varProductID);
                    varOrder_Detail.SetColumnValue("OrderID", l.Value);
                    varOrder_Detail.Save();
                }
            }
        }