Beispiel #1
0
 //
 // GET: /Login/
 public ActionResult Login(String account_name=null,String pwd=null,int user_type=0)
 {
     // this.Response.Cookies.Add(
     if (account_name == null || pwd == null || user_type == 0)
     {
           return View();
     }
     else{
         user_info_table user = new user_info_table();
         user.account_name = account_name;
         user.pwd =pwd;
         user.user_type = user_type;
         PatientLogin pl = new PatientLogin();
         user = pl.login(user);
         if (user != null)
         {
             //写入cookies
             HttpCookie newCookie = new HttpCookie("Log");
             newCookie.Values.Set("isLog", "true");
             newCookie.Values.Set("user_id", user.user_id.ToString());
             newCookie.Expires = DateTime.Now.AddDays(10);
             Response.AppendCookie(newCookie);
             //重定向到主页
             return Json(new { code = 1, msg = "登陆成功" }, JsonRequestBehavior.AllowGet);
         }
         return Json(new { code = 0, msg = "用户名密码错误" }, JsonRequestBehavior.AllowGet);
     }
 }
Beispiel #2
0
        public JsonResult addUser(user_info_table user)
        {
            //user_info_table user = new user_info_table();
            //user.account_name = "pkxiuluo";
            //user.pwd = "111";
            //user.user_name = "网易通";

               // user.birthday = DateTime.Now;

            user.user_type = 1;//1:患者2:医生3:管理员
            PatientLogin pl = new PatientLogin();
            pl.register(user);
            return Json(new { code =1, msg = "注册成功" }, JsonRequestBehavior.AllowGet);
        }
Beispiel #3
0
 partial void Deleteuser_info_table(user_info_table instance);
Beispiel #4
0
 partial void Updateuser_info_table(user_info_table instance);
Beispiel #5
0
 partial void Insertuser_info_table(user_info_table instance);
Beispiel #6
0
 public JsonResult updatePInfo(user_info_table user)
 {
     PatientLogin pl = new PatientLogin();
     user_info_table temp = pl.getUserById(user.user_id);
     if (temp != null)
     {
         pl.updateUser(user);
         return Json(new { code = 1, msg = "修改成功" }, JsonRequestBehavior.AllowGet);
     }
     return Json(new { code = 0, msg = "指定用户不存在" }, JsonRequestBehavior.AllowGet);
 }