示例#1
0
        public EXP_PackingList SetToModelObject(EXPPackingList model, int userid)
        {
            EXP_PackingList Entity = new EXP_PackingList();

            Entity.PLID            = model.PLID;
            Entity.PLNo            = model.PLNo;
            Entity.CIID            = model.CIID;
            Entity.PLDate          = DalCommon.SetDate(model.PLDate);
            Entity.BalesNo         = model.BalesNo;
            Entity.BaleQty         = model.BaleQty;
            Entity.TotalPcs        = model.TotalPcs;
            Entity.TotalSide       = model.TotalSide;
            Entity.MeterCIQty      = model.MeterCIQty;
            Entity.FootCIQty       = model.FootCIQty;
            Entity.PLNetWeight     = model.PLNetWeight;
            Entity.NetWeightUnit   = model.NetWeightUnit;
            Entity.PLGrossWeight   = model.PLGrossWeight;
            Entity.GrossWeightUnit = model.GrossWeightUnit;
            Entity.PLMarks         = model.PLMarks;
            Entity.PLNote          = model.PLNote;
            Entity.RecordStatus    = "NCF";
            Entity.SetOn           = DateTime.Now;
            Entity.SetBy           = userid;
            Entity.IPAddress       = GetIPAddress.LocalIPAddress();

            return(Entity);
        }
        public ActionResult GetAllGridList(string PLPIID)
        {
            EXPPackingList model = new EXPPackingList();

            if (string.IsNullOrEmpty(PLPIID))
            {
                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            model.EXPPLPIItemColorList = Dalobject.GetExpPLPIItemColorList(PLPIID);
            if (model.EXPPLPIItemColorList.Count > 0)
            {
                model.EXPPLPIItemColorBaleList = Dalobject.GetExpPLPIItemColorBaleList(model.EXPPLPIItemColorList[0].PLPIItemColorID.ToString());
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ValidationMsg ConfirmedEXPPackingList(EXPPackingList model, int userid)
        {
            _vmMsg = new ValidationMsg();
            try
            {
                using (var tx = new TransactionScope())
                {
                    using (_context)
                    {
                        var originalEntityCI = _context.EXP_PackingList.First(m => m.PLID == model.PLID);
                        originalEntityCI.RecordStatus = "CNF";
                        originalEntityCI.ModifiedBy   = userid;
                        originalEntityCI.ModifiedOn   = DateTime.Now;

                        //CIPIID = model.ExpCIPIList[0].CIPIID;
                        //var originalEntityCIPI = _context.EXP_CIPI.First(m => m.CIPIID == CIPIID);
                        //originalEntityCIPI.RecordStatus = "CNF";
                        //originalEntityCIPI.ModifiedBy = userid;
                        //originalEntityCIPI.ModifiedOn = DateTime.Now;

                        //if (model.ExpCIPIItemList.Count > 0)
                        //{
                        //    foreach (EXPCIPIItem objEXPCIPIItem in model.ExpCIPIItemList)
                        //    {
                        //        var originalEntityCIPIItem = _context.EXP_CIPIItem.First(m => m.CIPIItemID == objEXPCIPIItem.CIPIItemID);
                        //        originalEntityCIPIItem.RecordStatus = "CNF";
                        //        originalEntityCIPIItem.ModifiedBy = userid;
                        //        originalEntityCIPIItem.ModifiedOn = DateTime.Now;
                        //    }
                        //}

                        _context.SaveChanges();

                        tx.Complete();
                        _vmMsg.Type = Enums.MessageType.Success;
                        _vmMsg.Msg  = "Confirmed Successfully.";
                    }
                }
            }
            catch
            {
                _vmMsg.Type = Enums.MessageType.Error;
                _vmMsg.Msg  = "Failed to Confirmed.";
            }
            return(_vmMsg);
        }
示例#4
0
        public EXPPackingList SetToBussinessObject(EXP_PackingList Entity)
        {
            EXPPackingList Model = new EXPPackingList();

            Model.PLID            = Entity.PLID;
            Model.PLNo            = Entity.PLNo;
            Model.CIID            = Entity.CIID;
            Model.CINo            = Entity.CIID == null ? "" : _context.EXP_CI.Where(m => m.CIID == Entity.CIID).FirstOrDefault().CIRefNo;
            Model.CIDate          = Entity.CIID == null ? "" : Convert.ToDateTime(_context.EXP_CI.Where(m => m.CIID == Entity.CIID).FirstOrDefault().CIDate).ToString("dd/MM/yyyy");
            Model.PLDate          = Convert.ToDateTime(Entity.PLDate).ToString("dd/MM/yyyy");
            Model.BalesNo         = Entity.BalesNo;
            Model.BaleQty         = Entity.BaleQty;
            Model.TotalPcs        = Entity.TotalPcs;
            Model.TotalSide       = Entity.TotalSide;
            Model.MeterCIQty      = Entity.MeterCIQty;
            Model.FootCIQty       = Entity.FootCIQty;
            Model.PLNetWeight     = Entity.PLNetWeight;
            Model.NetWeightUnit   = Entity.NetWeightUnit;
            Model.PLGrossWeight   = Entity.PLGrossWeight;
            Model.GrossWeightUnit = Entity.GrossWeightUnit;
            Model.PLMarks         = Entity.PLMarks;
            Model.PLNote          = Entity.PLNote;
            Model.RecordStatus    = Entity.RecordStatus;
            if (Entity.RecordStatus == "NCF")
            {
                Model.RecordStatusName = "Not Confirmed";
            }
            else if (Entity.RecordStatus == "CNF")
            {
                Model.RecordStatusName = "Confirmed";
            }
            else if (Entity.RecordStatus == "CHK")
            {
                Model.RecordStatusName = "Checked";
            }
            else
            {
                Model.RecordStatusName = "";
            }

            return(Model);
        }
 public ActionResult EXPPackingList(EXPPackingList model)
 {
     _vmMsg = model.PLID == 0 ? Dalobject.Save(model, Convert.ToInt32(Session["UserID"]), "EXPPackingList/EXPPackingList") : Dalobject.Update(model, Convert.ToInt32(Session["UserID"]));
     return(Json(new { PLID = Dalobject.GetPLID(), PLNo = Dalobject.GetPLNo(), PLPIID = Dalobject.GetPLPIID(), msg = _vmMsg }));
 }
 public ActionResult ConfirmedEXPPackingList(EXPPackingList model)
 {
     _vmMsg = Dalobject.ConfirmedEXPPackingList(model, Convert.ToInt32(Session["UserID"]));
     return(Json(new { msg = _vmMsg }));
 }
示例#7
0
        public ValidationMsg Save(EXPPackingList model, int userid, string pageUrl)
        {
            _vmMsg = new ValidationMsg();
            try
            {
                #region Save

                using (var tx = new TransactionScope())
                {
                    using (_context)
                    {
                        model.PLNo = DalCommon.GetPreDefineNextCodeByUrl(pageUrl);//DalCommon.GetPreDefineValue("1", "00045");
                        if (model.PLNo != null)
                        {
                            #region CI

                            EXP_PackingList tblEXPPackingList = SetToModelObject(model, userid);
                            _context.EXP_PackingList.Add(tblEXPPackingList);
                            _context.SaveChanges();

                            #endregion

                            #region CIPI

                            model.EXPPLPIList[0].PLID = tblEXPPackingList.PLID;
                            EXP_PLPI tblEXPPLPI = SetToModelObject(model.EXPPLPIList[0], userid);
                            _context.EXP_PLPI.Add(tblEXPPLPI);
                            _context.SaveChanges();

                            #endregion

                            #region CIPIItem

                            if (model.EXPPLPIItemColorList != null)
                            {
                                foreach (EXPPLPIItemColor objEXPPLPIItemColor in model.EXPPLPIItemColorList)
                                {
                                    objEXPPLPIItemColor.PLPIID = tblEXPPLPI.PLPIID;

                                    EXP_PLPIItemColor tblEXPCIPIItem = SetToModelObject(objEXPPLPIItemColor, userid);
                                    _context.EXP_PLPIItemColor.Add(tblEXPCIPIItem);
                                    _context.SaveChanges();

                                    #region CIPIItemColor

                                    if (model.EXPPLPIItemColorBaleList != null)
                                    {
                                        if ((objEXPPLPIItemColor.ArticleID == model.EXPPLPIItemColorBaleList[0].ArticleID) && (objEXPPLPIItemColor.ColorID == model.EXPPLPIItemColorBaleList[0].ColorID))
                                        {
                                            foreach (EXPPLPIItemColorBale objEXPCIPIItemColor in model.EXPPLPIItemColorBaleList)
                                            {
                                                objEXPCIPIItemColor.PLPIItemColorID = tblEXPCIPIItem.PLPIItemColorID;
                                                EXP_PLPIItemColorBale tblEXPCIPIItemColor = SetToModelObject(objEXPCIPIItemColor, userid);
                                                _context.EXP_PLPIItemColorBale.Add(tblEXPCIPIItemColor);
                                            }
                                        }
                                    }
                                    #endregion
                                }
                            }

                            #endregion

                            _context.SaveChanges();
                            tx.Complete();

                            PLID        = tblEXPPackingList.PLID;
                            PLNo        = model.PLNo;
                            PLPIID      = tblEXPPLPI.PLPIID;
                            _vmMsg.Type = Enums.MessageType.Success;
                            _vmMsg.Msg  = "Saved Successfully.";
                        }
                        else
                        {
                            _vmMsg.Type = Enums.MessageType.Error;
                            _vmMsg.Msg  = "PLNo Predefine Value not Found.";
                        }
                    }
                }

                //#region CIPIItemColor

                //if (model.EXPPLPIItemColorBaleList != null)
                //{
                //    //if ((objEXPPLPIItemColor.ArticleID == model.EXPPLPIItemColorBaleList[0].ArticleID) && (objEXPPLPIItemColor.ColorID == model.EXPPLPIItemColorBaleList[0].ColorID))
                //    //{
                //    foreach (EXPPLPIItemColorBale objEXPCIPIItemColor in model.EXPPLPIItemColorBaleList)
                //    {
                //        objEXPCIPIItemColor.PLPIItemColorID = 5;// tblEXPCIPIItem.PLPIItemColorID;
                //        objEXPCIPIItemColor.Remarks = "";// tblEXPCIPIItem.PLPIItemColorID;
                //        if (string.IsNullOrEmpty(objEXPCIPIItemColor.GradeName))
                //            objEXPCIPIItemColor.GradeID = null;
                //        else
                //            objEXPCIPIItemColor.GradeID = 5;// _context.Sys_Grade.Where(m => m.GradeName == objEXPCIPIItemColor.GradeName).FirstOrDefault().GradeID;

                //        if (string.IsNullOrEmpty(objEXPCIPIItemColor.GrossBaleWeightUnitName))
                //        {
                //            objEXPCIPIItemColor.NetWeightUnit = null;
                //            objEXPCIPIItemColor.GrossBaleWeightUnit = null;
                //        }
                //        else
                //        {
                //            objEXPCIPIItemColor.NetWeightUnit = 5;// _context.Sys_Unit.Where(m => m.UnitName == objEXPCIPIItemColor.GrossBaleWeightUnitName).FirstOrDefault().UnitID;
                //            objEXPCIPIItemColor.GrossBaleWeightUnit = 5;// objEXPCIPIItemColor.NetWeightUnit;// _context.Sys_Unit.Where(m => m.UnitName == objEXPCIPIItemColor.GrossBaleWeightUnitName).FirstOrDefault().UnitID;
                //        }

                //        SqlConnection con = new SqlConnection(_connString);
                //        //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionDB"].ToString());
                //        con.Open();
                //        string query = "UspInsertPLColorBale";         //Stored Procedure name
                //        //cmd.Connection = conn;
                //        //cmd.CommandText = "UspConfirmWetBlueIssue";
                //        SqlCommand com = new SqlCommand(query, con);  //creating  SqlCommand  object
                //        com.CommandType = CommandType.StoredProcedure;  //here we declaring command type as stored Procedure

                //        com.Parameters.AddWithValue("@PLPIItemColorBaleNo", objEXPCIPIItemColor.PLPIItemColorBaleNo);
                //        com.Parameters.AddWithValue("@PLPIItemColorID", objEXPCIPIItemColor.PLPIItemColorID);
                //        com.Parameters.AddWithValue("@GradeID", objEXPCIPIItemColor.GradeID);
                //        com.Parameters.AddWithValue("@PcsInBale", objEXPCIPIItemColor.PcsInBale);
                //        com.Parameters.AddWithValue("@SideInBale", objEXPCIPIItemColor.SideInBale);
                //        com.Parameters.AddWithValue("@FootPLPIBaleQty", objEXPCIPIItemColor.FootPLPIBaleQty);
                //        com.Parameters.AddWithValue("@MeterPLPIBaleQty", objEXPCIPIItemColor.MeterPLPIBaleQty);
                //        com.Parameters.AddWithValue("@PLPIBaleNetWeight", objEXPCIPIItemColor.PLPIBaleNetWeight);
                //        com.Parameters.AddWithValue("@PLPIBGrossaleWeight", objEXPCIPIItemColor.PLPIBGrossaleWeight);
                //        com.Parameters.AddWithValue("@NetWeightUnit", objEXPCIPIItemColor.NetWeightUnit);
                //        com.Parameters.AddWithValue("@GrossBaleWeightUnit", objEXPCIPIItemColor.GrossBaleWeightUnit);
                //        com.Parameters.AddWithValue("@Remarks", objEXPCIPIItemColor.Remarks);

                //        com.ExecuteNonQuery();

                //        //EXP_PLPIItemColorBale tblEXPCIPIItemColor = SetToModelObject(objEXPCIPIItemColor, userid);
                //        //_context.EXP_PLPIItemColorBale.Add(tblEXPCIPIItemColor);
                //    }
                //    //}
                //}
                //#endregion

                #endregion
            }
            catch (Exception ex)
            {
                _vmMsg.Type = Enums.MessageType.Error;
                _vmMsg.Msg  = "Failed to save.";
                if (ex.InnerException.InnerException.Message.Contains("UNIQUE KEY"))
                {
                    _vmMsg.Type = Enums.MessageType.Error;
                    _vmMsg.Msg  = "Packinglist No Already Exit.";
                }
            }
            return(_vmMsg);
        }
示例#8
0
        public ValidationMsg Update(EXPPackingList model, int userid)
        {
            _vmMsg = new ValidationMsg();
            try
            {
                #region Update

                using (var tx = new TransactionScope())
                {
                    using (_context)
                    {
                        #region CI

                        EXP_PackingList CurrentEntity  = SetToModelObject(model, userid);
                        var             OriginalEntity = _context.EXP_PackingList.First(m => m.PLID == model.PLID);

                        //OriginalEntity.PLNo = CurrentEntity.PLNo;
                        OriginalEntity.PLDate          = CurrentEntity.PLDate;
                        OriginalEntity.CIID            = CurrentEntity.CIID;
                        OriginalEntity.BalesNo         = CurrentEntity.BalesNo;
                        OriginalEntity.BaleQty         = CurrentEntity.BaleQty;
                        OriginalEntity.TotalPcs        = CurrentEntity.TotalPcs;
                        OriginalEntity.TotalSide       = CurrentEntity.TotalSide;
                        OriginalEntity.MeterCIQty      = CurrentEntity.MeterCIQty;
                        OriginalEntity.FootCIQty       = CurrentEntity.FootCIQty;
                        OriginalEntity.PLNetWeight     = CurrentEntity.PLNetWeight;
                        OriginalEntity.NetWeightUnit   = CurrentEntity.NetWeightUnit;
                        OriginalEntity.PLGrossWeight   = CurrentEntity.PLGrossWeight;
                        OriginalEntity.GrossWeightUnit = CurrentEntity.GrossWeightUnit;
                        OriginalEntity.PLMarks         = CurrentEntity.PLMarks;
                        OriginalEntity.PLNote          = CurrentEntity.PLNote;
                        OriginalEntity.ModifiedBy      = userid;
                        OriginalEntity.ModifiedOn      = DateTime.Now;

                        #endregion

                        #region CIPI

                        //if (string.IsNullOrEmpty(model.PLNo))
                        if (model.EXPPLPIList[0].PLPIID == 0)
                        {
                            model.EXPPLPIList[0].PLID = model.PLID;
                            EXP_PLPI tblEXPPLPI = SetToModelObject(model.EXPPLPIList[0], userid);
                            _context.EXP_PLPI.Add(tblEXPPLPI);
                            _context.SaveChanges();
                            PLPIID = tblEXPPLPI.PLPIID;
                        }
                        else
                        {
                            PLPIID = model.EXPPLPIList[0].PLPIID;
                            EXP_PLPI CurrentCIPIEntity  = SetToModelObject(model.EXPPLPIList[0], userid);
                            var      OriginalCIPIEntity = _context.EXP_PLPI.First(m => m.PLPIID == PLPIID);

                            //OriginalCIPIEntity.PLID = CurrentCIPIEntity.PLID;
                            OriginalCIPIEntity.PIID            = CurrentCIPIEntity.PIID;
                            OriginalCIPIEntity.LCID            = CurrentCIPIEntity.LCID;
                            OriginalCIPIEntity.BuyerOrderID    = CurrentCIPIEntity.BuyerOrderID;
                            OriginalCIPIEntity.PLPIPcs         = CurrentCIPIEntity.PLPIPcs;
                            OriginalCIPIEntity.PLPISide        = CurrentCIPIEntity.PLPISide;
                            OriginalCIPIEntity.FootPLPIQty     = CurrentCIPIEntity.FootPLPIQty;
                            OriginalCIPIEntity.MeterPLPIQty    = CurrentCIPIEntity.MeterPLPIQty;
                            OriginalCIPIEntity.NetWeightUnit   = CurrentCIPIEntity.NetWeightUnit;
                            OriginalCIPIEntity.GrossWeightUnit = CurrentCIPIEntity.GrossWeightUnit;
                            OriginalCIPIEntity.PLPINetWeight   = CurrentCIPIEntity.PLPINetWeight;
                            OriginalCIPIEntity.PLPIGrossWeight = CurrentCIPIEntity.PLPIGrossWeight;
                            OriginalCIPIEntity.ModifiedBy      = userid;
                            OriginalCIPIEntity.ModifiedOn      = DateTime.Now;
                        }

                        #endregion

                        #region CIPIItem

                        if (model.EXPPLPIItemColorList != null)
                        {
                            foreach (EXPPLPIItemColor objEXPPLPIItemColor in model.EXPPLPIItemColorList)
                            {
                                if (objEXPPLPIItemColor.PLPIItemColorID == 0)
                                {
                                    objEXPPLPIItemColor.PLPIID = PLPIID;
                                    EXP_PLPIItemColor tblYearMonthScheduleDate = SetToModelObject(objEXPPLPIItemColor, userid);
                                    _context.EXP_PLPIItemColor.Add(tblYearMonthScheduleDate);
                                    _context.SaveChanges();
                                    PLPIItemColorID = tblYearMonthScheduleDate.PLPIItemColorID;
                                }
                                else
                                {
                                    PLPIItemColorID = objEXPPLPIItemColor.PLPIItemColorID;
                                    EXP_PLPIItemColor CurrEntity = SetToModelObject(objEXPPLPIItemColor, userid);
                                    var OrgrEntity = _context.EXP_PLPIItemColor.First(m => m.PLPIItemColorID == objEXPPLPIItemColor.PLPIItemColorID);

                                    ////OrgrEntity.PLPIID = CurrEntity.PLPIID;
                                    //OrgrEntity.Commodity = CurrEntity.Commodity;
                                    //OrgrEntity.ArticleID = CurrEntity.ArticleID;
                                    //OrgrEntity.ArticleNo = CurrEntity.ArticleNo;
                                    //OrgrEntity.ItemTypeID = CurrEntity.ItemTypeID;
                                    //OrgrEntity.LeatherTypeID = CurrEntity.LeatherTypeID;
                                    //OrgrEntity.LeatherStatusID = CurrEntity.LeatherStatusID;
                                    //OrgrEntity.MaterialNo = CurrEntity.MaterialNo;
                                    //OrgrEntity.AvgSize = CurrEntity.AvgSize;
                                    //OrgrEntity.SideDescription = CurrEntity.SideDescription;
                                    //OrgrEntity.SelectionRange = CurrEntity.SelectionRange;
                                    //OrgrEntity.Thickness = CurrEntity.Thickness;
                                    //OrgrEntity.ThicknessAt = CurrEntity.ThicknessAt;
                                    //OrgrEntity.MeterCIQty = CurrEntity.MeterCIQty;
                                    //OrgrEntity.MeterUnitPrice = CurrEntity.MeterUnitPrice;
                                    //OrgrEntity.MeterTotalPrice = CurrEntity.MeterTotalPrice;
                                    //OrgrEntity.FootCIQty = CurrEntity.FootCIQty;
                                    //OrgrEntity.FootUnitPrice = CurrEntity.FootUnitPrice;
                                    //OrgrEntity.FootTotalPrice = CurrEntity.FootTotalPrice;
                                    //OrgrEntity.PackQty = CurrEntity.PackQty;
                                    //OrgrEntity.Remarks = CurrEntity.Remarks;
                                    OrgrEntity.ModifiedBy = userid;
                                    OrgrEntity.ModifiedOn = DateTime.Now;
                                }
                            }
                        }

                        #endregion

                        #region CIPIItemColor

                        if (model.EXPPLPIItemColorBaleList != null)
                        {
                            //if ((objEXPPLPIItemColor.ArticleID == model.EXPPLPIItemColorBaleList[0].ArticleID) && (objEXPPLPIItemColor.ColorID == model.EXPPLPIItemColorBaleList[0].ColorID))
                            //{
                            foreach (EXPPLPIItemColorBale objEXPCIPIItemColor in model.EXPPLPIItemColorBaleList)
                            {
                                if (objEXPCIPIItemColor.PLPIItemColorBaleID == 0)
                                {
                                    objEXPCIPIItemColor.PLPIItemColorID = PLPIItemColorID;
                                    //objEXPCIPIItemColor.MaterialNo = objEXPPLPIItemColor.MaterialNo;

                                    //objEXPCIPIItemColor.AvgSize = objEXPPLPIItemColor.AvgSize;
                                    //if (string.IsNullOrEmpty(objEXPPLPIItemColor.AvgSizeUnitName))
                                    //    objEXPCIPIItemColor.AvgSizeUnit = null;
                                    //else
                                    //    objEXPCIPIItemColor.AvgSizeUnit = Convert.ToByte(_context.Sys_Unit.Where(m => m.UnitName == objEXPPLPIItemColor.AvgSizeUnitName).FirstOrDefault().UnitID);
                                    //objEXPCIPIItemColor.SideDescription = objEXPPLPIItemColor.SideDescription;
                                    //objEXPCIPIItemColor.SelectionRange = objEXPPLPIItemColor.SelectionRange;
                                    //objEXPCIPIItemColor.Thickness = objEXPPLPIItemColor.Thickness;
                                    //if (string.IsNullOrEmpty(objEXPPLPIItemColor.ThicknessUnitName))
                                    //    objEXPCIPIItemColor.ThicknessUnit = null;
                                    //else
                                    //    objEXPCIPIItemColor.ThicknessUnit = Convert.ToByte(_context.Sys_Unit.Where(m => m.UnitName == objEXPPLPIItemColor.ThicknessUnitName).FirstOrDefault().UnitID);
                                    //objEXPCIPIItemColor.ThicknessAt = objEXPPLPIItemColor.ThicknessAt;

                                    EXP_PLPIItemColorBale tblEXPCIPIItemColor = SetToModelObject(objEXPCIPIItemColor, userid);
                                    _context.EXP_PLPIItemColorBale.Add(tblEXPCIPIItemColor);
                                }
                                else
                                {
                                    EXP_PLPIItemColorBale CurrEntity = SetToModelObject(objEXPCIPIItemColor, userid);
                                    var OrgrEntity = _context.EXP_PLPIItemColorBale.First(m => m.PLPIItemColorBaleID == objEXPCIPIItemColor.PLPIItemColorBaleID);

                                    OrgrEntity.PLPIItemColorBaleNo = CurrEntity.PLPIItemColorBaleNo;
                                    OrgrEntity.GradeID             = CurrEntity.GradeID;
                                    OrgrEntity.PcsInBale           = CurrEntity.PcsInBale;
                                    OrgrEntity.SideInBale          = CurrEntity.SideInBale;
                                    OrgrEntity.FootPLPIBaleQty     = CurrEntity.FootPLPIBaleQty;
                                    OrgrEntity.MeterPLPIBaleQty    = CurrEntity.MeterPLPIBaleQty;
                                    OrgrEntity.NetWeightUnit       = CurrEntity.NetWeightUnit;
                                    OrgrEntity.GrossBaleWeightUnit = CurrEntity.GrossBaleWeightUnit;
                                    OrgrEntity.PLPIBaleNetWeight   = CurrEntity.PLPIBaleNetWeight;
                                    OrgrEntity.PLPIBGrossaleWeight = CurrEntity.PLPIBGrossaleWeight;
                                }
                            }
                            //}
                        }
                        #endregion

                        _context.SaveChanges();
                        tx.Complete();
                        PLID        = model.PLID;
                        PLNo        = model.PLNo;
                        _vmMsg.Type = Enums.MessageType.Update;
                        _vmMsg.Msg  = "Updated Successfully.";
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                _vmMsg.Type = Enums.MessageType.Error;
                _vmMsg.Msg  = "Failed to Update.";

                if (ex.InnerException.InnerException.Message.Contains("UNIQUE KEY"))
                {
                    _vmMsg.Type = Enums.MessageType.Error;
                    _vmMsg.Msg  = "Packinglist No Already Exit.";
                }
            }
            return(_vmMsg);
        }