// ##################### END of Bank Pop UP ############## public ActionResult Save(LCM_LimInfo dataSet) { _userId = Convert.ToInt32(Session["UserID"]); objValMssg = objDalLCM_LimInfo.SaveLCM_LimInfo(dataSet, "LimInfo/LimInfo", _userId); return(Json(new { msg = objValMssg })); }
public ActionResult UpdateRecordStatus(string remarks, string limID) { try { if ((remarks != "" && limID != "")) { LCM_LimInfo ob = objRepository.LimInfoRepository.GetByID(Convert.ToInt32(limID)); // ob.ApprovalAdvice = note; ob.RecordStatus = "NCF"; objRepository.LimInfoRepository.Update(ob); int flag = objRepository.Save(); if (flag == 1) { objValMssg.Type = Enums.MessageType.Success; objValMssg.Msg = "Confirmed Successfully."; } else { objValMssg.Type = Enums.MessageType.Error; objValMssg.Msg = "Confirme Faild."; } } else { objValMssg.Type = Enums.MessageType.Error; objValMssg.Msg = "Data Save First Before Checked."; } } 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 = objValMssg })); }
// ##################### Search END ############## public ActionResult GetLcDetailsLimInfoByLimId(string LimID)//to bring data from grid to main page.....use { int limId = Convert.ToInt32(LimID); var limInfo = objRepository.LimInfoRepository.GetByID(limId); LCM_LimInfo ob = new LCM_LimInfo(); if (limInfo != null) { ob.LimID = limInfo.LimID; ob.LimNo = limInfo.LimNo; ob.LimLimit = limInfo.LimLimit; ob.LimBalance = limInfo.LimBalance; ob.LCID = limInfo.LCID; ob.LCNo = limInfo.LCNo; ob.LimCurrency = limInfo.Sys_Currency.CurrencyID; ob.ExchangeCurrency = limInfo.ExchangeCurrency; ob.ExchangeRate = Convert.ToDecimal(limInfo.ExchangeRate); ob.ExchangeValue = Convert.ToDecimal(limInfo.ExchangeValue); ob.LoanAmount = limInfo.LoanAmount; ob.InterestPersent = limInfo.InterestPersent; ob.InterestAmount = limInfo.InterestAmount; ob.AmountToBePaid = limInfo.AmountToBePaid; ob.AdjustmentTime = limInfo.AdjustmentTime; ob.AcceptanceCommission = limInfo.AcceptanceCommission; ob.HandlingCharge = limInfo.HandlingCharge; ob.TotalAmountToBePaid = limInfo.TotalAmountToBePaid; //ob.LastShipmentDate = Convert.ToDateTime(limInfo.LastShipmentDate).ToString("dd/MM/yyyy"); ob.LimBankID = limInfo.Sys_Bank.BankID; var branch = objRepository.BranchRepository.GetByID(Convert.ToInt32(limInfo.LimBranchID)); ob.LimBranchID = limInfo.Sys_Branch.BranchID; ob.RecordStatus = limInfo.RecordStatus; } return(Json(ob, JsonRequestBehavior.AllowGet)); }
public ActionResult GetLimInfoByLCID(string LimID) { int id = Convert.ToInt32(LimID); LCM_LimInfo dataSet = objRepository.LimInfoRepository.GetByID(id); LCMLimInfo ob = new LCMLimInfo(); ob.LCNo = dataSet.LCNo == null ? "" : dataSet.LCNo; ob.LCID = Convert.ToInt32(dataSet.LCID); ob.LimNo = dataSet.LimNo == null ? "" : dataSet.LimNo; ob.LimID = dataSet.LimID; ob.LimBankID = Convert.ToInt32(dataSet.LimBankID); ob.LimBranchID = Convert.ToInt32(dataSet.LimBranchID); ob.BranchName = objRepository.BranchRepository.GetByID(dataSet.LimBranchID == null ? 0 : dataSet.LimBranchID).BranchName; ob.BankName = objRepository.BankRepository.GetByID(dataSet.LimBankID == null ? 0 : dataSet.LimBankID).BankName; ob.BankID = objRepository.BankRepository.GetByID(dataSet.LimBankID == null ? 0 : dataSet.LimBankID).BankID; ob.BranchID = objRepository.BranchRepository.GetByID(dataSet.LimBranchID == null ? 0 : dataSet.LimBranchID).BranchID; ob.LimLimit = dataSet.LimLimit == null ? 0 : dataSet.LimLimit; ob.LimBalance = dataSet.LimBalance == null ? 0 : dataSet.LimBalance; ob.LimDate = Convert.ToDateTime(dataSet.LimDate).ToString("dd/MM/yyyy"); ob.LimCurrency = (byte)dataSet.LimCurrency; ob.ExchangeRate = (decimal)dataSet.ExchangeRate == null ? 0 : (decimal)dataSet.ExchangeRate; ob.ExchangeValue = (decimal)dataSet.ExchangeValue == null ? 0 : (decimal)dataSet.ExchangeValue; ob.ExchangeCurrency = (byte)dataSet.ExchangeCurrency; ob.LoanAmount = (decimal)dataSet.LoanAmount == null ? 0 : (decimal)dataSet.LoanAmount; ob.InterestPersent = (decimal)dataSet.InterestPersent == null ? 0 : (decimal)dataSet.InterestPersent; ob.InterestAmount = (decimal)dataSet.InterestAmount == null ? 0 : (decimal)dataSet.InterestAmount; ob.AmountToBePaid = (decimal)dataSet.AmountToBePaid == null ? 0 : (decimal)dataSet.AmountToBePaid; ob.AdjustmentTime = Convert.ToInt32(dataSet.AdjustmentTime == null ? 0 : dataSet.AdjustmentTime); ob.TotalAmountToBePaid = (decimal)dataSet.TotalAmountToBePaid == null ? 0 : (decimal)dataSet.TotalAmountToBePaid; ob.OtherCharges = (decimal)dataSet.OtherCharges == null ? 0 : (decimal)dataSet.OtherCharges; ob.AcceptanceCommission = (decimal)dataSet.AcceptanceCommission == null ? 0 : (decimal)dataSet.AcceptanceCommission; ob.HandlingCharge = (decimal)dataSet.HandlingCharge == null ? 0 : (decimal)dataSet.HandlingCharge; ob.PaidAmount = (decimal)dataSet.PaidAmount == null ? 0 : (decimal)dataSet.PaidAmount; // ob.LCMarginTransfer = (decimal)dataSet.LCMarginTransfer == null ? 0 : (decimal)dataSet.LCMarginTransfer; if (dataSet.LCMarginTransfer != 0) { ob.LCMarginTransfer = dataSet.LCMarginTransfer; } else { ob.LCMarginTransfer = 0; } //ob.LimMarginTrans = (decimal)dataSet.LimMarginTrans == null ? 0 : (decimal)dataSet.LimMarginTrans; if (dataSet.LimMarginTrans != 0) { ob.LimMarginTrans = dataSet.LimMarginTrans; } else { ob.LimMarginTrans = 0; } //ob.LimMarginTransPercnt = (decimal)dataSet.LimMarginTransPercnt == null ? 0 : (decimal)dataSet.LimMarginTransPercnt; if (dataSet.LimMarginTransPercnt != 0) { ob.LimMarginTransPercnt = dataSet.LimMarginTransPercnt; } else { ob.LimMarginTransPercnt = 0; } ob.InterestCalcDate = Convert.ToDateTime(dataSet.InterestCalcDate).ToString("dd/MM/yyyy");//dataSet.InterestCalcDate; // ob.CalcInterestAmt = (decimal)dataSet.CalcInterestAmt == null ? 0 : (decimal)dataSet.CalcInterestAmt; if (dataSet.CalcInterestAmt != 0) { ob.CalcInterestAmt = dataSet.CalcInterestAmt; } else { ob.CalcInterestAmt = 0; } // ob.TransCash = (decimal)dataSet.TransCash == null ? 0 : (decimal)dataSet.TransCash; if (dataSet.TransCash != 0) { ob.TransCash = dataSet.TransCash; } else { ob.TransCash = 0; } // ob.CalcAmtToPaid = (decimal)dataSet.CalcAmtToPaid == null ? 0 : (decimal)dataSet.CalcAmtToPaid; if (dataSet.CalcAmtToPaid != 0) { ob.CalcAmtToPaid = dataSet.CalcAmtToPaid; } else { ob.CalcAmtToPaid = 0; } //ob.LimAdjustDr = (decimal)dataSet.LimAdjustDr == null ? 0 : (decimal)dataSet.LimAdjustDr; if (dataSet.LimAdjustDr != 0) { ob.LimAdjustDr = dataSet.LimAdjustDr; } else { ob.LimAdjustDr = 0; } // ob.LimAdjustCr = (decimal)dataSet.LimAdjustCr == null ? 0 : (decimal)dataSet.LimAdjustCr; if (dataSet.LimAdjustCr != 0) { ob.LimAdjustCr = dataSet.LimAdjustCr; } else { ob.LimAdjustCr = 0; } //ob.ExciseDuty = (decimal)dataSet.ExciseDuty == null ? 0 : (decimal)dataSet.ExciseDuty; if (dataSet.ExciseDuty != 0) { ob.ExciseDuty = dataSet.ExciseDuty; } else { ob.ExciseDuty = 0; } //ob.TotalCalcAmtToPaid = (decimal)dataSet.TotalCalcAmtToPaid == null ? 0 : (decimal)dataSet.TotalCalcAmtToPaid; if (dataSet.TotalCalcAmtToPaid != 0) { ob.TotalCalcAmtToPaid = dataSet.TotalCalcAmtToPaid; } else { ob.TotalCalcAmtToPaid = 0; } ob.RecordStatus = dataSet.RecordStatus; ob.Remarks = dataSet.Remarks; return(Json(ob, JsonRequestBehavior.AllowGet)); }
public ValidationMsg SaveLCM_LimInfo(LCM_LimInfo dataSet, string url, int _userId) { try { LCM_LimInfo obLcLimInfo = new LCM_LimInfo(); Sys_Branch branch = new Sys_Branch(); obLcLimInfo.LCID = dataSet.LCID; obLcLimInfo.LCNo = dataSet.LCNo; obLcLimInfo.LimID = dataSet.LimID; obLcLimInfo.LimNo = dataSet.LimNo; obLcLimInfo.LimDate = dataSet.LimDate; obLcLimInfo.LimLimit = dataSet.LimLimit == null ? 0 : (decimal)dataSet.LimLimit; obLcLimInfo.LimBalance = dataSet.LimBalance == null ? 0 : (decimal)dataSet.LimBalance; obLcLimInfo.LimBankID = dataSet.LimBankID; obLcLimInfo.LimBranchID = dataSet.LimBranchID; obLcLimInfo.LoanAmount = dataSet.LoanAmount == null ? 0 : (decimal)dataSet.LoanAmount; obLcLimInfo.InterestPersent = dataSet.InterestPersent == null ? 0 : (decimal)dataSet.InterestPersent; obLcLimInfo.InterestAmount = dataSet.InterestAmount == null ? 0 : (decimal)dataSet.InterestAmount; obLcLimInfo.AmountToBePaid = dataSet.AmountToBePaid == null ? 0 : (decimal)dataSet.AmountToBePaid; obLcLimInfo.AdjustmentTime = dataSet.AdjustmentTime; obLcLimInfo.OtherCharges = dataSet.OtherCharges == null ? 0 : (decimal)dataSet.OtherCharges; obLcLimInfo.AcceptanceCommission = dataSet.AcceptanceCommission == null ? 0 : (decimal)dataSet.AcceptanceCommission; obLcLimInfo.HandlingCharge = dataSet.HandlingCharge == null ? 0 : (decimal)dataSet.HandlingCharge; obLcLimInfo.TotalAmountToBePaid = dataSet.TotalAmountToBePaid == null ? 0 : (decimal)dataSet.TotalAmountToBePaid; obLcLimInfo.PaidAmount = dataSet.PaidAmount == null ? 0 : (decimal)dataSet.PaidAmount; obLcLimInfo.LimCurrency = (byte)dataSet.LimCurrency; obLcLimInfo.ExchangeCurrency = (byte)(dataSet.ExchangeCurrency); obLcLimInfo.ExchangeRate = dataSet.ExchangeRate == null ? 0 : (decimal)dataSet.ExchangeRate; //dataSet.ExchangeRate; obLcLimInfo.ExchangeValue = dataSet.ExchangeValue == null ? 0 : (decimal)dataSet.ExchangeValue; //dataSet.ExchangeValue; obLcLimInfo.RecordStatus = "NCF"; obLcLimInfo.LCMarginTransfer = dataSet.LCMarginTransfer == null ? 0 : (decimal)dataSet.LCMarginTransfer; obLcLimInfo.LimMarginTrans = dataSet.LimMarginTrans == null ? 0 : (decimal)dataSet.LimMarginTrans; obLcLimInfo.LimMarginTransPercnt = dataSet.LimMarginTransPercnt == null ? 0 : (decimal)dataSet.LimMarginTransPercnt; obLcLimInfo.InterestCalcDate = dataSet.InterestCalcDate; obLcLimInfo.CalcInterestAmt = dataSet.CalcInterestAmt == null ? 0 : (decimal)dataSet.CalcInterestAmt; obLcLimInfo.ExciseDuty = dataSet.ExciseDuty == null ? 0 : (decimal)dataSet.ExciseDuty; obLcLimInfo.TransCash = dataSet.TransCash == null ? 0 : (decimal)dataSet.TransCash; obLcLimInfo.CalcAmtToPaid = dataSet.CalcAmtToPaid == null ? 0 : (decimal)dataSet.CalcAmtToPaid; obLcLimInfo.LimAdjustDr = dataSet.LimAdjustDr == null ? 0 : (decimal)dataSet.LimAdjustDr; obLcLimInfo.LimAdjustCr = dataSet.LimAdjustCr == null ? 0 : (decimal)dataSet.LimAdjustCr; obLcLimInfo.TotalCalcAmtToPaid = dataSet.TotalCalcAmtToPaid == null ? 0 : (decimal)dataSet.TotalCalcAmtToPaid; obLcLimInfo.Remarks = dataSet.Remarks; obLcLimInfo.SetOn = DateTime.Now; obLcLimInfo.SetBy = _userId; obLcLimInfo.IPAddress = GetIPAddress.LocalIPAddress(); obEntity.LCM_LimInfo.Add(obLcLimInfo); int flag = obEntity.SaveChanges(); if (flag == 1) { //_vmMsg.ReturnId = repository.LimInfoRepository.Get().Last().LimID; //_vmMsg.ReturnCode = dataSet.LimNo; //repository.LimInfoRepository.GetByID(_vmMsg.ReturnId).LimNo; _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); }
public ValidationMsg ConfirmLimInformation(int userid, string limID, string branchID) { _vmMsg = new ValidationMsg(); try { using (var tx = new TransactionScope()) { if (limID != "") { LCM_LimInfo obLimInfo = repository.LimInfoRepository.GetByID(Convert.ToInt32(limID)); if (obLimInfo.RecordStatus == "NCF") { obLimInfo.RecordStatus = "CNF"; obLimInfo.SetBy = userid; obLimInfo.SetOn = DateTime.Now; repository.LimInfoRepository.Update(obLimInfo); Sys_Branch obBranch = repository.BranchRepository.GetByID(Convert.ToInt32(branchID)); obBranch.LIMBalance = obLimInfo.LimLimit - obLimInfo.LoanAmount; repository.BranchRepository.Update(obBranch); int flag = repository.Save(); if (flag == 1) { _vmMsg.Type = Enums.MessageType.Success; _vmMsg.Msg = "Confirmed Faild. "; } else { _vmMsg.Type = Enums.MessageType.Error; _vmMsg.Msg = "Confirmed Successfully."; } } else { _vmMsg.Type = Enums.MessageType.Error; _vmMsg.Msg = "Data has Already Confirmed."; } } else { _vmMsg.Type = Enums.MessageType.Error; _vmMsg.Msg = "Data Save First."; } tx.Complete(); } } 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); }
public ValidationMsg UpdateLCM_LimInfo(LCM_LimInfo dataSet, int _userId) { try { LCM_LimInfo obLcLimInfo = repository.LimInfoRepository.GetByID(Convert.ToInt32(dataSet.LimID)); if (obLcLimInfo.RecordStatus != "CNF") { obLcLimInfo.LimID = dataSet.LimID; obLcLimInfo.LimNo = dataSet.LimNo; obLcLimInfo.LimDate = dataSet.LimDate; obLcLimInfo.LimLimit = dataSet.LimLimit; obLcLimInfo.LimBalance = dataSet.LimBalance; obLcLimInfo.LimBankID = dataSet.LimBankID; obLcLimInfo.LimBranchID = dataSet.LimBranchID; obLcLimInfo.LoanAmount = dataSet.LoanAmount; obLcLimInfo.InterestPersent = dataSet.InterestPersent; obLcLimInfo.InterestAmount = dataSet.InterestAmount; obLcLimInfo.AmountToBePaid = dataSet.AmountToBePaid; obLcLimInfo.AdjustmentTime = dataSet.AdjustmentTime; obLcLimInfo.OtherCharges = dataSet.OtherCharges; obLcLimInfo.AcceptanceCommission = dataSet.AcceptanceCommission; obLcLimInfo.HandlingCharge = dataSet.HandlingCharge; obLcLimInfo.TotalAmountToBePaid = dataSet.TotalAmountToBePaid; obLcLimInfo.PaidAmount = dataSet.PaidAmount; obLcLimInfo.LimCurrency = dataSet.LimCurrency; obLcLimInfo.ExchangeCurrency = dataSet.ExchangeCurrency; obLcLimInfo.ExchangeRate = dataSet.ExchangeRate; obLcLimInfo.ExchangeValue = dataSet.ExchangeValue; obLcLimInfo.LCMarginTransfer = dataSet.LCMarginTransfer == null ? 0 : dataSet.LCMarginTransfer; obLcLimInfo.LimMarginTrans = dataSet.LimMarginTrans == null ? 0 : dataSet.LimMarginTrans; obLcLimInfo.LimMarginTransPercnt = dataSet.LimMarginTransPercnt == null ? 0 : dataSet.LimMarginTransPercnt; obLcLimInfo.InterestCalcDate = dataSet.InterestCalcDate; obLcLimInfo.CalcInterestAmt = dataSet.CalcInterestAmt == null ? 0 : dataSet.CalcInterestAmt; obLcLimInfo.ExciseDuty = dataSet.ExciseDuty == null ? 0 : dataSet.ExciseDuty; obLcLimInfo.TransCash = dataSet.TransCash == null ? 0 : dataSet.TransCash; obLcLimInfo.CalcAmtToPaid = dataSet.CalcAmtToPaid == null ? 0 : dataSet.CalcAmtToPaid; obLcLimInfo.LimAdjustDr = dataSet.LimAdjustDr == null ? 0 : dataSet.LimAdjustDr; obLcLimInfo.LimAdjustCr = dataSet.LimAdjustCr == null ? 0 : dataSet.LimAdjustCr; obLcLimInfo.TotalCalcAmtToPaid = dataSet.TotalCalcAmtToPaid == null ? 0 : dataSet.TotalCalcAmtToPaid; obLcLimInfo.Remarks = dataSet.Remarks; obLcLimInfo.ModifiedOn = DateTime.Now; obLcLimInfo.ModifiedBy = _userId; obLcLimInfo.IPAddress = GetIPAddress.LocalIPAddress(); repository.LimInfoRepository.Update(obLcLimInfo); 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); }