Exemplo n.º 1
0
        public ActionResult Edit(string id, SysEmail entity)
        {
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                string currentPerson = GetCurrentPerson();
                //entity.UpdateTime = DateTime.Now;
                //entity.UpdatePerson = currentPerson;

                string returnValue = string.Empty;
                if (m_BLL.Edit(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",邮件发送记录信息的Id为" + id, "邮件发送记录"
                                                   );       //写入日志
                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",邮件发送记录信息的Id为" + id + "," + returnValue, "邮件发送记录"
                                                   );                  //写入日志
                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
Exemplo n.º 2
0
        public ActionResult Create(SysEmail entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                string currentPerson = GetCurrentPerson();
                entity.CreateTime   = DateTime.Now;
                entity.CreatePerson = currentPerson;

                entity.Id = Result.GetNewId();
                string returnValue = string.Empty;
                if (m_BLL.Create(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",邮件发送记录的信息的Id为" + entity.Id, "邮件发送记录"
                                                   );//写入日志
                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",邮件发送记录的信息," + returnValue, "邮件发送记录"
                                                   );                  //写入日志
                    return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败
                }
            }

            return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
      // string password= Util.DESEncrypt("2323", "sunny2013");
        NT.Entities.CoreSetting EmailSetting=NT.Data.DataRepository.CoreSettingProvider.GetBySkey("SysEmail");
        if (EmailSetting != null)
        {
            sysmail = Searializer.Instance.String2Object(EmailSetting.Svalue) as SysEmail;
        }
        EmailSetting = NT.Data.DataRepository.CoreSettingProvider.GetBySkey("EmailAsReg");
        if (EmailSetting != null)
        {
            EmailAsReg = EmailSetting.Svalue;
        }
        EmailSetting = NT.Data.DataRepository.CoreSettingProvider.GetBySkey("EmailAsEnquiry");
        if (EmailSetting != null)
        {
            EmailAsEnquiry = EmailSetting.Svalue;
        }
        EmailSetting = NT.Data.DataRepository.CoreSettingProvider.GetBySkey("EmailAsOrder");
        if (EmailSetting != null)
        {
            EmailAsOrder = EmailSetting.Svalue;
        }

    }
Exemplo n.º 4
0
 /// <summary>
 /// 创建一个邮件发送记录
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个邮件发送记录</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, SysEmail entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
Exemplo n.º 5
0
        public static void MailSendChangePassword(SysEntities db, string mailTo, string name, string psw)
        {
            string tempName = "修改密码发送的邮件通知";
            var    data     = db.SysEmailTemp.Where(w => w.Mail_name == tempName).FirstOrDefault();

            if (data != null)
            {
                SysEmail email = new SysEmail();
                email.CreateTime  = DateTime.Now;
                email.Id          = Common.Result.GetNewId();
                email.SysMailId   = data.Id;
                email.Subject     = data.Subject.Replace("{{用户名}}", name).Replace("{{密码}}", psw);
                email.Content     = data.Content.Replace("{{用户名}}", name).Replace("{{密码}}", psw);
                email.Mail_type   = mailTo;
                email.Reply_email = data.Reply_email;
                db.SysEmail.Add(email);

                string mailFromPwd    = "langben123",
                       mailSmtpServer = "smtp.exmail.qq.com";

                SendSMTPEMail(mailSmtpServer, 25, email.Reply_email, "服务", "*****@*****.**", mailFromPwd, mailTo, email.Subject, email.Content);
            }
        }
Exemplo n.º 6
0
        public ActionResult Details(string id)
        {
            SysEmail item = m_BLL.GetById(id);

            return(View(item));
        }
Exemplo n.º 7
0
 public ActionResult Edit(string id)
 {
     SysEmail item = m_BLL.GetById(id);
     return View(item);
 }