public ActionResult Save(EXP_CnFBill dataSet) { _userId = Convert.ToInt32(Session["UserID"]); _vmMsg = objDalEXPCnfBill.Save(dataSet, _userId, "EXPCnfBill/EXPCnfBill"); return(Json(new { msg = _vmMsg })); }
// ##################### Search END ############## public ActionResult ConfirmRecordStatus(string cnfBillID) { try { if (cnfBillID != "") { EXP_CnFBill ob = repository.ExpCnfBill.GetByID(Convert.ToInt32(cnfBillID)); if (ob.RecordStatus == "NCF") { ob.RecordStatus = "CNF"; repository.ExpCnfBill.Update(ob); int flag = repository.Save(); if (flag == 1) { _vmMsg.Type = Enums.MessageType.Success; _vmMsg.Msg = "Confirmed Successfully."; } else { _vmMsg.Type = Enums.MessageType.Error; _vmMsg.Msg = "Confirmed Faild."; } } else { _vmMsg.Type = Enums.MessageType.Error; _vmMsg.Msg = "Record Status has not found."; } } } 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(Json(new { msg = _vmMsg })); }
public ValidationMsg Update(EXP_CnFBill dataSet, int _userId) { try { EXP_CnFBill obLcCnFBill = repository.ExpCnfBill.GetByID(dataSet.CnfBillID); obLcCnFBill.CnfBillID = dataSet.CnfBillID; obLcCnFBill.CnfBillNo = dataSet.CnfBillNo; obLcCnFBill.RefCnfBillNo = dataSet.RefCnfBillNo; obLcCnFBill.CnfBillDate = dataSet.CnfBillDate; obLcCnFBill.CIID = dataSet.CIID; obLcCnFBill.PLID = dataSet.PLID; obLcCnFBill.BillOfEntryNo = dataSet.BillOfEntryNo; obLcCnFBill.BillOfEntryDate = dataSet.BillOfEntryDate; obLcCnFBill.AssesmentValue = Convert.ToDecimal(dataSet.AssesmentValue); obLcCnFBill.CnfBillNote = dataSet.CnfBillNote; obLcCnFBill.CnfAgentID = dataSet.CnfAgentID; //Convert.ToInt32(dataSet.CnfAgentID); obLcCnFBill.DutyAccountCharge = dataSet.DutyAccountCharge; obLcCnFBill.PortCharge = dataSet.PortCharge; obLcCnFBill.ShippingCharge = dataSet.ShippingCharge; obLcCnFBill.BerthOperatorCharge = dataSet.BerthOperatorCharge; obLcCnFBill.NOCCharge = dataSet.NOCCharge; obLcCnFBill.ExamineCharge = dataSet.ExamineCharge; obLcCnFBill.SpecialDeliveryCharge = dataSet.SpecialDeliveryCharge; obLcCnFBill.AmendmentCharge = dataSet.AmendmentCharge; obLcCnFBill.ChemicalTestCharge = dataSet.ChemicalTestCharge; obLcCnFBill.AgencyCommission = dataSet.AgencyCommission; obLcCnFBill.StampCharge = dataSet.StampCharge; obLcCnFBill.TotalAmount = dataSet.TotalAmount; obLcCnFBill.CnfBillCurrency = dataSet.CnfBillCurrency; obLcCnFBill.ExchangeCurrency = dataSet.ExchangeCurrency; obLcCnFBill.ExchangeRate = dataSet.ExchangeRate; obLcCnFBill.ExchangeValue = dataSet.ExchangeValue; obLcCnFBill.BillOfEntryNo = dataSet.BillOfEntryNo; obLcCnFBill.RecordStatus = "NCF"; obLcCnFBill.ModifiedOn = DateTime.Now; obLcCnFBill.ModifiedBy = _userId; obLcCnFBill.IPAddress = GetIPAddress.LocalIPAddress(); repository.ExpCnfBill.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."; } } catch (DbEntityValidationException e) { _vmMsg.Type = Enums.MessageType.Delete; _vmMsg.Msg = "Update Faild."; } return(_vmMsg); }
public ActionResult GetCnFBillInfoByCnfBillID(string CnfBillID) { int id = Convert.ToInt32(CnfBillID); EXP_CnFBill dataSet = repository.ExpCnfBill.GetByID(id); EXPCnfBill ob = new EXPCnfBill(); //ob.LCID = LC.LC//dataSet.LCID; //ob.LCNo = repository.EXPCommercialInvoicePIRepository.Get(filter: m => m.CIID == dataSet.CIID).FirstOrDefault().LCN;//dataSet.LCNo; ob.CIID = dataSet.CIID; ob.CIRefNo = repository.ExpCommercialInvoiceRepository.Get(filter: m => m.CIID == dataSet.CIID).FirstOrDefault().CIRefNo; //dataSet.CINo; ob.BalesNo = repository.ExpPackingListRepository.Get(filter: m => m.CIID == (dataSet.CIID == null ? 0 : dataSet.CIID)).FirstOrDefault().BalesNo; //dataSet.CINo; ob.TotalBales = repository.ExpPackingListRepository.Get(filter: m => m.CIID == (dataSet.CIID == null ? 0 : dataSet.CIID)).FirstOrDefault().BaleQty; //dataSet.CINo; ob.PLID = dataSet.PLID; ob.PLNo = repository.ExpPackingListRepository.Get(filter: m => m.PLID == dataSet.PLID).FirstOrDefault().PLNo; ob.CnfBillID = dataSet.CnfBillID; ob.CnfBillNo = dataSet.CnfBillNo;// ob.RefCnfBillNo = dataSet.RefCnfBillNo; ob.Address = repository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().Address; ob.EmailAddress = repository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().EmailAddress; ob.ContactPerson = repository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().ContactPerson; ob.ContactNumber = repository.BuyerAddressRepository.Get(filter: m => m.BuyerID == dataSet.CnfAgentID).FirstOrDefault().ContactNumber; ob.PhoneNo = repository.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.BLVerifyCharge = (decimal)dataSet.BLVerifyCharge == null ? 0 : (decimal)dataSet.BLVerifyCharge; 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 = repository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerID; ob.BuyerCode = repository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerCode; ob.BuyerName = repository.SysBuyerRepository.GetByID(dataSet.CnfAgentID).BuyerName; return(Json(ob, JsonRequestBehavior.AllowGet)); }
public ValidationMsg Save(EXP_CnFBill dataSet, int _userId, string pageUrl) { try { EXP_CnFBill obLcCnFBill = new EXP_CnFBill(); //obLcCnFBill.LCID = dataSet.LCID; //obLcCnFBill.LCNo = dataSet.LCNo == null ? "" : dataSet.LCNo;//DalCommon.GetPreDefineNextCodeByUrl(pageUrl); obLcCnFBill.CIID = dataSet.CIID; obLcCnFBill.PLID = dataSet.PLID; obLcCnFBill.CnfBillID = dataSet.CnfBillID; obLcCnFBill.CnfBillNo = dataSet.CnfBillNo == null ? "" : (string)dataSet.CnfBillNo; obLcCnFBill.RefCnfBillNo = dataSet.RefCnfBillNo == null ? "" : (string)dataSet.RefCnfBillNo; obLcCnFBill.CnfBillDate = 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 : dataSet.CnfAgentID;//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.TotalAmount = dataSet.TotalAmount == null ? 0 : (decimal)dataSet.TotalAmount; //(decimal)dataSet.TotalAmount; obLcCnFBill.BillOfEntryNo = dataSet.BillOfEntryNo == null ? "" : dataSet.BillOfEntryNo;; obLcCnFBill.BillOfEntryDate = 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; obLcCnFBill.SetOn = DateTime.Now; obLcCnFBill.SetBy = 1; obLcCnFBill.IPAddress = GetIPAddress.LocalIPAddress(); obEntity.EXP_CnFBill.Add(obLcCnFBill); int flag = obEntity.SaveChanges(); if (flag == 1) { _vmMsg.ReturnId = repository.LcmCnFBillRpository.Get().Last().CnfBillID;//dataSet.CnfBillID; _vmMsg.ReturnCode = repository.LcmCnFBillRpository.GetByID(_vmMsg.ReturnId).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); }