Example #1
0
        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);
        }
Example #2
0
 public static bool DeleteData(FormedBasket x)
 {
     if (x.id.HasValue)
     {
         FormedBasket_Sector.DeleteFormedBasketSectors(x);
     }
     return(BaseDataBase._StoredProcedure("sp_Delete_FormedBasket"
                                          , new SqlParameter("@Id", x.Id)));
 }
Example #3
0
        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);
        }