示例#1
0
        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="context"></param>
        public void UpdateUserInfo(HttpContext context)
        {
            if (!string.IsNullOrWhiteSpace(context.Request["Id"]))
            {
                try
                {
                    PMSModel.UserInfo advert = BllUIS.GetEntityById(int.Parse(context.Request["Id"])).retData as PMSModel.UserInfo;
                    if (advert != null)
                    {
                        if (!string.IsNullOrWhiteSpace(context.Request["IsDelete"]))
                        {
                            advert.IsDelete = Convert.ToByte(context.Request["IsDelete"]);
                        }

                        PMSModel.JsonModel jsonModel = BllUIS.Update(advert);
                        jsonModel.status = "yes";
                        context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Error(ex);
                    PMSModel.JsonModel jsonModel = new PMSModel.JsonModel()
                    {
                        errMsg  = ex.Message,
                        retData = "",
                        status  = "no"
                    };
                    context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
                }
            }
        }
示例#2
0
        /// <summary>
        /// 获得用户信息
        /// </summary>
        /// <param name="context"></param>
        public void GetUserInfo(HttpContext context)
        {
            string Id = context.Request["Id"];

            try
            {
                if (!string.IsNullOrWhiteSpace(Id))
                {
                    PMSModel.UserInfo  ui        = new PMSModel.UserInfo();
                    PMSModel.JsonModel jsonModel = BllUIS.GetEntityById(int.Parse(Id));
                    if (jsonModel.retData != null)
                    {
                        ui = jsonModel.retData as PMSModel.UserInfo;
                        jsonModel.retData = ui;
                        context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
                    }
                }
                else
                {
                    PMSModel.JsonModel jsonModel = new PMSModel.JsonModel()
                    {
                        errMsg  = "null",
                        retData = "",
                        status  = "no"
                    };
                    context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                PMSModel.JsonModel jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
示例#3
0
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="context"></param>
        public void EditUserInfo(HttpContext context)
        {
            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();

            try
            {
                string            Id                = context.Request["Id"];
                string            LoginName         = context.Request["LoginName"];
                string            LoginPassword_New = context.Request["LoginPassword_New"];
                string            LoginPassword_Old = context.Request["LoginPassword_Old"];
                string            LoginPassword     = context.Request["LoginPassword"];
                string            RoleId            = context.Request["RoleId"];
                PMSModel.UserInfo info              = new PMSModel.UserInfo();

                if (!string.IsNullOrWhiteSpace(LoginPassword))
                {
                    info.LoginPassword = EncryptHelper.Md5By32(LoginPassword);
                }
                info.RoleId = Convert.ToInt32(RoleId);
                if (!string.IsNullOrWhiteSpace(Id))
                {
                    List <PMSModel.UserInfo> ui = BllUIS.GetEntityListByField("Id", Id).retData as List <PMSModel.UserInfo>;
                    if (!string.IsNullOrEmpty(LoginPassword_Old) && ui.Count > 0)
                    {
                        if (EncryptHelper.Md5By32(LoginPassword_Old) == ui[0].LoginPassword)
                        {
                            info.Id   = int.Parse(context.Request["Id"]);
                            jsonModel = BllUIS.Update(info);
                        }
                        else
                        {
                            jsonModel = new PMSModel.JsonModel()
                            {
                                errMsg  = "novaled",
                                retData = "",
                                status  = "no"
                            };
                        }
                    }
                }
                else
                {
                    List <PMSModel.UserInfo> ui = BllUIS.GetEntityListByField("LoginName", LoginName).retData as List <PMSModel.UserInfo>;
                    if (ui != null && ui.Count > 0)
                    {
                        jsonModel = new PMSModel.JsonModel()
                        {
                            errMsg  = "exist",
                            retData = "",
                            status  = "no"
                        };
                    }
                    else
                    {
                        info.LoginName  = LoginName;
                        info.CreateTime = DateTime.Now;
                        info.IsDelete   = (int)PMSUtility.SysStatus.正常;
                        jsonModel       = BllUIS.Add(info);
                    }
                }
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }