} //Execute private void BuildCollectionDataModel(SafeReader sr) { string mobilePhone = sr["MobilePhone"]; var model = new CollectionDataModel { CustomerID = sr["CustomerID"], OriginID = sr["OriginID"], LoanRefNum = sr["LoanRefNum"], FirstName = sr["FirstName"], FullName = sr["FullName"], Email = sr["email"], PhoneNumber = string.IsNullOrEmpty(mobilePhone) ? sr["DaytimePhone"] : mobilePhone, DueDate = sr["ScheduleDate"], LoanID = sr["OldLoanID"], ScheduleID = 0, NLLoanID = sr["LoanID"], LoanHistoryID = sr["LoanHistoryID"], NLScheduleID = sr["ScheduleID"], SmsSendingAllowed = sr["SmsSendingAllowed"], EmailSendingAllowed = sr["EmailSendingAllowed"], ImailSendingAllowed = sr["MailSendingAllowed"] }; model.LateDays = (int)(now - model.DueDate).TotalDays; GetLoanState loanState = new GetLoanState(model.CustomerID, model.NLLoanID, now); loanState.Execute(); List <NL_LoanSchedules> schedules = new List <NL_LoanSchedules>(); loanState.Result.Loan.Histories.ForEach(h => schedules.AddRange(h.Schedule)); var scheduleItem = schedules.FirstOrDefault(s => s.LoanScheduleID == model.NLScheduleID); model.Interest = loanState.Result.Interest; if (scheduleItem != null) { model.FeeAmount = scheduleItem.Fees; model.AmountDue = scheduleItem.AmountDue; } nlNotificationsList.Add(model); Log.Info(model.ToString()); NL_AddLog(LogType.Info, "CollectionDataModel", now, model, null, null); }
} //GetCollectionMailModel /// <summary> /// For the first late schedule /// </summary> private void HandleCollectionLogic(SafeReader sr) { DateTime scheduleDate = sr["ScheduleDate"]; int loanId = sr["LoanID"]; string dayPhone = sr["DaytimePhone"]; string mobilePhone = sr["MobilePhone"]; int lateDays = (int)(this.now - scheduleDate).TotalDays; var model = new CollectionDataModel { CustomerID = sr["CustomerID"], OriginID = sr["OriginID"], LoanID = loanId, ScheduleID = sr["ScheduleID"], LoanRefNum = sr["LoanRefNum"], FirstName = sr["FirstName"], FullName = sr["FullName"], AmountDue = sr["AmountDue"], Interest = sr["Interest"], FeeAmount = sr["Fees"], Email = sr["email"], DueDate = scheduleDate, LateDays = lateDays, PhoneNumber = string.IsNullOrEmpty(mobilePhone) ? dayPhone : mobilePhone, SmsSendingAllowed = sr["SmsSendingAllowed"], EmailSendingAllowed = sr["EmailSendingAllowed"], ImailSendingAllowed = sr["MailSendingAllowed"], UpdateCustomerAllowed = true //SendNotification = true // always perform action(send notification/changeStatus) for "old" loan }; Log.Info(model.ToString()); if (lateDays == 0) { CollectionDay0(model, CollectionType.CollectionDay0); } if (lateDays >= 1 && lateDays <= 6) { CollectionDay1to6(model, CollectionType.CollectionDay1to6); } if (lateDays == 3) { CollectionDay3(model, CollectionType.CollectionDay3); } if (lateDays == 7) { CollectionDay7(model, CollectionType.CollectionDay7); } if (lateDays >= 8 && lateDays <= 14) { CollectionDay8to14(model, CollectionType.CollectionDay8to14); } if (lateDays == 10) { CollectionDay10(model, CollectionType.CollectionDay10); } if (lateDays == 13) { CollectionDay13(model, CollectionType.CollectionDay13); } if (lateDays == 15) { CollectionDay15(model, CollectionType.CollectionDay15); } if (lateDays == 21) { CollectionDay21(model, CollectionType.CollectionDay21); } if (lateDays == 31) { CollectionDay31(model, CollectionType.CollectionDay31); } if (lateDays == 46) { CollectionDay46(model, CollectionType.CollectionDay46); } if (lateDays == 60) { CollectionDay60(model, CollectionType.CollectionDay60); } if (lateDays == 90) { CollectionDay90(model, CollectionType.CollectionDay90); } UpdateLoanStats(loanId, lateDays, model.AmountDue); } //HandleCollectionLogic