Beispiel #1
0
 /// <summary>
 /// init MailInfo
 /// </summary>
 /// <param name="info"></param>
 public Mailer(MailInfo info)
 {
     this.info = info;
 }
Beispiel #2
0
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            _forgotRepo = RepositoryFactory.CreateForgotPunchRepo();
            //取得頁面資料
            model = PageDataBind();

            var validResult       = PunchDateTimeValidate();
            var duplicateResult   = IsDuplicateSubmit();
            var theSameDateResult = IsTheSameDate();

            if (!validResult.IsValid || !duplicateResult.IsValid || !theSameDateResult.IsValid)
            {
                var errorMessage = String.Concat(validResult.ErrorMessage, ",", duplicateResult.ErrorMessage, ",", theSameDateResult.ErrorMessage);
                Response.Write(String.Join("\r\n", errorMessage.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)).ToAlertFormat());
                return;
            }

            //btn處理
            ViewUtils.ButtonOff(SaveBtn, CoverBtn);

            var responseMessage = String.Empty;

            try
            {
                var modelList = new List <RinnaiForms>();
                modelList.Add(model);
                //存檔
                if (String.IsNullOrEmpty(Request["SignDocID_FK"]))
                {
                    _forgotRepo.CreateData(modelList);
                    responseMessage = "新增成功!";
                }
                else
                {
                    _forgotRepo.EditData(modelList);
                    responseMessage = "編輯成功!";
                }
                #region #0022忘刷送出新增email通知
                //主管ADAccount
                string chiefID = _forgotRepo.FindChiefID(Request["SignDocID_FK"], User.Identity.Name);
                if (!string.IsNullOrEmpty(chiefID))
                {
                    MailerAPI.MailInfo mailInfo = new MailerAPI.MailInfo()
                    {
                        AddresseeTemp = System.Web.Configuration.WebConfigurationManager.AppSettings["MailTemplate"],
                        Subject       = String.Format("系統提醒!簽核單號 : {0} 已經送達!", model.SignDocID_FK),
                        //Subject = "系統部測試,請勿理會此郵件,謝謝!",
                        DomainPattern = ConfigUtils.ParsePageSetting("Pattern")["DomainPattern"],
                        CC            = new System.Collections.Generic.List <string>()
                        {
                            "*****@*****.**"
                        },
                        //To = string.Format("{0}@rinnai.com.tw", chiefID)
                        To = string.Format("{0}@rinnai.com.tw", chiefID)
                    };
                    var portalDomain = ConfigUtils.ParsePageSetting("Domain")["Portal"];

                    string body =
                        MailTools.BodyToTable(
                            String.Format(
                                @"系統提醒!簽核單號 : {0} 已經送達,請儘速檢視!<br /><a href='{1}/Area/Sign/ProcessWorkflowList.aspx?queryText={0}'>連結</a> <br />此件為系統發送,請勿回覆!",
                                //@"系統部測試,請勿理會此郵件,謝謝!",
                                model.SignDocID_FK, portalDomain));
                    mailInfo.Body.Append(body);
                    if (PublicRepository.CurrentWorkflowMode == Enums.WorkflowTypeEnum.RELEASE)
                    {
                        new Mailer(mailInfo).SendMail();
                    }
                }
                #endregion

                ViewUtils.ButtonOn(SaveBtn, CoverBtn);
                responseMessage = responseMessage.ToAlertAndRedirect(@"/Area/Sign/WorkflowQueryList.aspx?orderField=CreateDate&descending=True");
            }
            catch (Exception ex)
            {
                responseMessage = String.Concat("存檔失敗!\r\n錯誤訊息: ", ex.Message).ToAlertFormat();
                ViewUtils.ShowRefreshBtn(CoverBtn, RefreshBtn);
            }
            finally
            {
                Response.Write(responseMessage);
            }
        }
Beispiel #3
0
 /// <summary>
 /// init MailInfo
 /// </summary>
 /// <param name="info"></param>
 public Mailer(MailSetting setting, MailInfo info)
 {
     this.info    = info;
     this.setting = setting;
 }