Exemplo n.º 1
0
 /// <summary>构造函数</summary>
 public static MailBll GetInstence()
 {
     if (_MailBll == null)
     {
         _MailBll = new MailBll();
     }
     return(_MailBll);
 }
Exemplo n.º 2
0
 /// <summary>构造函数</summary>
 public static MailBll GetInstence()
 {
     if (_MailBll == null)
     {
         _MailBll = new MailBll();
     }
     return _MailBll;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;

            try
            {
                #region 赋值

                //获取实体
                var model = new WebConfig(x => x.Id == id);
                model.WebName = StringHelper.Left(txtWebName.Text, 50);
                model.WebDomain = StringHelper.Left(txtWebDomain.Text, 50, true, false);
                model.WebEmail = StringHelper.Left(txtWebEmail.Text, 50, true, false);

                model.LoginLogReserveTime = ConvertHelper.Cint0(txtLoginLogReserveTime.Text);
                model.UseLogReserveTime = ConvertHelper.Cint0(txtUseLogReserveTime.Text);

                model.EmailSmtp = StringHelper.Left(txtEmailSmtp.Text, 50, true, false);
                model.EmailUserName = StringHelper.Left(txtEmailUserName.Text, 50);
                model.EmailPassWord = StringHelper.Left(txtEmailPassWord.Text, 50, true, false);

                #endregion

                //----------------------------------------------------------
                //存储到数据库
                WebConfigBll.GetInstence().Save(this, model);

                //------------------------------------
                //测试邮件发送服务
                if (chkSendTest.Checked && model.EmailSmtp.Length > 0 && model.EmailUserName.Length > 0)
                {
                    var oMail = new MailBll();
                    string ss = oMail.TestMail();

                    if (ss.Length > 0)
                    {
                        return ("出错!" + ss);
                    }
                    else
                    {
                        return ("发送成功!");
                    }
                }
                return "修改成功!";
            }
            catch (Exception e)
            {
                result = "保存失败!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }

            return result;
        }