public static bool UpdateData(FormedBasket x) { BaseDataBase._NonQuery("delete from FormedBasket_Item where FormedBasket_Item.FormedBasketID = " + x.Id); bool b = BaseDataBase._StoredProcedure("sp_Update_FormedBasket" , new SqlParameter("@Id", x.Id) , new SqlParameter("@Name", x.Name) , new SqlParameter("@IsActive", x.IsActive) , new SqlParameter("@IsUrgent", x.IsUrgent) , new SqlParameter("@Notes", x.Notes) , new SqlParameter("@LastUserID", BaseDataBase.CurrentUser.ID)); foreach (var item in x.FormedBasketItems) { if (item.FormedBasket == null) { item.FormedBasket = x; } FormedBasket_Item.InsertData(item); } if (x.id.HasValue) { FormedBasket_Sector.SaveFormedBasketSectors(x); } return(b); }
public static bool InsertData(FormedBasket x) { x.Id = BaseDataBase._StoredProcedureReturnable("sp_Add_FormedBasket" , new SqlParameter("@Id", System.Data.SqlDbType.Int) , new SqlParameter("@Name", x.Name) , new SqlParameter("@IsActive", x.IsActive) , new SqlParameter("@IsUrgent", x.IsUrgent) , new SqlParameter("@Notes", x.Notes) , new SqlParameter("@LastUserID", BaseDataBase.CurrentUser.ID)); foreach (var item in x.FormedBasketItems) { if (item.FormedBasket == null) { item.FormedBasket = x; FormedBasket_Item.InsertData(item); } } if (x.id.HasValue) { FormedBasket_Sector.SaveFormedBasketSectors(x); } return(x.Id.HasValue); }