public LateCustomerStatusChange(int customerID, int loanID, CollectionStatusNames status, CollectionType type, DateTime now) { CustomerID = customerID; LoanID = loanID; Status = status; Type = type; this.now = now; }
} //CalculateFee protected void ChangeStatus(int customerID, int loanID, CollectionStatusNames status, CollectionType type, CollectionDataModel model) { Log.Info("Changing collection status to customer {0} loan {1} type {2} status {3}", customerID, loanID, type, status); // prevent while running on new loan - duplicate update if (model.UpdateCustomerAllowed) { bool wasChanged = DB.ExecuteScalar <bool>("UpdateCollectionStatus", CommandSpecies.StoredProcedure, new QueryParameter("CustomerID", customerID), new QueryParameter("CollectionStatus", (int)status), new QueryParameter("Now", this.now)); if (!wasChanged) { Log.Info("ChangeStatus to customer {0} loan {1} status {2} was not changed - customer already in this status", customerID, loanID, status); } else { var salesForce = new SalesForce.AddUpdateLeadAccount(null, customerID, false, false); salesForce.Execute(); } } //AddCollectionLog(customerID, loanID, type, CollectionMethod.ChangeStatus, model); model.CustomerID = customerID; model.LoanID = loanID; AddCollectionLog(new CollectionLog() { CustomerID = model.CustomerID, LoanID = model.LoanID, LoanHistoryID = model.LoanHistoryID, Type = type.ToString(), Method = CollectionMethod.ChangeStatus.ToString(), Comments = (model.NLLoanID > 0) ? "nlloan " + model.NLLoanID : null }); //TODO update loan collection status if want to be on loan level and not on customer level Log.Info("update loan collection status if want to be on loan level and not on customer level for customer {0}, loan {1}", customerID, loanID); } //ChangeStatus
private void NLSendNotifications(CollectionDataModel model) { // prevent for sending notification twice - for old and new loan to sane customer if (!sendNotificationForNewLoan) { model.SmsSendingAllowed = false; model.ImailSendingAllowed = false; model.EmailSendingAllowed = false; model.UpdateCustomerAllowed = false; } CollectionType collectionType = GetCollectionType(model.LateDays); CollectionStatusNames collectionStatusName = GetCollectionStatusName(collectionType); string emailTemplate = GetCollectionEmailTemplateName(collectionType); bool isSendEmail = IsSendEmail(collectionType); bool isSendSMS = IsSendSMS(collectionType); bool isSendImail = IsSendImail(collectionType); bool isChangeStatusCall = IsChangeStatusCall(collectionType); if (isChangeStatusCall) { ChangeStatus(model.CustomerID, 1, collectionStatusName, collectionType, model); } if (isSendEmail) { SendCollectionEmail(emailTemplate, model, collectionType); } if (isSendSMS) { SendCollectionSms(model, collectionType); } if (isSendImail) { SendCollectionImail(model, collectionType); } }