public static void SaveUnitMeasureMap(int varVendorID, int[] itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ProductVendor WHERE VendorID=@VendorID", Vendor.Schema.Provider.Name); cmdDel.AddParameter("@VendorID", varVendorID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (int item in itemList) { ProductVendor varProductVendor = new ProductVendor(); varProductVendor.SetColumnValue("VendorID", varVendorID); varProductVendor.SetColumnValue("UnitMeasureCode", item); varProductVendor.Save(); } }
public static void SaveVendorMap(string varUnitMeasureCode, VendorCollection items) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ProductVendor WHERE UnitMeasureCode=@UnitMeasureCode", UnitMeasure.Schema.Provider.Name); cmdDel.AddParameter("@UnitMeasureCode", varUnitMeasureCode); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (Vendor item in items) { ProductVendor varProductVendor = new ProductVendor(); varProductVendor.SetColumnValue("UnitMeasureCode", varUnitMeasureCode); varProductVendor.SetColumnValue("VendorID", item.GetPrimaryKeyValue()); varProductVendor.Save(); } }
public static void SaveProductMap(int varVendorID, System.Web.UI.WebControls.ListItemCollection itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM ProductVendor WHERE VendorID=@VendorID", Vendor.Schema.Provider.Name); cmdDel.AddParameter("@VendorID", varVendorID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (System.Web.UI.WebControls.ListItem l in itemList) { if (l.Selected) { ProductVendor varProductVendor = new ProductVendor(); varProductVendor.SetColumnValue("VendorID", varVendorID); varProductVendor.SetColumnValue("ProductID", l.Value); varProductVendor.Save(); } } }