//新增医生
        public ActionResult CreateDoctor(UserDoctorList userDoctorList)
        {
            string IDCard   = userDoctorList.DoctorIdentity;
            string BirthDay = "";
            string strYear;
            string strMonth;
            string strDay;

            if (IDCard.Length == 15)
            {
                strYear  = IDCard.Substring(6, 4);
                strMonth = IDCard.Substring(10, 2);
                strDay   = IDCard.Substring(12, 2);
                BirthDay = strYear + "-" + strMonth + "-" + strDay;
                userDoctorList.DoctorDateOfBirth = BirthDay.AsDateTime();
            }
            if (IDCard.Length == 18)
            {
                strYear  = IDCard.Substring(6, 4);
                strMonth = IDCard.Substring(10, 2);
                strDay   = IDCard.Substring(12, 2);
                BirthDay = strYear + "-" + strMonth + "-" + strDay;
                userDoctorList.DoctorDateOfBirth = BirthDay.AsDateTime();
            }


            Bll.CreateUserDoctorList(userDoctorList);
            return(RedirectToAction("CreateDoctor"));
        }
        public ActionResult Login(string DoctorAccount, string DoctorPassword)
        {
            UserDoctorList userDoctorList = Bll.SelectDoctorList(DoctorAccount, DoctorPassword);

            if (userDoctorList == null)
            {
                return(Content("<script>alert('账号或密码错误!');history.go(-1);</script>"));
            }
            else if (userDoctorList.AdministratorOrNot == "2")
            {
                return(Content("<script>alert('此账号已被冻结,请寻找诊所管理人员!');history.go(-1);</script>"));
            }
            else
            {
                Session["Doctor"] = userDoctorList;
                return(RedirectToAction("Index"));
            }
        }
        public void IsAdministratorOrNot(int id)
        {
            UserDoctorList userDoctorList = db.UserDoctorList.Find(id);

            if (userDoctorList.AdministratorOrNot == "0")
            {
                userDoctorList.AdministratorOrNot = "1";
                db.SaveChanges();
            }
            else if (userDoctorList.AdministratorOrNot == "1")
            {
                userDoctorList.AdministratorOrNot = "2";
                db.SaveChanges();
            }
            else
            {
                userDoctorList.AdministratorOrNot = "0";
                db.SaveChanges();
            }
        }
 public ActionResult EditUserDoctorList(UserDoctorList userDoctorList)
 {
     Bll.EditUserDoctorList(userDoctorList);
     return(RedirectToAction("CreateDoctor"));
 }
        //详细+修改
        public ActionResult EditUserDoctorList(int id)
        {
            UserDoctorList userDoctorList = Bll.EditUserDoctorList(id);

            return(View(userDoctorList));
        }
 //保存修改
 public void EditUserDoctorList(UserDoctorList userDoctorList)
 {
     db.Entry(userDoctorList).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
 }
 //新增医生
 public void CreateUserDoctorList(UserDoctorList userDoctorList)
 {
     db.UserDoctorList.Add(userDoctorList);
     db.SaveChanges();
 }
        //验证医生登录号
        public UserDoctorList SelectDoctorList(string DoctorAccount, string DoctorPassword)
        {
            UserDoctorList userDoctorList = db.UserDoctorList.SingleOrDefault(p => p.DoctorAccount == DoctorAccount && p.DoctorPassword == DoctorPassword);

            return(userDoctorList);
        }
 //保存修改
 public void EditUserDoctorList(UserDoctorList userDoctorList)
 {
     Dal.EditUserDoctorList(userDoctorList);
 }
示例#10
0
 //新增医生
 public void CreateUserDoctorList(UserDoctorList userDoctorList)
 {
     Dal.CreateUserDoctorList(userDoctorList);
 }