示例#1
0
 /// <summary>
 /// 写入操作日志信息
 /// </summary>
 /// <returns></returns>
 public static void AddOpera(Model.System.sys_LoginUser loginUserModel, int menuId, string operaType, string memo)
 {
     Model.System.sys_Config configModel = new BLL.System.sys_Config().loadConfig();
     if (configModel.logstatus == 1)
     {
         Model.System.sys_OperaLog operaModel = new Model.System.sys_OperaLog();
         if (loginUserModel != null)
         {
             operaModel.PerId      = loginUserModel.ID;
             operaModel.PerName    = loginUserModel.PerName;
             operaModel.PerAccount = loginUserModel.Account;
             operaModel.MenuId     = menuId;
             operaModel.OperaType  = operaType;
             operaModel.Memo       = memo;
             operaModel.OperaTime  = DateTime.Now;
             operaModel.LoginIP    = loginUserModel.LoginIP;
             try
             {
                 new BLL.System.sys_OperaLog().Add(operaModel);
             }
             catch
             {
                 throw;
             }
         }
     }
 }
示例#2
0
 /// <summary>
 /// 从登录Model获取操作日志信息
 /// </summary>
 /// <returns></returns>
 public static Model.System.sys_OperaLog GetOperaModel(Model.System.sys_LoginUser LoginUserModel)
 {
     Model.System.sys_OperaLog operaModel = new Model.System.sys_OperaLog();
     if (LoginUserModel != null)
     {
         operaModel.PerId      = LoginUserModel.ID;
         operaModel.PerName    = LoginUserModel.PerName;
         operaModel.PerAccount = LoginUserModel.Account;
         operaModel.OperaTime  = DateTime.Now;
         operaModel.LoginIP    = LoginUserModel.LoginIP;
     }
     return(operaModel);
 }
示例#3
0
        private void ModifyPwd(HttpContext context)
        {
            try
            {
                string loginSalt = RequestHelper.GetQueryString("LoginSalt");
                if (loginSalt == "")
                {
                    context.Response.Write("{\"status\":\"0.1\",\"msg\":\"Salt不能为空!\"}");
                    return;
                }
                Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();
                if (loginUserModel == null || loginUserModel.Salt != loginSalt)
                {
                    context.Response.Write("{\"status\":\"0.1\",\"msg\":\"登录超时,请重新登录!\"}");
                    return;
                }

                string oldPwd             = RequestHelper.GetString("oldPwd");
                string newPwd             = RequestHelper.GetString("newPwd");
                BLL.System.sys_Person bll = new BLL.System.sys_Person();


                string errMessage = bll.UpdatePwd(loginUserModel.Account, oldPwd, newPwd);
                if (errMessage != "")
                {
                    context.Response.Write("{\"status\":\"0\",\"msg\":\"" + errMessage + "\"}");
                    return;
                }
                //写入操作日志

                Model.System.sys_OperaLog operaModel = BaseWeb.GetOperaModel(loginUserModel);
                operaModel.OperaType = Enums.ActionEnum.Login.ToString();
                operaModel.Memo      = "修改密码";
                new BLL.System.sys_OperaLog().Add(operaModel);

                context.Response.Write("{\"status\":\"1\",\"msg\":\"密码修改成功!\"}");
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }