Exemplo n.º 1
0
 public static bool SetTreatmentInfo(ServicesSoapClient _ServicesSoapClient, TreatmentViewModel Tr, UserAndRole user)
 {
     string UserId = Tr.PId;
     string TreatmentGoal = Tr.TreatmentInfo.TreatmentGoal;
     string TreatmentAction = Tr.TreatmentInfo.TreatmentAction;
     string Group = Tr.TreatmentInfo.Group;
     string TreatmentPlan = Tr.TreatmentInfo.TreatmentPlan;
     string Description = string.Empty;
     //取数据库时间
     DateTime TreatTime = DateTime.Now; //输入无效,数据库取当前时间自动存入
     string Duration = Tr.TreatmentInfo.Duration;
     bool SetTreatmentInfoFlag = _ServicesSoapClient.SetTreatmentInfo(UserId, Convert.ToInt32(TreatmentGoal), Convert.ToInt32(TreatmentAction), Convert.ToInt32(Group), TreatmentPlan, Description, TreatTime, Duration, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
     return SetTreatmentInfoFlag;
 }
Exemplo n.º 2
0
        public ActionResult LogOn(LogOnModel LogOnModel, string control, string page)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var UserId = LogOnModel.UserId;
                    var Password = LogOnModel.Password;
                    var Type = "";
                    var EmailFlag = Regex.IsMatch(UserId, @"(^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$)");
                    var PhoneFlag = Regex.IsMatch(UserId, @"(^1[3-8]\d{9}$)");
                    if (EmailFlag == true)
                    {
                        Type = "EmailAdd";
                    }
                    if (PhoneFlag == true)
                    {
                        Type = "PhoneNo";
                    }
                    if (Type != "")
                    {
                        UserId = _ServicesSoapClient.GetIDByInput(Type, UserId);
                    }
                    if (_ServicesSoapClient.CheckUserExist(UserId) == true)
                    {
                        if (_ServicesSoapClient.CheckPassword(UserId, Password) == 1)
                        {
                            var CurrentUser = new UserAndRole();
                            CurrentUser.UserId = UserId;
                            CurrentUser.UserName = _ServicesSoapClient.GetUserName(UserId);
                            //CurrentUser.Role = _ServicesSoapClient.GetClassByUserId(UserId);
                            var RoleList = _ServicesSoapClient.GetAllRoleMatch(UserId);
                            //var Role = RoleList.Tables[0].Rows[0]["RoleClass"];
                            var length = RoleList.Tables[0].Rows.Count;
                            string[] RoleClass = new string[length];
                            for (int i = 0; i < length; i++)
                            {
                                RoleClass[i] = RoleList.Tables[0].Rows[i]["RoleClass"].ToString();
                                if (RoleClass[i] == "Administrator")
                                {
                                    CurrentUser.Role = "Administrator";
                                }
                                else if (RoleClass[i] == "Doctor")
                                {
                                    CurrentUser.Role = "Doctor";
                                }
                            }
                            //CurrentUser.UserName = UserName;
                            CurrentUser.TerminalName = Dns.GetHostName();
                            string hostAddress = Request.ServerVariables.Get("Local_Addr").ToString();
                            if (hostAddress == "::1")
                            {
                                hostAddress = "127.0.0.1";
                            }
                            CurrentUser.TerminalIP = hostAddress;
                            CurrentUser.DeviceType = 1;

                            var ChangeLastLogOnTimeFlag = _ServicesSoapClient.UpdateLastLoginDateTime(CurrentUser.UserId, CurrentUser.UserName, CurrentUser.TerminalIP, CurrentUser.TerminalName, CurrentUser.DeviceType);
                            Session["CurrentUser"] = CurrentUser;
                            FormsAuthentication.SetAuthCookie(UserId, true);
                            if (control == null && page == null)
                            {
                                if (CurrentUser.Role == "Administrator")
                                {
                                    return RedirectToAction("Index", "Management");
                                }
                                else if (CurrentUser.Role == "Doctor")
                                {
                                    var ActivitionFlag = _ServicesSoapClient.GetActivatedState(UserId, "Doctor");
                                    if (ActivitionFlag == "0")
                                    {
                                        return RedirectToAction("PatientList", "DoctorHome");
                                    }
                                    else
                                    {
                                        return RedirectToAction("Activition", "Account");
                                    }

                                }
                                else
                                {
                                    ModelState.AddModelError("errorConnection", "该用户没有权限登录本系统");
                                    return View();
                                }
                                //switch (CurrentUser.Role)
                                //{
                                //    case "Administrator": return RedirectToAction("Index", "Dict");
                                //    case "Doctor": return RedirectToAction("PatientList", "DoctorHome");
                                //    //case "Patient": return RedirectToAction("HealthParameters", "PatientHome");
                                //    default: ModelState.AddModelError("", "该用户没有权限登录本系统");
                                //        return View();
                                //}
                            }
                            else
                            {
                                return RedirectToAction(page, control);
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("errorPassword", "密码错误,请重新输入密码");
                            return View(LogOnModel);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("errorUserId", "用户不存在,请重新输入用户ID");
                        return View(LogOnModel);
                    }
                }
                else
                {
                    return View(LogOnModel);
                }

            }
            catch (Exception)
            {
                ModelState.AddModelError("errorConnection", "数据库连接失败");
                return View(LogOnModel);
            }
        }
Exemplo n.º 3
0
 public static bool SetSymptomsInfo(ServicesSoapClient _ServicesSoapClient, SymptomsViewModel sy, int RecordDate, int RecordTime, UserAndRole user)
 {
     string symptomtype = sy.SymptomsTypeSelected;
     //string symptom = Request.Form["SymptomsNameSelected"];
     string symptom = sy.SymptomsNameSelected;
     string Description = sy.Description;
     string UserId = sy.PId;
     string VisitId = _ServicesSoapClient.GetNoByNumberingType(6);
     bool SetSymptomsInfoFlag = _ServicesSoapClient.SetSymptomsInfo(UserId, VisitId, symptomtype, symptom, Description, RecordDate, RecordTime, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
     return SetSymptomsInfoFlag;
 }
Exemplo n.º 4
0
 public JsonResult CheckResetPassword(string newPassword2, string UserId)
 {
     var CurrentUser = new UserAndRole();
     CurrentUser.UserId = UserId;
     CurrentUser.UserName = _ServicesSoapClient.GetUserName(UserId);
     CurrentUser.Role = _ServicesSoapClient.GetClassByUserId(UserId);
     //CurrentUser.UserName = UserName;
     CurrentUser.TerminalName = Dns.GetHostName();
     string hostAddress = Request.ServerVariables.Get("Local_Addr").ToString();
     if (hostAddress == "::1")
     {
         hostAddress = "127.0.0.1";
     }
     CurrentUser.TerminalIP = hostAddress;
     CurrentUser.DeviceType = 1;
     Session["CurrentUser"] = CurrentUser;
     var res = new JsonResult();
     //
     if (newPassword2 != null)
     {
         ResetPasswordFlag = _ServicesSoapClient.ResetPassword(UserId, "#*bme319*#", newPassword2, CurrentUser.UserId, CurrentUser.TerminalName, CurrentUser.TerminalIP, CurrentUser.DeviceType);
         if (ResetPasswordFlag == 1)
         {
             res.Data = true;
         }
         else
         {
             res.Data = false;
         }
     }
     res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
     return res;
 }