示例#1
0
        public bool AddEmailSetting(ChemCloud_EmailSetting model)
        {
            bool result = false;

            context.ChemCloud_EmailSetting.Add(model);
            int count = context.SaveChanges();

            if (count > 0)
            {
                result = true;
            }
            return(result);
        }
示例#2
0
        public bool EditEmailSetting(ChemCloud_EmailSetting model)
        {
            bool result = false;
            ChemCloud_EmailSetting _ChemCloud_EmailSetting = context.ChemCloud_EmailSetting.FindById(model.Id);

            if (_ChemCloud_EmailSetting != null)
            {
                _ChemCloud_EmailSetting.SmtpServer       = model.SmtpServer;
                _ChemCloud_EmailSetting.SendMailId       = model.SendMailId;
                _ChemCloud_EmailSetting.SendMailPassword = model.SendMailPassword;
                int count = context.SaveChanges();
                result = true;
            }
            return(result);
        }
        public ActionResult EmailSettingEdit(string Id, string SmtpServer, string SendMailId, string SendMailPassword)
        {
            ChemCloud_EmailSetting model = new ChemCloud_EmailSetting()
            {
                Id               = long.Parse(Id),
                SmtpServer       = SmtpServer,
                SendMailId       = SendMailId,
                SendMailPassword = SendMailPassword
            };
            Result result1 = new Result();

            if (model.Id > 0)
            {
                if (ServiceHelper.Create <IEmailSettingService>().EditEmailSetting(model))
                {
                    result1.success = true;
                    result1.msg     = "编辑成功!";
                }
                else
                {
                    result1.success = false;
                    result1.msg     = "编辑失败!";
                }
            }
            else
            {
                if (ServiceHelper.Create <IEmailSettingService>().AddEmailSetting(model))
                {
                    result1.success = true;
                    result1.msg     = "添加成功!";
                }
                else
                {
                    result1.success = false;
                    result1.msg     = "添加失败!";
                }
            }
            return(Json(result1));
        }