public void AddCategoryDiscount(CategoryDiscount categorydiscount) { object[] discountVals = categorydiscount.GetDiscountValuesArray(); foreach (object val in discountVals) { dbConnection.CheckInput(val.ToString()); } dbConnection.InsertTable("CategoryDiscount", "SystemID, CategoryName, StoreName, StartDate, EndDate, DiscountAmount", new[] { "@idParam", "@categoryParam", "@storeParam", "@startParam", "@endParam", "@amountParam" } , discountVals); }
public void EditCategoryDiscount(CategoryDiscount categoryDiscount) { string[] columnNames = { "SystemID", "CategoryName", "StoreName", "StartDate", "EndDate", "DiscountAmount", }; object[] discountVals = categoryDiscount.GetDiscountValuesArray(); foreach (object val in discountVals) { dbConnection.CheckInput(val.ToString()); } dbConnection.UpdateTable("CategoryDiscount", "SystemId = '" + categoryDiscount.SystemId + "'", columnNames, new[] { "@idParam", "@categoryParam", "@storeParam", "@startParam", "@endParam", "@amountParam" } , discountVals); }