internal int InsertDamage(Inv_Damage Inv_DamageObj)
 {
     try
     {
         _context.Inv_Damage.AddObject(Inv_DamageObj);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
 internal int InsertDamage(Inv_Damage Inv_DamageObj)
 {
     return(buyCentralDal.InsertDamage(Inv_DamageObj));
 }
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                string OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                string Edit_User = ((SessionUser)Session["SessionUser"]).UserId.ToString();

                List <Inv_Damage_Temp> damageList = new List <Inv_Damage_Temp>();
                string challanNo = txtChalanNo.Text.Trim();
                damageList = rChallanBll.GetTempDanmage(((SessionUser)Session["SessionUser"]).OCode, challanNo);

                foreach (Inv_Damage_Temp rchallan in damageList)
                {
                    Inv_BuyCentral buycentral = _BuyCentral.GetBuyForReturn(rchallan.BarCode, rchallan.Store_Code);
                    if (buycentral != null)
                    {
                        // Kamruzzaman...........
                        Inv_Damage _damage = new Inv_Damage();
                        _damage.ChallanNo         = txtChalanNo.Text;
                        _damage.Challan_No_To     = rchallan.Challan_No_To;
                        _damage.BarCode           = rchallan.BarCode;
                        _damage.ProductId         = Convert.ToInt32(rchallan.ProductId);
                        _damage.ProductGroup      = rchallan.ProductGroup;
                        _damage.ProductName       = rchallan.ProductName;
                        _damage.Brand             = rchallan.Brand;
                        _damage.StyleSize         = rchallan.StyleSize;
                        _damage.FloorName         = rchallan.FloorName;
                        _damage.UnitName          = rchallan.UnitName;
                        _damage.ReceiveQuantity   = rchallan.ReceiveQuantity;
                        _damage.CPU               = rchallan.CPU;
                        _damage.RPU               = rchallan.RPU;
                        _damage.ExpireDate        = rchallan.ExpireDate;
                        _damage.BalanceQuanity    = rchallan.BalanceQuanity;
                        _damage.PurchaseDate      = rchallan.PurchaseDate;
                        _damage.EditDate          = rchallan.EditDate;
                        _damage.OCode             = rchallan.OCode;
                        _damage.Store_Code        = rchallan.Store_Code;
                        _damage.SupplierReturnQty = rchallan.SupplierReturnQty;
                        _damage.CompanyCode       = rchallan.CompanyCode;
                        _damage.PurchaseDate      = rchallan.PurchaseDate;
                        _damage.EditDate          = DateTime.Today;
                        _damage.EditUser          = rchallan.EditUser;
                        _damage.DamageDate        = DateTime.Today;
                        _damage.CompanyName       = rchallan.CompanyName;
                        _damage.CompanyId         = rchallan.CompanyId;
                        _damage.DamageQty         = rchallan.DamageQty;
                        _damage.DamageCategory    = rchallan.DamageCategory;
                        _damage.Remarks           = rchallan.Remarks;

                        _BuyCentral.InsertDamage(_damage);

                        buycentral.BalanceQuanity = buycentral.BalanceQuanity - rchallan.DamageQty;

                        buycentral.SupplierReturnQty = buycentral.DamageQty + rchallan.DamageQty;
                        //buyCentral.Id = Convert.ToInt16(hidId.Value);
                        _BuyCentral.Update_ForReturn(buycentral.Id, buycentral.BarCode, buycentral.Store_Code, buycentral.ChallanNo, buycentral);
                        _BuyCentral.DeleteDamage_Temp(rchallan.Id);
                    }

                    else
                    {
                    }
                }
                grdDamage.DataSource = null;
                grdDamage.DataBind();
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Product damage information inserted successfully!')", true);
                Response.Redirect(Request.RawUrl);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }