Пример #1
0
        public ActionResult Save(CnFBill dataSet)
        {
            _userId = Convert.ToInt32(Session["UserID"]);

            objValMssg = objDalLCMCnFBillInfo.SaveLCM_CnFBill(dataSet, _userId, "CnFBills/CnFBills");
            return(Json(new { msg = objValMssg }));
        }
Пример #2
0
        public ActionResult GetCnFBillInfoByCnfBillID(string CnfBillID)
        {
            int         id      = Convert.ToInt32(CnfBillID);
            LCM_CnfBill dataSet = objRepository.LcmCnFBillRpository.GetByID(id);

            CnFBill ob = new CnFBill();

            ob.LCID          = dataSet.LCID;
            ob.LCNo          = dataSet.LCNo;
            ob.CIID          = dataSet.CIID;
            ob.CINo          = dataSet.CINo;
            ob.CnfBillID     = dataSet.CnfBillID;
            ob.CnfBillDate   = dataSet.CnfBillDate == null ? "" : Convert.ToDateTime(dataSet.CnfBillDate).ToString("dd/MM/yyyy");
            ob.CnfBillNote   = dataSet.CnfBillNote == null ? "" : dataSet.CnfBillNote;
            ob.CnfBillNo     = dataSet.CnfBillNo;
            ob.RefCnfBillNo  = dataSet.RefCnfBillNo;
            ob.Address       = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().Address;
            ob.EmailAddress  = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().EmailAddress;
            ob.ContactPerson = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().ContactPerson;
            ob.ContactNumber = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().ContactNumber;
            ob.PhoneNo       = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().PhoneNo;


            ob.DutyAccountCharge     = (decimal)dataSet.DutyAccountCharge == null ? 0 : (decimal)dataSet.DutyAccountCharge;
            ob.CnfAgentID            = dataSet.CnfAgentID == null ? 0 : dataSet.CnfAgentID;
            ob.PortCharge            = (decimal)dataSet.PortCharge == null ? 0 : (decimal)dataSet.PortCharge;
            ob.NOCCharge             = (decimal)dataSet.NOCCharge == null ? 0 : (decimal)dataSet.NOCCharge;
            ob.BerthOperatorCharge   = (decimal)dataSet.BerthOperatorCharge == null ? 0 : (decimal)dataSet.BerthOperatorCharge;
            ob.AmendmentCharge       = (decimal)dataSet.AmendmentCharge == null ? 0 : (decimal)dataSet.AmendmentCharge;
            ob.AgencyCommission      = dataSet.AgencyCommission == null ? 0 : (decimal)dataSet.AgencyCommission;
            ob.ChemicalTestCharge    = (decimal)dataSet.ChemicalTestCharge == null ? 0 : (decimal)dataSet.ChemicalTestCharge;
            ob.ExamineCharge         = (decimal)dataSet.ExamineCharge == null ? 0 : (decimal)dataSet.ExamineCharge;
            ob.SpecialDeliveryCharge = (decimal)dataSet.SpecialDeliveryCharge == null ? 0 : (decimal)dataSet.SpecialDeliveryCharge;
            ob.ShippingCharge        = (decimal)dataSet.ShippingCharge == null ? 0 : (decimal)dataSet.ShippingCharge;
            ob.StampCharge           = (decimal)dataSet.StampCharge == null ? 0 : (decimal)dataSet.StampCharge;
            //ob.BLVerifyCharge = (decimal)dataSet.BLVerifyCharge == null ? 0 : (decimal)dataSet.BLVerifyCharge;OtherCharge

            if (dataSet.BLVerifyCharge != 0)
            {
                ob.BLVerifyCharge = dataSet.BLVerifyCharge;
            }
            else
            {
                ob.BLVerifyCharge = 0;
            }



            if (dataSet.OtherCharge != 0)
            {
                ob.OtherCharge = dataSet.OtherCharge;
            }
            else
            {
                ob.OtherCharge = 0;
            }

            ob.TotalAmount      = (decimal)dataSet.TotalAmount == null ? 0 : (decimal)dataSet.TotalAmount;
            ob.BillOfEntryNo    = dataSet.BillOfEntryNo;
            ob.BillOfEntryDate  = dataSet.BillOfEntryDate == null ? "" : Convert.ToDateTime(dataSet.BillOfEntryDate).ToString("dd/MM/yyyy");
            ob.AssesmentValue   = Convert.ToDecimal(dataSet.AssesmentValue);
            ob.CnfBillCurrency  = dataSet.CnfBillCurrency;
            ob.BillOfEntryNo    = (string)dataSet.BillOfEntryNo;
            ob.ExchangeCurrency = (byte)(dataSet.ExchangeCurrency);
            ob.ExchangeRate     = (byte)dataSet.ExchangeRate;
            ob.ExchangeValue    = (decimal)dataSet.ExchangeValue;
            ob.RecordStatus     = dataSet.RecordStatus;
            ob.Remarks          = dataSet.Remarks;
            ob.BuyerID          = objRepository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerID;
            ob.BuyerCode        = objRepository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerCode;
            ob.BuyerName        = objRepository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerName;
            ob.PINo             = objRepository.LCOpeningRepository.GetByID(dataSet.LCID).PINo;

            return(Json(ob, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ValidationMsg SaveLCM_CnFBill(CnFBill dataSet, int _userId, string pageUrl)
        {
            try
            {
                LCM_CnfBill obLcCnFBill = new LCM_CnfBill();

                obLcCnFBill.LCID = dataSet.LCID;
                obLcCnFBill.LCNo = dataSet.LCNo == null ? "" : dataSet.LCNo;//DalCommon.GetPreDefineNextCodeByUrl(pageUrl);

                obLcCnFBill.CIID = dataSet.CIID;
                obLcCnFBill.CINo = dataSet.CINo == null ? "" : dataSet.CINo;


                obLcCnFBill.CnfBillID = dataSet.CnfBillID;
                //obLcCnFBill.CnfBillNo = dataSet.CnfBillNo==null?"":dataSet.CnfBillNo;
                obLcCnFBill.CnfBillNo    = DalCommon.GetPreDefineNextCodeByUrl(pageUrl);
                obLcCnFBill.RefCnfBillNo = dataSet.RefCnfBillNo == null ? "" : dataSet.RefCnfBillNo;
                obLcCnFBill.CnfBillDate  = dataSet.CnfBillDate == null ? (DateTime?)null : DalCommon.SetDate(dataSet.CnfBillDate);
                obLcCnFBill.CnfBillNote  = dataSet.CnfBillNote == null ? "" : (string)dataSet.CnfBillNote;

                obLcCnFBill.DutyAccountCharge     = dataSet.DutyAccountCharge == null ? 0 : (decimal)dataSet.DutyAccountCharge;
                obLcCnFBill.CnfAgentID            = dataSet.CnfAgentID == null ? 0 : obEntity.Sys_Buyer.Where(m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().BuyerID; //dataSet.CnfAgentID;
                obLcCnFBill.PortCharge            = dataSet.PortCharge == null ? 0 : (decimal)dataSet.PortCharge;
                obLcCnFBill.NOCCharge             = dataSet.NOCCharge == null ? 0 : (decimal)dataSet.NOCCharge;
                obLcCnFBill.BerthOperatorCharge   = dataSet.BerthOperatorCharge == null ? 0 : (decimal)dataSet.BerthOperatorCharge;
                obLcCnFBill.AmendmentCharge       = dataSet.AmendmentCharge == null ? 0 : (decimal)dataSet.AmendmentCharge;
                obLcCnFBill.AgencyCommission      = dataSet.AgencyCommission == null ? 0 : (decimal)dataSet.AgencyCommission;
                obLcCnFBill.ChemicalTestCharge    = dataSet.ChemicalTestCharge == null ? 0 : (decimal)dataSet.ChemicalTestCharge;
                obLcCnFBill.ExamineCharge         = dataSet.ExamineCharge == null ? 0 : (decimal)dataSet.ExamineCharge;
                obLcCnFBill.SpecialDeliveryCharge = dataSet.SpecialDeliveryCharge == null ? 0 : (decimal)dataSet.SpecialDeliveryCharge;
                obLcCnFBill.ShippingCharge        = dataSet.ShippingCharge == null ? 0 : (decimal)dataSet.ShippingCharge;
                obLcCnFBill.StampCharge           = dataSet.StampCharge == null ? 0 : (decimal)dataSet.StampCharge;
                obLcCnFBill.BLVerifyCharge        = dataSet.BLVerifyCharge == null ? 0 : (decimal)dataSet.BLVerifyCharge; //OtherCharge
                obLcCnFBill.OtherCharge           = dataSet.OtherCharge == null ? 0 : (decimal)dataSet.OtherCharge;       //
                obLcCnFBill.TotalAmount           = dataSet.TotalAmount == null ? 0 : (decimal)dataSet.TotalAmount;       //(decimal)dataSet.TotalAmount;
                obLcCnFBill.BillOfEntryNo         = dataSet.BillOfEntryNo == null ? "" : dataSet.BillOfEntryNo;;
                obLcCnFBill.BillOfEntryDate       = dataSet.BillOfEntryDate == null ? (DateTime?)null : DalCommon.SetDate(dataSet.BillOfEntryDate);
                obLcCnFBill.AssesmentValue        = dataSet.AssesmentValue == null ? 0 : (decimal)dataSet.AssesmentValue;//Convert.ToDecimal(dataSet.AssesmentValue)==null? 0 :dataSet.AssesmentValue;
                obLcCnFBill.CnfBillCurrency       = dataSet.CnfBillCurrency == null ? 0 : dataSet.CnfBillCurrency;
                obLcCnFBill.BillOfEntryNo         = (string)dataSet.BillOfEntryNo == null ? "" : dataSet.BillOfEntryNo;
                obLcCnFBill.ExchangeCurrency      = (byte)(dataSet.ExchangeCurrency) == null ? 0 : dataSet.ExchangeCurrency;
                obLcCnFBill.ExchangeRate          = dataSet.ExchangeRate == null ? 0 : (decimal)dataSet.ExchangeRate;
                obLcCnFBill.ExchangeValue         = dataSet.ExchangeValue == null ? 0 : (decimal)dataSet.ExchangeValue;
                obLcCnFBill.RecordStatus          = "NCF";
                obLcCnFBill.Remarks = dataSet.Remarks == null ? "" : dataSet.Remarks;


                obLcCnFBill.SetOn = DateTime.Now;

                obLcCnFBill.SetBy      = 1;
                obLcCnFBill.ModifiedOn = DateTime.Now;
                obLcCnFBill.ModifiedBy = _userId;
                obLcCnFBill.IPAddress  = GetIPAddress.LocalIPAddress();
                obEntity.LCM_CnfBill.Add(obLcCnFBill);
                int flag = obEntity.SaveChanges();
                if (flag == 1)
                {
                    //_vmMsg.ReturnId =  repository.LcmCnFBillRpository.Get().Last().CnfBillID;//dataSet.CnfBillID;
                    _vmMsg.ReturnCode = obLcCnFBill.CnfBillNo;
                    _vmMsg.Type       = Enums.MessageType.Success;
                    _vmMsg.Msg        = "Saved Successfully.";
                }
                else
                {
                    _vmMsg.Type = Enums.MessageType.Error;
                    _vmMsg.Msg  = "Saved Faild.";
                }
            }
            catch (DbEntityValidationException e)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var eve in e.EntityValidationErrors)
                {
                    sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                eve.Entry.Entity.GetType().Name,
                                                eve.Entry.State));
                    foreach (var ve in eve.ValidationErrors)
                    {
                        sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                    ve.PropertyName,
                                                    ve.ErrorMessage));
                    }
                }
                throw new DbEntityValidationException(sb.ToString(), e);
            }
            return(_vmMsg);
        }
Пример #4
0
        public ActionResult GetCnFBillInfoByCnfBillID(string CnfBillID)
        {
            int         id      = Convert.ToInt32(CnfBillID);
            LCM_CnfBill dataSet = objRepository.LcmCnFBillRpository.GetByID(id);

            CnFBill ob = new CnFBill();

            ob.LCID = dataSet.LCID;
            ob.LCNo = dataSet.LCNo;

            ob.CIID = dataSet.CIID;
            ob.CINo = dataSet.CINo;

            ob.CnfBillID     = dataSet.CnfBillID;
            ob.CnfBillNo     = dataSet.CnfBillNo;
            ob.Address       = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().Address;
            ob.EmailAddress  = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().EmailAddress;
            ob.ContactPerson = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().ContactPerson;
            ob.ContactNumber = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().ContactNumber;
            ob.PhoneNo       = objRepository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().PhoneNo;

            ob.CnfBillID   = dataSet.CnfBillID;
            ob.CnfBillDate = Convert.ToDateTime(dataSet.CnfBillDate).ToString("dd/MM/yyyy");
            ob.CnfBillNote = dataSet.CnfBillNote == null ? "" : dataSet.CnfBillNote;

            ob.DutyAccountCharge     = (decimal)dataSet.DutyAccountCharge == null ? 0 : (decimal)dataSet.DutyAccountCharge;
            ob.CnfAgentID            = dataSet.CnfAgentID == null ? 0 : dataSet.CnfAgentID;
            ob.PortCharge            = (decimal)dataSet.PortCharge == null ? 0 : (decimal)dataSet.PortCharge;
            ob.NOCCharge             = (decimal)dataSet.NOCCharge == null ? 0 : (decimal)dataSet.NOCCharge;
            ob.BerthOperatorCharge   = (decimal)dataSet.BerthOperatorCharge == null ? 0 : (decimal)dataSet.BerthOperatorCharge;
            ob.AmendmentCharge       = (decimal)dataSet.AmendmentCharge == null ? 0 : (decimal)dataSet.AmendmentCharge;
            ob.AgencyCommission      = dataSet.AgencyCommission == null ? 0 : (decimal)dataSet.AgencyCommission;
            ob.ChemicalTestCharge    = (decimal)dataSet.ChemicalTestCharge == null ? 0 : (decimal)dataSet.ChemicalTestCharge;
            ob.ExamineCharge         = (decimal)dataSet.ExamineCharge == null ? 0 : (decimal)dataSet.ExamineCharge;
            ob.SpecialDeliveryCharge = (decimal)dataSet.SpecialDeliveryCharge == null ? 0 : (decimal)dataSet.SpecialDeliveryCharge;
            ob.ShippingCharge        = (decimal)dataSet.ShippingCharge == null ? 0 : (decimal)dataSet.ShippingCharge;
            ob.StampCharge           = (decimal)dataSet.StampCharge == null ? 0 : (decimal)dataSet.StampCharge;
            ob.TotalAmount           = (decimal)dataSet.TotalAmount == null ? 0 : (decimal)dataSet.TotalAmount;
            ob.BillOfEntryNo         = dataSet.BillOfEntryNo;
            ob.BillOfEntryDate       = Convert.ToDateTime(dataSet.BillOfEntryDate).ToString("dd/MM/yyyy");
            ob.AssesmentValue        = Convert.ToDecimal(dataSet.AssesmentValue);
            ob.CnfBillCurrency       = dataSet.CnfBillCurrency;
            ob.BillOfEntryNo         = (string)dataSet.BillOfEntryNo;
            ob.ExchangeCurrency      = (byte)(dataSet.ExchangeCurrency);
            ob.ExchangeRate          = (byte)dataSet.ExchangeRate;
            ob.ExchangeValue         = (decimal)dataSet.ExchangeValue;
            ob.RecordStatus          = dataSet.RecordStatus;
            ob.Remarks   = dataSet.Remarks;
            ob.BuyerID   = objRepository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerID;
            ob.BuyerCode = objRepository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerCode;
            ob.BuyerName = objRepository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerName;

            //var abc = objRepository.BuyerAddressRepository.GetByID(dataSet.CnfAgentID);
            //if (abc == null)
            //{
            //    ob.Address = "";
            //}
            //else
            //{
            //    ob.Address = abc.ToString();

            //}
            //  ob.Address = objRepository.BuyerAddressRepository.GetByID(dataSet.CnfAgentID).Address;


            //var abc =
            //   _context.Sys_SupplierAddress.Where(
            //       q => q.SupplierID == Entity.SupplierID && q.IsActive.Equals(true) && q.IsDelete.Equals(false))
            //       .FirstOrDefault();
            //if (abc != null)
            //{
            //    model.Address = _context.Sys_SupplierAddress.Where(q => q.SupplierID == Entity.SupplierID && q.IsActive.Equals(true) && q.IsDelete.Equals(false)).FirstOrDefault().Address;
            //}

            ob.PINo = objRepository.LCOpeningRepository.GetByID(dataSet.LCID).PINo;

            //obLcLimInfo.ExchangeValue = dataSet.ExchangeValue == null ? 0 : (decimal)dataSet.ExchangeValue;

            return(Json(ob, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public ValidationMsg UpdateLCM_CnFBill(CnFBill dataSet, int _userId)
        {
            try
            {
                LCM_CnfBill obLcCnFBill = repository.LcmCnFBillRpository.GetByID(dataSet.CnfBillID);

                if (!obLcCnFBill.RecordStatus.Equals("CNF"))
                {
                    obLcCnFBill.LCID = dataSet.LCID;
                    obLcCnFBill.LCNo = dataSet.LCNo;

                    obLcCnFBill.CIID = dataSet.CIID;
                    obLcCnFBill.CINo = dataSet.CINo;

                    obLcCnFBill.CnfBillID    = dataSet.CnfBillID;
                    obLcCnFBill.RefCnfBillNo = dataSet.RefCnfBillNo;
                    obLcCnFBill.CnfBillNo    = dataSet.CnfBillNo;
                    obLcCnFBill.CnfBillDate  = DalCommon.SetDate(dataSet.CnfBillDate);
                    obLcCnFBill.CnfBillNote  = dataSet.CnfBillNote;

                    obLcCnFBill.DutyAccountCharge     = dataSet.DutyAccountCharge;
                    obLcCnFBill.CnfAgentID            = dataSet.CnfAgentID; //Convert.ToInt32(dataSet.CnfAgentID);
                    obLcCnFBill.PortCharge            = dataSet.PortCharge;
                    obLcCnFBill.NOCCharge             = dataSet.NOCCharge;
                    obLcCnFBill.BerthOperatorCharge   = dataSet.BerthOperatorCharge;
                    obLcCnFBill.AmendmentCharge       = dataSet.AmendmentCharge;
                    obLcCnFBill.AgencyCommission      = dataSet.AgencyCommission;
                    obLcCnFBill.ChemicalTestCharge    = dataSet.ChemicalTestCharge;
                    obLcCnFBill.ExamineCharge         = dataSet.ExamineCharge;
                    obLcCnFBill.SpecialDeliveryCharge = dataSet.SpecialDeliveryCharge;
                    obLcCnFBill.ShippingCharge        = dataSet.ShippingCharge;
                    obLcCnFBill.StampCharge           = dataSet.StampCharge;
                    obLcCnFBill.BLVerifyCharge        = dataSet.BLVerifyCharge;
                    obLcCnFBill.OtherCharge           = dataSet.OtherCharge;

                    obLcCnFBill.TotalAmount      = dataSet.TotalAmount;
                    obLcCnFBill.BillOfEntryNo    = dataSet.BillOfEntryNo;
                    obLcCnFBill.BillOfEntryDate  = DalCommon.SetDate(dataSet.BillOfEntryDate);
                    obLcCnFBill.AssesmentValue   = Convert.ToDecimal(dataSet.AssesmentValue);
                    obLcCnFBill.CnfBillCurrency  = dataSet.CnfBillCurrency;
                    obLcCnFBill.BillOfEntryNo    = dataSet.BillOfEntryNo;
                    obLcCnFBill.ExchangeCurrency = dataSet.ExchangeCurrency;
                    obLcCnFBill.ExchangeRate     = dataSet.ExchangeRate;
                    obLcCnFBill.ExchangeValue    = dataSet.ExchangeValue;
                    obLcCnFBill.Remarks          = dataSet.Remarks;


                    obLcCnFBill.ModifiedOn = DateTime.Now;
                    obLcCnFBill.ModifiedBy = _userId;
                    obLcCnFBill.IPAddress  = GetIPAddress.LocalIPAddress();

                    repository.LcmCnFBillRpository.Update(obLcCnFBill);
                    int flag = repository.Save();
                    if (flag == 1)
                    {
                        _vmMsg.Type = Enums.MessageType.Success;
                        _vmMsg.Msg  = "Updated Successfully.";
                    }
                    else
                    {
                        _vmMsg.Type = Enums.MessageType.Error;
                        _vmMsg.Msg  = "Update Faild.";
                    }
                }
                else
                {
                    _vmMsg.Type = Enums.MessageType.Error;
                    _vmMsg.Msg  = "Data already confirmed. You can't update this.";
                }
            }
            catch (DbEntityValidationException e)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var eve in e.EntityValidationErrors)
                {
                    sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                eve.Entry.Entity.GetType().Name,
                                                eve.Entry.State));
                    foreach (var ve in eve.ValidationErrors)
                    {
                        sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                    ve.PropertyName,
                                                    ve.ErrorMessage));
                    }
                }
                throw new DbEntityValidationException(sb.ToString(), e);
            }
            return(_vmMsg);
        }