//修改密码 public ActionResult ChangeAc(string username, string name, string pass, string checkPass) { accountService accountS = new accountService(); if (pass == checkPass && accountS.Update(username, name, pass) == true) { return(Json("ture")); } else { return(Json("false")); } }
//管理员账号注册 public ActionResult ManAdd(string ID, string pass, string name) { accountService account = new accountService(); if (account.AddNew1(ID, pass, name, "Manager") == true) { return(Json("注册成功")); } else { return(Json("注册账号已存在")); } }
//护士账号注册 public ActionResult ManAdd1(string nurseID, string nurseName, string nursePassword, string nursePosition, string nurseDept_name, string nurseGender) { accountService accountS = new accountService(); NurseService nurseService = new NurseService(); account account = new account(); if (accountS.AddNew1(nurseID, nursePassword, nurseName, "Nurse") == false) { return(Json("账号已存在,请重新注册"));//ToDo } account.user_ID = nurseID; account.name = nurseName; nurseService.AddNew(account, nurseDept_name, nursePosition, 0, nurseGender); //返回值待定 return(Json("注册成功")); }
//医生账号注册 public ActionResult ManAdd2(string userID, string name, string pass, string dept, string position, string age, string sex) { accountService accounts = new accountService(); DoctorService doctorService = new DoctorService(); account account = new account(); if (accounts.AddNew1(userID, pass, name, "Doctor") == false)//ToDo { return(Json("账号已存在,请重新注册")); } account.user_ID = userID; account.name = name; int iu = int.Parse(age); doctorService.AddNew(account, dept, position, 0, iu, sex); //返回值待定 return(Json("注册成功")); }
//账号登录验证 public ActionResult Login(string ID, string pass) { accountService accountS = new accountService(); RegisterService registerService = new RegisterService(); if (ID == null || pass == null) { return(Json(null)); } AccountDTO accountDTO = accountS.Login(ID, pass); if (accountDTO != null) { registerService.Update(ID); return(Json(accountDTO)); } else { return(Json(null)); } }
//获得参与该手术的所有成员函数 public IEnumerable <Operation_participateDTO> GetAll(string op_ID) { accountService account = new accountService(); using (MyContext ctx = new MyContext()) { var si = ctx.Operation_Participates.Where(e => e.op_ID == op_ID); List <Operation_participateDTO> operation_ParticipateDTOs = new List <Operation_participateDTO>(); if (si == null) { return(null); } foreach (var s in si) { Operation_participateDTO operation_ParticipateDTO = new Operation_participateDTO(); operation_ParticipateDTO.op_ID = s.op_ID; operation_ParticipateDTO.person_ID = s.person_ID; operation_ParticipateDTO.person_name = account.backName(s.person_ID); operation_ParticipateDTOs.Add(operation_ParticipateDTO); } return(operation_ParticipateDTOs); } }