Пример #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);
     }
 }
Пример #2
0
 public List<book_info_table> getBookByPatientAccountName(String accountName)
 {
     PatientLogin pl = new PatientLogin();
     user_info_table user =  pl.getUserByAccountName(accountName);
     long patientId = user.user_id;
     return getBookByPatientId(patientId);
 }
Пример #3
0
 public JsonResult getPatientInfo(long user_id)
 {
     PatientLogin pl = new PatientLogin();
     user_info_table user = pl.getUserById(user_id);
     if (user == null)
     {
         return Json(new { code = 0, msg = "用户不存在" }, JsonRequestBehavior.AllowGet);
     }
     return Json(new { code = 1, msg = user }, JsonRequestBehavior.AllowGet);
 }
Пример #4
0
 public static List<CaseDetail> getListByPAccount(String account_name)
 {
     List<CaseDetail> result = new List<CaseDetail>();
     user_info_table patient = new PatientLogin().getUserByAccountName(account_name);
     if (patient != null)
     {
         result = getListByPId(patient.user_id);
     }
     return result;
 }
Пример #5
0
        public JsonResult IsAccountNameExist(String account_name)
        {
            bool isExist = false;
            PatientLogin pl = new PatientLogin();
            isExist = pl.isUserExist(account_name);
            if (isExist)
            {
                return Json(new { code = 0, msg = "用户名已存在" }, JsonRequestBehavior.AllowGet);

            }
            return Json(new { code = 1, msg = "用户名可用" }, JsonRequestBehavior.AllowGet);
        }
Пример #6
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);
        }
Пример #7
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);
 }