private static void TrySendStatementEmail(DateTime statementDate, Housekeeper housekeeper, string statementFilename)
 {
     try
     {
         _emailSender.EmailFile(housekeeper.Email, housekeeper.StatementEmailBody, statementFilename,
                                CreateSubject(statementDate, housekeeper));
     }
     catch (Exception e)
     {
         _xtraMessageBox.Show(e.Message, HousekeeperStatements(housekeeper),
                              MessageBoxButtons.OK);
     }
 }
Example #2
0
        private static void SendStatementEmail(DateTime statementDate, Housekeeper housekeeper)
        {
            if (string.IsNullOrWhiteSpace(housekeeper.Email))
            {
                return;
            }

            var statementFilename = StatementGenerator.SaveStatement(housekeeper.Oid, housekeeper.FullName, statementDate);

            if (string.IsNullOrWhiteSpace(statementFilename))
            {
                return;
            }

            try {
                EmailSender.EmailFile(housekeeper.Email, housekeeper.StatementEmailBody, statementFilename,
                                      string.Format("Sandpiper Statement {0:yyyy-MM} {1}", statementDate, housekeeper.FullName));
            } catch (Exception e) {
                XtraMessageBox.Show(e.Message, string.Format("Email failure: {0}", housekeeper.Email),
                                    MessageBoxButtons.OK);
            }
        }
 private static string CreateSubject(DateTime statementDate, Housekeeper housekeeper)
 {
     return(string.Format("Sandpiper Statement {0:yyyy-MM} {1}", statementDate, housekeeper.FullName));
 }
 private static string HousekeeperStatements(Housekeeper housekeeper)
 {
     return(string.Format("Email failure: {0}", housekeeper.Email));
 }