Ejemplo n.º 1
0
 //
 private string UserLogin(HttpContext context)
 {
     try
     {
         if (dal.ShieldingUsers(Component.GetMac()))
         {
             return("你的电脑已经被本系统屏蔽,你没有能力登录,怎么样?高兴吧!");
         }
         dynamic adminUser = null;
         string  username  = context.Request.Form["username"] as string;
         string  password  = context.Request.Form["password"] as string;
         string  randid    = context.Request.Form["randid"] as string;
         string  CheckCode = context.Session["CheckCode"] as string;
         if (randid.ToUpper().Equals(CheckCode.ToUpper()))
         {
             if (dal.CheckUserName(username))
             {
                 adminUser = dal.AdminUserLogin(username, password);
                 if (!string.IsNullOrEmpty(adminUser.AdminLogPass))
                 {
                     if (0 != adminUser.AdminState)
                     {
                         context.Session.Add("SuperAdminUserSession", adminUser);
                         dal.NumberLogin(adminUser.Id);
                         SysLogBll.Create("登陆页面", "登陆成功", adminUser.AdminName);
                         AddCookie(context, adminUser.Id.ToString());
                         return("Y");
                     }
                     else
                     {
                         SysLogBll.Create("登陆页面", "账户禁用", adminUser.AdminName);
                         return("用于登录后台管理的账户已经被禁用!");
                     }
                 }
                 else
                 {
                     SysLogBll.Create("登陆页面", "密码错误", adminUser.AdminName);
                     return("密码不正确请重新输入密码!");
                 }
             }
             else
             {
                 SysLogBll.Create("登陆页面", "用户名错误", adminUser.AdminName);
                 return("用户名不存在请联系上级单位!");
             }
         }
         else
         {
             SysLogBll.Create("登陆页面", "验证码错误", adminUser.AdminName);
             return("验证码错误请重新输入!");
         }
     }
     catch (Exception ex)
     {
         SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]");
         return("系统异常错误代码:500 " + ex.Message);
     }
 }
Ejemplo n.º 2
0
        //
        public static void Create(string logValue, string operates, string editor)
        {
            SysLog model = new SysLog();

            model.Editor   = editor;
            model.IpAdd    = Component.GetClientIP();
            model.LogValue = logValue;
            model.MacAdd   = Component.GetMac();
            model.Operates = operates;
            new SysLogDal().Create(model);
        }