} // ChangeExternalCollectionStatus private void NL_SaveLoanOptions(Customer customer, LoanOptions options) { NL_LoanOptions nlOptions = new NL_LoanOptions() { LoanID = options.LoanId, CaisAccountStatus = options.CaisAccountStatus, EmailSendingAllowed = options.EmailSendingAllowed, LatePaymentNotification = options.LatePaymentNotification, LoanOptionsID = options.Id, MailSendingAllowed = options.MailSendingAllowed, ManualCaisFlag = options.ManualCaisFlag, PartialAutoCharging = options.ReductionFee, SmsSendingAllowed = options.SmsSendingAllowed, StopAutoChargeDate = MiscUtils.NL_GetStopAutoChargeDate(options.AutoPayment, options.StopAutoChargeDate), StopLateFeeFromDate = MiscUtils.NL_GetLateFeeDates(options.AutoLateFees, options.StopLateFeeFromDate, options.StopLateFeeToDate).Item1, StopLateFeeToDate = MiscUtils.NL_GetLateFeeDates(options.AutoLateFees, options.StopLateFeeFromDate, options.StopLateFeeToDate).Item2, UserID = this.context.UserId, InsertDate = DateTime.Now, IsActive = true, Notes = "From Application Info", }; var PropertiesUpdateList = new List <String>() { "StopAutoChargeDate", "StopLateFeeFromDate", "StopLateFeeToDate", }; var nlStrategy = this.serviceClient.Instance.AddLoanOptions(this.context.UserId, customer.Id, nlOptions, options.LoanId, PropertiesUpdateList.ToArray()); }
private void NL_SaveLoanOptions(LoanOptions options, List <String> PropertiesUpdateList) { int customerId = this._loans.Get(options.LoanId).Customer.Id; //NL Loan Options NL_LoanOptions nlOptions = new NL_LoanOptions() { LoanID = options.LoanId, CaisAccountStatus = options.CaisAccountStatus, EmailSendingAllowed = options.EmailSendingAllowed, LatePaymentNotification = options.LatePaymentNotification, LoanOptionsID = options.Id, MailSendingAllowed = options.MailSendingAllowed, ManualCaisFlag = options.ManualCaisFlag, PartialAutoCharging = options.ReductionFee, SmsSendingAllowed = options.SmsSendingAllowed, StopAutoChargeDate = MiscUtils.NL_GetStopAutoChargeDate(options.AutoPayment, options.StopAutoChargeDate), StopLateFeeFromDate = MiscUtils.NL_GetLateFeeDates(options.AutoLateFees, options.StopLateFeeFromDate, options.StopLateFeeToDate).Item1, StopLateFeeToDate = MiscUtils.NL_GetLateFeeDates(options.AutoLateFees, options.StopLateFeeFromDate, options.StopLateFeeToDate).Item2, UserID = this._context.UserId, InsertDate = DateTime.Now, IsActive = true, Notes = "From Loan Editor Controller", }; var nlStrategy = this.serviceClient.Instance.AddLoanOptions(this._context.UserId, customerId, nlOptions, options.LoanId, PropertiesUpdateList.ToArray()); Log.DebugFormat("NL LoanOptions save: LoanOptionsID: {0}, Error: {1}", nlStrategy.Value, nlStrategy.Error); }
} //NL_MarkLoanAsLate private bool LateFeesAllowed(NL_LoanOptions options, long loanID) { if (options.StopLateFeeToDate != null && options.StopLateFeeFromDate != null && (now >= options.StopLateFeeFromDate.Value.Date && now <= options.StopLateFeeToDate.Value.Date)) { Log.Info("NL: not applying late fee for loan {0} - auto late fee is disabled from {1:d} to {2:d}", loanID, options.StopLateFeeFromDate, options.StopLateFeeToDate); return(false); } return(true); }
} // GetLoanByOldID public NLLongActionResult AddLoanOptions(int userID, int customerID, NL_LoanOptions loanOptions, int?oldLoanId, List <String> propertiesUpdateList = null) { AddLoanOptions s = new AddLoanOptions(loanOptions, oldLoanId, propertiesUpdateList); s.Context.UserID = userID; s.Context.CustomerID = customerID; var amd = ExecuteSync(out s, customerID, userID, loanOptions, oldLoanId, propertiesUpdateList); return(new NLLongActionResult { MetaData = amd, Value = s.LoanOptionsID }); } // AddLoanOptions
public void TestLoanOptions1() { NL_LoanOptions NL_options = new NL_LoanOptions { LoanID = 2, StopAutoChargeDate = DateTime.UtcNow, PartialAutoCharging = true, LatePaymentNotification = true, CaisAccountStatus = "asd", ManualCaisFlag = "qwe", EmailSendingAllowed = true, SmsSendingAllowed = true, MailSendingAllowed = true, UserID = 25, InsertDate = DateTime.UtcNow, IsActive = true, Notes = null }; var stra = new AddLoanOptions(NL_options, 5137); stra.Execute(); }
public override void Execute() { if (!CurrentValues.Instance.NewLoanRun) { NL_AddLog(LogType.Info, "NL disabled by configuration", null, null, null, null); return; } NL_AddLog(LogType.Info, "Strategy Start", this.nlLoanOptions, null, null, null); try { long newLoanId = 0; if (oldLoanId == null) { NL_AddLog(LogType.DataExsistense, "oldLoanID not found ", this.nlLoanOptions, null, null, null); return; } newLoanId = DB.ExecuteScalar <long>("NL_LoanIdByOldLoanId", CommandSpecies.StoredProcedure, new QueryParameter("OldLoanID", oldLoanId)); Log.Debug("LoanID {0} for oldID {1}", oldLoanId, newLoanId); if (newLoanId <= 0) { NL_AddLog(LogType.DataExsistense, "LoanID not found ", new object[] { oldLoanId }, null, null, null); return; } this.nlLoanOptions.LoanID = newLoanId; NL_LoanOptions existsOptions = DB.FillFirst <NL_LoanOptions>("NL_LoanOptionsGet", CommandSpecies.StoredProcedure, new QueryParameter("LoanID", this.nlLoanOptions.LoanID)); PropertyInfo[] props = typeof(NL_LoanOptions).GetProperties(); existsOptions.Traverse((ignored, pi) => { if (pi.GetValue(this.nlLoanOptions) != null) { pi.SetValue(existsOptions, pi.GetValue(this.nlLoanOptions)); } }); if (PropertiesUpdateList != null) { foreach (var updateProperty in PropertiesUpdateList) { PropertyInfo pi = this.nlLoanOptions.GetType().GetProperty(updateProperty); var fromClient = pi.GetValue(this.nlLoanOptions); pi.SetValue(existsOptions, fromClient, null); } } LoanOptionsID = DB.ExecuteScalar <long>("NL_LoanOptionsSave", CommandSpecies.StoredProcedure, DB.CreateTableParameter <NL_LoanOptions>("Tbl", existsOptions), new QueryParameter("LoanID", this.nlLoanOptions.LoanID)); NL_AddLog(LogType.Info, "Strategy End", this.nlLoanOptions, this.LoanOptionsID, null, null); // ReSharper disable once CatchAllClause } catch (Exception ex) { Log.Alert("Failed to save NL_LoanOptions, oldLoanID: {0}, LoanID: {1}, ex: {2}", oldLoanId, this.nlLoanOptions.LoanID, ex); Error = string.Format("Failed to save NL_LoanOptions, oldLoanID: {0}, LoanID: {1}, ex: {2}", oldLoanId, this.nlLoanOptions.LoanID, ex.Message); NL_AddLog(LogType.Error, "Strategy failed", this.nlLoanOptions, null, ex.ToString(), ex.StackTrace); } } //Execute
public AddLoanOptions(NL_LoanOptions loanOptions, int?OldLoanId, List <String> PropertiesUpdateList = null) { this.nlLoanOptions = loanOptions; oldLoanId = OldLoanId; this.PropertiesUpdateList = PropertiesUpdateList; } //constructor