public ActionResult AddPatient(PatientViewModel patientViewModel)
        {
            //Czy model jest zgodny z założeniami?
            if (ModelState.IsValid)
            {
                var patient = patientRepository.GetPatientByPesel(patientViewModel.Pesel);
                //Czy jest już pacjent o takim numerze pesel?
                if (patient == null)
                {
                    patientRepository.AddPatient(new Patient()
                    {
                        Name        = patientViewModel.Name,
                        LastName    = patientViewModel.LastName,
                        Description = patientViewModel.Description,
                        Pesel       = patientViewModel.Pesel,
                        UserId      = User.Identity.GetUserId(),
                    });

                    patientRepository.Complete();

                    return(RedirectToAction("PatientList"));
                }
                ModelState.AddModelError(string.Empty, "Istnieje już pacjent o takim numerze pesel");
            }
            return(View());
        }
Пример #2
0
        protected void imgAdd_clicked(object sender, System.EventArgs e)
        {
            bool errored = false;

            try
            {
                patRepos.AddPatient(UserHelper.GetLoggedInUser(Session).UserID);
            }
            catch (Exception exce)
            {
                errored = true;

                if (exce.InnerException != null)
                {
                    lblMssg.Text = exce.InnerException.Message;
                }
                else
                {
                    lblMssg.Text = exce.Message;
                }
            }

            if (!errored)
            {
                LoadData();
            }
        }
Пример #3
0
        public void TestSearchMethod()
        {
            PatientRepository pr = new PatientRepository();
            Patient           p1 = PatientUnitTests.getValidPatient();

            string    validFirstname = p1.FirstName;
            StateEnum validState     = p1.State;

            pr.AddPatient(p1);

            pr.AddPatient(new Patient()
            {
                Address1  = "77 West Dr",
                City      = "Joelton",
                State     = StateEnum.TN,
                ZipCode   = "12345",
                FirstName = "John",
                LastName  = "Johnsonson",
                MRN       = "abcd1235"
            });

            Patient p2 = PatientUnitTests.getValidPatient();

            p2.FirstName = validFirstname + "son";
            pr.AddPatient(p2);

            Patient p3 = PatientUnitTests.getValidPatient();

            p3.State = validState + 1;
            pr.AddPatient(p3);

            {
                List <Patient> result = pr.Search(p => p.FirstName == validFirstname);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.TrueForAll(p => p.FirstName == validFirstname));
                Assert.IsTrue(result.Count == 2);
            }

            {
                List <Patient> result = pr.Search(p => p.State == validState);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.TrueForAll(p => p.State == validState));
                Assert.IsTrue(result.Count == 2);
            }
        }
Пример #4
0
 public ViewResult Registration(Patient patient)
 {
     if (ModelState.IsValid)
     {
         PatientRepository.AddPatient(patient);
         return(View("Thanks", patient));
     }
     else
     {
         return(View(patient));
     }
 }
Пример #5
0
 public ActionResult Create(PatientViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (repository.AddPatient(model))
             {
                 ViewBag.Message = "Patient Added Successfully";
                 ModelState.Clear();
             }
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public ActionResult AddPatient(PatientViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _repository.AddPatient(model.Patient);
         }
         catch (MongoDB.Driver.MongoSafeModeException e)
         {
             Response.TrySkipIisCustomErrors = true;
             Response.StatusCode             = 500;
             ModelState.AddModelError("", "The Patient ID already exists in the database.");
         }
         //return RedirectToAction("Index");
         return(PartialView(model));
     }
     else
     {
         Response.TrySkipIisCustomErrors = true;
         Response.StatusCode             = 500;
         return(PartialView(model));
     }
 }
 public ViewResult Index(Patient patient)
 {
     patient.CreationTime = DateTime.Now;
     PatientRepository.AddPatient(patient);
     return(View("Thanks", patient));
 }
        public ActionResult PatientRegistration(PatientViewModel patientViewModel)
        {
            if (!LogOnHelper.CheckLogOn()) return RedirectToAction("Login", "Account");

            if (!ModelState.IsValid)
            {
                return View(patientViewModel);
            }
            try
            {
                HealthReunionDataAccess.HealthReunionEntities dataContext = new HealthReunionDataAccess.HealthReunionEntities();
                PatientRepository patientRepository = new PatientRepository();

                Patient patient = new Patient();
                patient.PatientId = patientViewModel.PatientViewEntity.PatientId;
                patient.ProviderId = int.Parse(Session["ProviderId"].ToString());
                patient.MedicalRecordNumber = Guid.NewGuid();
                patient.LastName = patientViewModel.PatientViewEntity.LastName.Trim();
                patient.FirstName = patientViewModel.PatientViewEntity.FirstName.Trim();
                patient.MiddleName = patientViewModel.PatientViewEntity.MiddleName.Trim();
                patient.DOB = DateTime.Parse(patientViewModel.PatientViewEntity.DOB).Date;
                patient.Address = patientViewModel.PatientViewEntity.Address.Trim();
                patient.Phone = patientViewModel.PatientViewEntity.Phone.Trim();
                patient.Email = patientViewModel.PatientViewEntity.Email.Trim();
                patient.City = patientViewModel.PatientViewEntity.City.Trim();
                patient.State = patientViewModel.PatientViewEntity.State.Trim();
                patient.Country = patientViewModel.PatientViewEntity.Country;
                patient.IsActive = true;

                if (patientViewModel.PatientViewEntity.Gender.Equals("Male"))
                    patient.Sex = true;
                else
                    patient.Sex = false;

                if (patientViewModel.PatientViewEntity.PatientId == 0)
                {
                    string defaultPassword = RandomPasswordGenerator.Generate(8);
                    defaultPassword = EncryptDecrypt.EncryptData(defaultPassword, EncryptDecrypt.ReadCert());
                    patientRepository.AddPatient(patient, patientViewModel.PatientViewEntity.UserName.Trim(), defaultPassword);
                    var sendMail = new SMTPApi(ConfigurationManager.AppSettings["SmtpFromEmailAddress"].ToString(), new List<String> { patient.Email });
                    var stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine("<b>HealthReunion Patient Portal Log On Information. Below are the credentials</b><hr/>");
                    stringBuilder.AppendFormat("<br/>User Name: {0}", patientViewModel.PatientViewEntity.UserName.Trim());
                    stringBuilder.AppendFormat("<br/>Password: {0}", defaultPassword);
                    stringBuilder.AppendLine("<br/><hr/>Please log on to HealthReunion Patient Portal - http://healthreunionpatients.azurewebsites.net/ to access your clinical information.");
                    sendMail.SimpleHtmlEmail(stringBuilder.ToString());
                }
                else
                {
                    patientRepository.UpdatePatient(patient, patientViewModel.PatientViewEntity.UserName.Trim());
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View(patientViewModel);
            }
            ViewBag.Message = string.Format("Patient '{0} {1} {2}' Created Sucessfully!. An Email is trigged to {3} with credentials to Log in to HealthReunion Patient Portal.",
                patientViewModel.PatientViewEntity.FirstName, patientViewModel.PatientViewEntity.MiddleName, patientViewModel.PatientViewEntity.LastName, patientViewModel.PatientViewEntity.Email);

            patientViewModel.PatientViewEntity = new PatientViewEntity();
            patientViewModel.PatientViewModelGrid = GetPatientsForLoggedInProvider();
            return View(patientViewModel);
        }
 public void AddPatient(int physicianID)
 {
     patRepos.AddPatient(physicianID);
 }
Пример #10
0
        public PatientClass Post([FromBody] PatientClass patient)
        {
            var family = _patientRepository.AddPatient(patient);

            return(family);
        }