Example #1
0
        public int Add(AMW.Model.Entity.MldAdmin model)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (model.RidValueFlag)
            {
                dic.Add("Rid", model.Rid);
            }
            if (model.NameValueFlag)
            {
                dic.Add("Name", model.Name);
            }
            if (model.PwdValueFlag)
            {
                dic.Add("Pwd", model.Pwd);
            }
            if (model.AddTimeValueFlag)
            {
                dic.Add("AddTime", model.AddTime);
            }
            if (model.LastLoginTimeValueFlag)
            {
                dic.Add("LastLoginTime", model.LastLoginTime);
            }
            if (model.LastLoginIPValueFlag)
            {
                dic.Add("LastLoginIP", model.LastLoginIP);
            }
            if (model.IsLockValueFlag)
            {
                dic.Add("IsLock", model.IsLock);
            }
            return(DBHelper.InsertInto("MldAdmin", dic));
        }
Example #2
0
        public bool Update(AMW.Model.Entity.MldAdmin model)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (model.RidValueFlag)
            {
                dic.Add("Rid", model.Rid);
            }
            if (model.NameValueFlag)
            {
                dic.Add("Name", model.Name);
            }
            if (model.PwdValueFlag)
            {
                dic.Add("Pwd", model.Pwd);
            }
            if (model.AddTimeValueFlag)
            {
                dic.Add("AddTime", model.AddTime);
            }
            if (model.LastLoginTimeValueFlag)
            {
                dic.Add("LastLoginTime", model.LastLoginTime);
            }
            if (model.LastLoginIPValueFlag)
            {
                dic.Add("LastLoginIP", model.LastLoginIP);
            }
            if (model.IsLockValueFlag)
            {
                dic.Add("IsLock", model.IsLock);
            }
            return(DBHelper.Update("MldAdmin").Set(dic).Where("id=@1", model.ID).Execute() > 0);
        }
Example #3
0
        public ActionResult EditPwd(string oldpwd, string newpwd, string anewpwd)
        {
            ViewBag.Error = "none";
            using (BasicDB db = new BasicDB(false))
            {
                AMW.Model.Entity.MldAdmin model = CurrentAdmin;
                if (model.Pwd.Equals(Common.Encryption.GetAdminPwd(oldpwd)))
                {
                    if (newpwd.Equals(anewpwd) && !string.IsNullOrEmpty(newpwd))
                    {
                        model.Pwd = Common.Encryption.GetAdminPwd(newpwd);

                        if (adminDal.Update(model))
                        {
                            ViewBag.Success = "ok";
                        }
                        else
                        {
                            ViewBag.Error = "Edit Password Error";
                        }
                    }
                    else
                    {
                        ViewBag.Error = "The new password entered two times is inconsistent, and the password changes failed.";
                    }
                }
                else
                {
                    ViewBag.Error = "The old password you entered is incorrect, and the password is changed.";
                }
            }
            return(View());
        }