public override void Execute() { this.now = DateTime.UtcNow; DB.ForEachRowSafe((sr, bRowsetStart) => { // mark loan/schedule status as late, record fee MarkLoanAsLate(sr); return(ActionResult.Continue); }, "GetLoansToCollect", CommandSpecies.StoredProcedure, new QueryParameter("Now", this.now)); //------NL/"old"-----Send collection mails sms imails and change status -------------------- LoadSmsTemplates(); LoadImailTemplates(); DB.ForEachRowSafe((sr, bRowsetStart) => { try { // build data model+changesStatus?+senEmail?+sentImail?+sent HandleCollectionLogic(sr); // ReSharper disable once CatchAllClause } catch (Exception ex) { Log.Error(ex, "Failed to handle collection for customer {0}", sr["CustomerID"]); } return(ActionResult.Continue); }, "GetLateForCollection", CommandSpecies.StoredProcedure, new QueryParameter("Now", this.now)); //-----------Change status to enabled for cured loans-------------------------------- DB.ForEachRowSafe((sr, bRowsetStart) => { var model = new CollectionDataModel { CustomerID = sr["CustomerID"], LoanID = sr["LoanID"], UpdateCustomerAllowed = true }; try { HandleCuredLoan(model.CustomerID, model.LoanID, model); } catch (Exception ex) { Log.Error(ex, "Failed to handle cured loan for customer {0}", sr["CustomerID"]); } return(ActionResult.Continue); }, "GetCuredLoansForCollection", CommandSpecies.StoredProcedure); // run NL job try { Log.Debug("====================================NEWLOAN late job started==========================="); LateLoanJob nlLateJob = new LateLoanJob(this.now); nlLateJob.Execute(); // ReSharper disable once CatchAllClause } catch (Exception ex) { Log.Debug(ex.Message); NL_AddLog(LogType.Error, "Strategy failed", this.now, null, ex.Message, ex.StackTrace); } } //Execute
public void TestLateLoanJob() { var stra = new LateLoanJob(DateTime.UtcNow); stra.Execute(); }
public void LateLoanJobTest() { LateLoanJob s = new LateLoanJob(null); s.Execute(); }
public void LateLoanJob() { LateLoanJob strategy = new LateLoanJob(DateTime.UtcNow); strategy.Execute(); }