示例#1
0
        public List <string> userType(DoctorAccount da)
        {
            List <string> result = new List <string>();
            var           name   = da.UserName;
            var           type   = "";
            var           userID = "";
            var           users1 = from s in DataContainer.NationalCenterAccountSet.ToList() select s;
            var           user1  = users1.Where(s => s.UserName == da.UserName && s.PassWord == da.PassWord).FirstOrDefault();
            var           users2 = from s in DataContainer.RegionalCenterAccountSet.ToList() select s;
            var           user2  = users2.Where(s => s.UserName == da.UserName && s.PassWord == da.PassWord).FirstOrDefault();
            var           users3 = from s in DataContainer.DoctorAccountSet.ToList() select s;
            var           user3  = users3.Where(s => s.UserName == da.UserName && s.PassWord == da.PassWord).FirstOrDefault();

            if (user1 != null)
            {
                type   = "administrator";
                userID = user1.ID.ToString();
            }
            if (user2 != null)
            {
                type   = "region";
                userID = user2.ID.ToString();
            }
            if (user3 != null)
            {
                type   = "doctor";
                userID = user3.Id.ToString();
            }
            result.Add(type);
            result.Add(userID);
            return(result);
        }
        public ActionResult Index(DoctorAccount dacount)
        {
            UserOperation UOpertation = new UserOperation();
            if (UOpertation.ValidateUser(dacount.UserName,dacount.PassWord))
            {
                HttpCookie cookie = new HttpCookie("username", dacount.UserName);
                Response.Cookies.Add(cookie);
                return RedirectToAction("Index", "EnterPatInfor");

            }
            else
            {
                ViewBag.message = "用户名或密码错误";
                return View();
            }
        }
示例#3
0
        public bool InsertPat(PatBasicInfor pat, string PID, string User)
        {
            try
            {
                pat.Id = System.Guid.NewGuid().ToString().Replace("-", "");
                Lifestyle lstyle = new Lifestyle();
                lstyle.PatBasicInfor = pat;
                pat.Lifestyle        = lstyle;
                var           users = from s in context.DoctorAccountSet.ToList() select s;
                DoctorAccount user  = users.Where(s => s.UserName == User).FirstOrDefault();
                user.PatBasicInfor.Add(pat);

                context.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }