Пример #1
0
        public ActionResult EditUserInfo(Users user)
        {
            int id       = Convert.ToInt32(Request["Id"]);
            var userinfo = userbll.LoadEntities(c => c.Id == id).FirstOrDefault();

            if (userinfo != null)
            {
                string userrole  = Request["UserRoleId"];
                var    roleid    = rolebll.LoadEntities(c => c.RoleName == userrole).FirstOrDefault();
                string userstate = Request["UserStateId"];
                var    stateid   = statebll.LoadEntities(c => c.Name == userstate).FirstOrDefault();
                userinfo.LoginId     = user.LoginId;
                userinfo.LoginPwd    = user.LoginPwd;
                userinfo.Name        = user.Name;
                userinfo.Address     = user.Address;
                userinfo.Phone       = user.Phone;
                userinfo.Mail        = user.Mail;
                userinfo.UserRoleId  = roleid.RoleId;
                userinfo.UserStateId = stateid.Id;
                userinfo.Money       = user.Money;
                if (userbll.UpdateEntity(userinfo))
                {
                    return(Content("ok"));
                }
                else
                {
                    return(Content("no"));
                }
            }
            else
            {
                return(Content("no"));
            }
        }
Пример #2
0
        //更新数据
        public void UpdatePersonal(Users user)
        {
            string address_p = Request["location_p"];
            string address_c = Request["location_c"];
            string address_a = Request["location_a"];
            string address   = address_p + address_c + address_a + Request["address"];
            string imgurl    = Request["imgurl"];
            int    id        = Convert.ToInt32(Request["id"]);
            var    model     = userbll.LoadEntities(c => c.Id == id).FirstOrDefault();

            model.LoginId = user.LoginId;
            model.Name    = user.Name;
            model.Phone   = user.Phone;
            model.Address = address;
            model.Image   = imgurl;
            if (string.IsNullOrEmpty(user.Name))
            {
                WebCommon.Show("姓名不能为空!");
            }
            else if (string.IsNullOrEmpty(user.Phone))
            {
                WebCommon.Show("电话不能为空!");
            }
            if (userbll.UpdateEntity(model))
            {
                WebCommon.ShowUrl("更新成功", "/Personal/Index");
            }
            else
            {
                WebCommon.Show("更新失败");
            }
        }
Пример #3
0
 public void ForgetRepwd(Users user)
 {
     if (string.IsNullOrEmpty(user.LoginPwd) || string.IsNullOrEmpty(Request["LoginRepwd"]))
     {
         WebCommon.GoBack("亲,数据还没有填完哦!");
     }
     else
     {
         if (user.LoginPwd != Request["LoginRepwd"])
         {
             WebCommon.GoBack("亲,密码与确认密码不一致哦!");
         }
         else
         {
             var selid = userbll.LoadEntities(c => c.Mail == user.Mail).FirstOrDefault();
             if (selid != null)
             {
                 selid.LoginPwd = user.LoginPwd.Md5();
                 if (userbll.UpdateEntity(selid))
                 {
                     //将激活状态改为true
                     var activestate = emailactivebll.LoadEntities(c => c.UserId == selid.Id).FirstOrDefault();
                     activestate.ActiveState = true;
                     if (emailactivebll.UpdateEntity(activestate))
                     {
                         WebCommon.GoNext("重置密码成功", "登录页面", "/Account/Index");
                     }
                     else
                     {
                         WebCommon.GoBack("亲,激活状态更新失败了哦!");
                     }
                 }
                 else
                 {
                     WebCommon.GoBack("亲,更新失败了哦!");
                 }
             }
             else
             {
                 WebCommon.ShowUrl("亲,参数错误,请重试!", "/Account/ForgetPwd");
             }
         }
     }
 }