public static DoctorDTO ToDoctorDTO(this DoctorAccount doctor)
        {
            var memento = doctor.GetDoctorMemento();

            return(new DoctorDTO()
            {
                Name = memento.Name,
                Surname = memento.Surname,
                Jmbg = memento.Jmbg
            });
        }
示例#2
0
        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());
            }
        }
        public ActionResult Index(DoctorAccount dacount, RegionalCenterAccount reaccount, NationalCenterAccount naccount)
        {
            UserOperation        UOpertation  = new UserOperation();
            List <DoctorAccount> SelectedDocs = new List <DoctorAccount>();
            List <string>        result       = new List <string>();

            result = UOpertation.userType(dacount);
            var type   = result[0];
            var userID = result[1];

            if (type != "")
            {
                HttpCookie cookie     = new HttpCookie("username", reaccount.UserName);
                HttpCookie cookieID   = new HttpCookie("userID", userID);
                HttpCookie cookieType = new HttpCookie("userType", type);
                Response.Cookies.Add(cookie);
                Response.Cookies.Add(cookieID);
                Response.Cookies.Add(cookieType);
                if (type == "administrator")
                {
                    return(RedirectToAction("Index", "Nation"));
                }
                if (type == "region")
                {
                    return(RedirectToAction("Index", "Region"));
                }
                if (type == "doctor")
                {
                    return(RedirectToAction("Index", "EnterPatInfor"));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                ViewBag.message = "用户名或密码错误";
                return(View());
            }
        }
 public ActionResult addNewAccount(string userRole, string userName, string realName, string Password)
 {
     try
     {
         UserOperation uoperation = new UserOperation();
         var           username   = HttpContext.Request.Cookies["username"].Value.ToString();
         var           userId     = HttpContext.Request.Cookies["userID"].Value.ToString();
         int           userID     = Convert.ToInt16(userId);
         var           name       = userName;
         var           duplicate  = uoperation.duplicaionName(name);
         if (duplicate)
         {
             var type = userRole;
             if (type == "医生账号")
             {
                 DoctorAccount daccount = new DoctorAccount();
                 daccount.UserName = userName;
                 daccount.PassWord = Password;
                 daccount.Hospital = realName;
                 daccount.RegionalCenterAccountID = userID;
                 daccount.ChiefDoctor             = realName;
                 RegionalCenterAccount rca = new RegionalCenterAccount();//制定region账号
                 DataContainer.DoctorAccountSet.Add(daccount);
                 DataContainer.SaveChanges();
             }
             return(this.Json(new { OK = true, Message = "添加成功" }));
         }
         else
         {
             ViewBag.message = "添加失败,该用户名已存在";
             return(this.Json(new { OK = false, Message = "添加失败,此用户名已存在" }));
         }
     }
     catch (DbEntityValidationException dbEx)
     {
         var str = dbEx.ToString();
         return(this.Json(new { OK = false, Message = str }));
     }
 }
 public ActionResult changeAccount(string targetId, string userRole, string userName, string realName, string Password)
 {
     try
     {
         var           id       = int.Parse(targetId);
         var           userId   = HttpContext.Request.Cookies["userID"].Value.ToString();
         int           userID   = Convert.ToInt16(userId);
         DoctorAccount daccount = new DoctorAccount();
         daccount.Id       = id;
         daccount.UserName = userName;
         daccount.PassWord = Password;
         daccount.Hospital = realName;
         daccount.RegionalCenterAccountID = userID;
         daccount.ChiefDoctor             = realName;
         DataContainer.DoctorAccountSet.Add(daccount);
         DataContainer.Entry(daccount).State = System.Data.EntityState.Modified;
         DataContainer.SaveChanges();
         return(this.Json(new { OK = true, Message = "修改成功" }));
     }
     catch (DbEntityValidationException dbEx)
     {
         return(this.Json(new { OK = false, Message = dbEx.ToString() }));
     }
 }
示例#6
0
 public HomePageController(ServerIP IPConfig, JsonStructure jsonStructureConfig,
                           DoctorAccount doctorAccountConfig) : base(IPConfig)
 {
     DoctorAccountConfig = doctorAccountConfig;
     JsonStructureConfig = jsonStructureConfig;
 }
示例#7
0
 public HomeController(MQTTClient MQTTClient, DoctorAccount doctorAccountConfig)
 {
     this.MQTTClient     = MQTTClient;
     DoctorAccountConfig = doctorAccountConfig;
 }