Example #1
0
 public ActionResult CreateUser(UserRegModel userReg)
 {
     try
     {
         var user = db.FP_WMS_UserInfo.SingleOrDefault(t => t.username == userReg.username);
         if (user != null)
         {
             return(Json(new { Status = 0, Content = "用户已存在" }));
         }
         FP_WMS_UserInfo new_user = new FP_WMS_UserInfo();
         new_user.roleid       = 3;
         new_user.roles        = "";
         new_user.departid     = 0;
         new_user.departname   = "";
         new_user.departlist   = "";
         new_user.departs      = "";
         new_user.display      = 0;
         new_user.gradeid      = 0;
         new_user.types        = "";
         new_user.username     = userReg.username;
         new_user.password     = FPUtils.MD5(userReg.password);
         new_user.password2    = "";
         new_user.email        = "";
         new_user.isemail      = 0;
         new_user.mobile       = userReg.phonenumber;
         new_user.ismobile     = 0;
         new_user.realname     = userReg.truename;
         new_user.cardtype     = "";
         new_user.idcard       = "";
         new_user.isreal       = 0;
         new_user.usercode     = "";
         new_user.nickname     = "";
         new_user.avatar       = "";
         new_user.sex          = "";
         new_user.exp          = 0;
         new_user.credits      = 0;
         new_user.regip        = CreateExamHelp.GetLocalIP();
         new_user.joindatetime = DateTime.Now;
         new_user.sumlogin     = 0;
         new_user.lastip       = "";
         new_user.lastvisit    = new_user.joindatetime;
         new_user.secques      = "";
         new_user.authstr      = "";
         new_user.authtime     = new_user.joindatetime;
         new_user.authflag     = 1;
         new_user.vipdate      = "";
         new_user.state        = 1;
         new_user.issso        = 0;
         new_user.extend       = "{}";
         db.FP_WMS_UserInfo.Add(new_user);
         db.SaveChanges();
         return(Json(new { Status = 1, Content = "注册成功,请等待管理员审核" }));
     }
     catch (Exception e)
     {
         return(Json(new { Status = 0, Content = "注册失败出现异常" }));
     }
 }
Example #2
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            FP_ExamEntities db = new FP_ExamEntities();

            if (HttpContext.Current.Session["FP_WAPLOGIN"] == null)
            {
                HttpContext.Current.Response.Redirect("/Login/Index");
            }
            else
            {
                //检测用户信息
                FP_WMS_UserInfo nowuser  = HttpContext.Current.Session["FP_WAPLOGIN"] as FP_WMS_UserInfo;
                FP_WMS_UserInfo userindb = db.FP_WMS_UserInfo.SingleOrDefault(t => t.id == nowuser.id);
                if (userindb == null)
                {
                    HttpContext.Current.Session.Remove("FP_WAPLOGIN");
                    HttpContext.Current.Response.Redirect("/Login/Index");
                }
                nowuser = userindb;
            }
        }