public int SendNotification(SavingEvent savingEvent, OPaymentMethods paymentMethod) { if (person == null) { throw new ArgumentNullException("client"); } var messageTemplate = GetLocalizedActiveMessageTemplate("Client.LoanDisbursementNotification"); if (messageTemplate == null) { return(0); } SavingBookContract savingsContract = (SavingBookContract)SavingsService.GetSaving(savingEvent.ContracId); //tokens var tokens = new List <Token>(); MessageTokenProvider.AddPersonTokens(tokens, person); MessageTokenProvider.AddSavingEventTokens(tokens, savingEvent, savingsContract); tokens.Add(new Token("Messaging.CurrentDate", DateTime.Now.ToShortDateString())); tokens.Add(new Token("Messaging.CurrentTime", DateTime.Now.ToShortTimeString())); //event notification EventPublisher.MessageTokensAdded(messageTemplate, tokens); var emailAccount = GetEmailAccountOfMessageTemplate(messageTemplate); var toEmail = person.Email; var toName = person.FullName; return(SendNotification(messageTemplate, emailAccount, tokens, toEmail, toName)); }
public int SendNotification(SavingEvent savingEvent, ISavingsContract savingsContract, string savingsOperation) { if (person == null) { throw new ArgumentNullException("client"); } var messageTemplate = GetLocalizedActiveMessageTemplate("Client.AccountOperationNotification"); if (messageTemplate == null) { return(0); } //tokens var tokens = new List <Token>(); MessageTokenProvider.AddPersonTokens(tokens, person); MessageTokenProvider.AddSavingEventTokens(tokens, savingEvent, savingsContract); //Add messaging operation code tokens.Add(new Token("Messaging.OperationCode", savingsOperation)); tokens.Add(new Token("Messaging.CurrentDate", DateTime.Now.ToShortDateString())); tokens.Add(new Token("Messaging.CurrentTime", DateTime.Now.ToShortTimeString())); //event notification EventPublisher.MessageTokensAdded(messageTemplate, tokens); var emailAccount = GetEmailAccountOfMessageTemplate(messageTemplate); var toEmail = person.Email; var toName = person.FullName; return(SendNotification(messageTemplate, emailAccount, tokens, toEmail, toName, null, null, savingsContract)); }