Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserInfoBLL bll = new UserInfoBLL();

            if (!IsPostBack)
            {
                int id;
                if (int.TryParse(Request.QueryString["id"], out id))
                {
                    EdUser = bll.GetUserById(id);
                }
                else
                {
                    Response.Write("paras Error");
                }
            }
            else
            {
                UserInfo user = new UserInfo();
                user.UserId   = Convert.ToInt32(Request.Form["id"]);
                user.UserName = Request.Form["name"];
                user.UserPwd  = Encryption.MD5encryption(Request.Form["pwd"]);

                if (bll.EditUser(user) > 0)
                {
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    Response.Write("Error");
                }
            }
        }
Beispiel #2
0
        public JsonResult SaveUser(SYS_USERINFO user)
        {
            if (user == null)
            {
                return(Json(new { result = "error", mesage = "用户数据为空" }));
            }
            string errMsg = "";

            if (user.ID == 0)
            {
                user.CreateTime = DateTime.Now;
                //add
                appUserBll.AddUser(user, ref errMsg);

                //Common.LogHelper.InsertLog(String.Format("新增用户,ID-{0}", user.ID.ToString()), 43, "后台用户");
            }
            else
            {
                //edit
                appUserBll.EditUser(user, ref errMsg);
                //Common.LogHelper.InsertLog(String.Format("编辑用户,ID-{0}", user.ID.ToString()), 43, "后台用户");
            }

            var result = new { result = "ok", message = "操作成功" };

            if (!string.IsNullOrEmpty(errMsg))
            {
                result = new { result = "error", message = errMsg };
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            UserInfoBLL bll = new UserInfoBLL();

            int      id   = Convert.ToInt32(context.Request.Form["id"]);
            UserInfo user = bll.GetUserById(id);

            if (user != null)
            {
                user.UserId   = id;
                user.UserName = context.Request.Form["name"];
                user.UserPwd  = context.Request.Form["pwd"];
                //bll.EditUser(user);
                if (bll.EditUser(user) > 0)
                {
                    context.Response.Redirect("UserInfoList.ashx");
                }
                else
                {
                    context.Response.Write("Edit Faild");
                }
            }
        }
Beispiel #4
0
        public ApiMessage <string> EditUser(UserInfoEx user)
        {
            user.ID       = UserInfo.Id;
            user.UserCode = UserInfo.UserCode;
            var api = _bll.EditUser(user);

            if (api.Success)
            {
                var key         = Encrypt.MD5(UserInfo.Id + "_用户");
                var currentUser = (CurrentUser)CacheHelper.GetCache(key);
                currentUser.UserName = user.UserName;
                currentUser.ImageUrl = user.ImgUrl;
                CacheHelper.SetCache(key, currentUser, new TimeSpan(0, 30, 0));
            }
            return(api);
        }
Beispiel #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            UserInfo user = new UserInfo();

            user.UserId   = Convert.ToInt32(context.Request["id"]);
            user.UserName = context.Request["name"];
            user.UserPwd  = Common.Encryption.MD5encryption(context.Request["pwd"]);
            UserInfoBLL bll = new UserInfoBLL();

            if (bll.EditUser(user) > 0)
            {
                context.Response.Write("yes");
            }
            else
            {
                context.Response.Write("no");
            }
        }