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(); } }
public void Insert(int OrderID, int ProductID, decimal UnitPrice, short Quantity, float Discount) { Order_Detail item = new Order_Detail(); item.OrderID = OrderID; item.ProductID = ProductID; item.UnitPrice = UnitPrice; item.Quantity = Quantity; item.Discount = Discount; item.Save(UserName); }
public void Update(int OrderID, int ProductID, decimal UnitPrice, short Quantity, float Discount) { Order_Detail item = new Order_Detail(); item.MarkOld(); item.IsLoaded = true; item.OrderID = OrderID; item.ProductID = ProductID; item.UnitPrice = UnitPrice; item.Quantity = Quantity; item.Discount = Discount; item.Save(UserName); }
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(); } } }