void Print()
        {
            string   fileName = Properties.Settings.Default.LoansStatementTemplatePath;
            string   pdf      = Properties.Settings.Default.PdfsFolder;
            WordMail wm       = new WordMail();

            try
            {
                wm.Send(Statement, fileName, pdf);
            }
            catch (Exception ex)
            {
                Helper.LogAndShow(ex);
            }
        }
Exemple #2
0
        internal static void SendEmail(Word.Document wDoc, RenderSettings renderSetting, ref List <string> tempFiles)
        {
            MailType mailType = GetDefaultEmailClientProgram();

            switch (mailType)
            {
            case MailType.OutLook:
                bool isSuccess = false;
                try
                {
                    isSuccess = OutLookMail.SendEmail(wDoc, renderSetting, ref tempFiles);
                }
                catch (BaseException baseExp)
                {
                    Managers.ManagerException mgrExp = new Managers.ManagerException(ErrorCode.ipe_SendMailError);
                    baseExp.Errors.Add(baseExp);

                    throw mgrExp;
                }
                catch (System.Exception ex)
                {
                    Managers.ManagerException mgrExp = new Managers.ManagerException(ErrorCode.ipe_SendMailError,
                                                                                     MessageUtils.Expand(Properties.Resources.ipe_SendMailError, ex.Message), ex.StackTrace);

                    throw mgrExp;
                }

                if (!isSuccess)
                {
                    try
                    {
                        WordMail.SendEmail(wDoc, renderSetting);
                    }
                    catch (System.Exception ex)
                    {
                        Managers.ManagerException mgrExp = new Managers.ManagerException(ErrorCode.ipe_SendMailError,
                                                                                         MessageUtils.Expand(Properties.Resources.ipe_SendMailError, ex.Message), ex.StackTrace);

                        throw mgrExp;
                    }
                }
                break;

            case MailType.Unknow:
                try
                {
                    WordMail.SendEmail(wDoc, renderSetting);
                }
                catch (System.Exception ex)
                {
                    Managers.ManagerException mgrExp = new Managers.ManagerException(ErrorCode.ipe_SendMailError,
                                                                                     MessageUtils.Expand(Properties.Resources.ipe_SendMailError, ex.Message), ex.StackTrace);

                    throw mgrExp;
                }
                break;

            default:
                break;
            }
        }