Ejemplo n.º 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ClearPatientDataBindings();

                if (FirstNameBox.Text != string.Empty &&
                    LastNameBox.Text != string.Empty &&
                    AddressBox.Text != string.Empty &&
                    PostcodeBox.Text != string.Empty &&
                    PhoneBox.Text != string.Empty &&
                    EmailBox.Text != string.Empty)
                {
                    _currPatient.ApplyEdit();

                    _currPatient = _currPatient.Save();
                }
                else
                {
                    MessageBox.Show("Fields missing. Please complete patient and try again");
                }
            }
            finally
            {
                AddPatientDataBindings();
            }
        }
        public ActionResult ShowPatientVersion(string id)
        {
            var conn = new FhirClient("http://localhost:8080/baseR4");

            conn.PreferredFormat = ResourceFormat.Json;

            Patient patient = conn.Read <Patient>("Patient/" + id);

            var patientList = new List <PatientEdit>();

            PatientEdit newPatient = new PatientEdit();

            newPatient.surname   = patient.Name[0].Family;
            newPatient.birthDate = patient.BirthDate;
            newPatient.mStatus   = patient.MaritalStatus.Text;
            newPatient.id        = patient.Id;
            newPatient.version   = patient.Meta.VersionId;
            int versions = int.Parse(newPatient.version);

            for (int i = 1; i <= versions; i++)
            {
                PatientEdit vPatient   = new PatientEdit();
                UriBuilder  uriBuilder = new UriBuilder("http://localhost:8080/baseR4");
                uriBuilder.Path = "Patient/" + id + "/_history/" + i;
                Patient resultResource = conn.Read <Patient>(uriBuilder.Uri);
                vPatient.surname   = resultResource.Name[0].Family;
                vPatient.birthDate = resultResource.BirthDate;
                vPatient.mStatus   = resultResource.MaritalStatus.Text;
                vPatient.version   = resultResource.Meta.VersionId;
                vPatient.modDate   = Convert.ToDateTime(resultResource.Meta.LastUpdated.ToString());
                patientList.Add(vPatient);
            }

            return(View(patientList));
        }
Ejemplo n.º 3
0
        //private string _firstName;
        //              public string FirstName
        //{
        //    get { return _currPatient.FirstName; }
        //    set
        //    {
        //        _currPatient.FirstName = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("FirstName"));
        //    }
        //}

        //public string LastName
        //{
        //    get { return _currPatient.LastName; }
        //    set
        //    {
        //        _currPatient.LastName = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("LastName"));
        //    }
        //}

        //public DateTime DateOfBirth
        //{
        //    get {
        //        if (_currPatient.DateOfBirth < DateTime.MinValue)
        //        { _currPatient.DateOfBirth = DateTime.MinValue; }
        //        return _currPatient.DateOfBirth;
        //    }
        //    set
        //    {
        //        if (_currPatient.DateOfBirth < DateTime.MinValue )
        //        { _currPatient.DateOfBirth = DateTime.MinValue; }

        //        _currPatient.DateOfBirth = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("DateOfBirth"));
        //    }
        //}

        //public string Address
        //{
        //    get {
        //        if (_currPatient.AddressList != null)
        //        { return _currPatient.AddressList[0].AddressLine1; }
        //        else
        //            return string.Empty;

        //    }
        //    set
        //    {
        //        _currPatient.AddressList[0].AddressLine1 = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("Address"));
        //    }
        //}

        //public string Postcode
        //{
        //    get
        //    {
        //        if (_currPatient.AddressList != null)
        //        { return _currPatient.AddressList[0].PostCode; }
        //        else
        //            return string.Empty;

        //    }
        //    set
        //    {
        //        _currPatient.AddressList[0].PostCode = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("Postcode"));
        //    }
        //}
        //        public string Phone
        //{
        //    get
        //    {
        //        if (_currPatient.AddressList != null)
        //        { return _currPatient.AddressList[0].PhoneNumber; }
        //        else
        //            return string.Empty;

        //    }
        //    set
        //    {
        //        _currPatient.AddressList[0].PhoneNumber = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("Phone"));
        //    }
        //}

        //public string Email
        //{
        //    get
        //    {
        //        if (_currPatient.AddressList != null)
        //        { return _currPatient.AddressList[0].EmailAddress; }
        //        else
        //            return string.Empty;

        //    }
        //    set
        //    {
        //        _currPatient.AddressList[0].EmailAddress = value;
        //        InvokePropertyChanged(new PropertyChangedEventArgs("Email"));
        //    }
        //}

        #endregion

        #region Events

        private void SelectedPatient_Changed(object sender, EventArgs e)
        {
            DataGridViewRow currRow = dataGridView1.CurrentRow;
            Guid            pxID    = (Guid)(currRow.Cells[0].Value);

            _currPatient = PatientEdit.GetPatientEdit(pxID);

            AddPatientDataBindings();
            UpdateAddressList();
        }
Ejemplo n.º 4
0
        private void tsmAdd_Click(object sender, EventArgs e)
        {
            PatientEdit openDialog = new PatientEdit(0, "");

            //Butcher_EnterregisterDetail openDialog = new Butcher_EnterregisterDetail(0, 0, "");
            openDialog.ShowDialog();
            if (openDialog.DialogResult == DialogResult.OK)
            {
                LoadBucterList();
            }
        }
        public ActionResult SavePatient(PatientEdit patient)
        {
            var conn = new FhirClient("http://localhost:8080/baseR4");

            conn.PreferredFormat = ResourceFormat.Json;

            Patient patientNew = conn.Read <Patient>("Patient/" + patient.id);

            patientNew.Name[0].Family     = patient.surname;
            patientNew.BirthDate          = patient.birthDate;
            patientNew.MaritalStatus.Text = patient.mStatus;
            conn.Update(patientNew);
            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult PatientUserProfileEdit(PatientProfileEditViewModel model, string returnUrl)
        {
            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            Users    user    = new Users();
            Patients patient = new Patients();

            AutoMapper.Mapper.Map(model, user);
            AutoMapper.Mapper.Map(model, patient);
            if (string.IsNullOrEmpty(model.NewPassword))
            {
                user.Password = model.Password;
            }
            else
            {
                user.Password = model.NewPassword;
            }
            PatientEdit Patient = new PatientEdit();

            try
            {
                if (Patient.UpdatePatient(user, patient))
                {
                    return(RedirectToAction($"PatientUserDetails/{model.Id}"));
                }
                else
                {
                    return(RedirectToAction($"/Patient/Profile/Edit/{model.Id}"));
                }
            }
            catch (EmailAlreadyExistsEx ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
            catch (PhoneAlreadyExistsEx ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", "Unable to update Patient information");
                return(View(model));
            }
        }
Ejemplo n.º 7
0
        public ActionResult Edit(string id)
        {
            PatientEdit patientEdit = new PatientEdit();
            var         intId       = 0;

            int.TryParse(id, out intId);
            try
            {
                Patient patient = patientRepository.GetPatientById(intId);
                if (patient == null)
                {
                    return(RedirectToAction("Error404", "Error"));
                }
                else
                {
                    var path     = "";
                    var fileName = patient.Id + ".jpg";
                    var savePath = Server.MapPath("~/Uploads/patient/") + patient.Id;
                    // Check for Directory, If not exist, then create it
                    if (Directory.Exists(savePath))
                    {
                        path          = "/Uploads/patient/" + patient.Id + "/" + fileName;
                        patient.Image = path;
                    }
                    else
                    {
                        savePath = Server.MapPath("~/Uploads/");
                        fileName = "default.jpg";
                    }
                    patientEdit.ImageStream = ImageHelper.BaseDateImage(savePath + "/" + fileName);
                    patient.Image           = Common.ConcatHost(path);
                }

                patientModel = new PatientModels
                {
                    patient     = patient,
                    patientEdit = patientEdit,
                    checkPost   = false
                };
            }
            catch (Exception ex)
            {
                log.Error(ex);
                ModelState.AddModelError("error", Translator.UnexpectedError);
            }
            return(View(patientModel));
        }
Ejemplo n.º 8
0
        public bool UpdatePatient(PatientEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = ctx.Patients.Single(e => e.PatientId == model.PatientId);
                entity.FirstName = model.FirstName;
                entity.LastName  = model.LastName;
                entity.DOB       = model.DOB;
                entity.Address   = model.Address;
                entity.City      = model.City;
                entity.State     = model.State;
                entity.Zip       = model.Zip;
                entity.Phone     = model.Phone;

                return(ctx.SaveChanges() == 1);
            }
        }
        public ViewResult EditPatient(string id)
        {
            var conn = new FhirClient("http://localhost:8080/baseR4");

            conn.PreferredFormat = ResourceFormat.Json;

            Patient patient = conn.Read <Patient>("Patient/" + id);

            PatientEdit newPatient = new PatientEdit();

            newPatient.surname   = patient.Name[0].Family;
            newPatient.birthDate = patient.BirthDate;
            newPatient.mStatus   = patient.MaritalStatus.Text;
            newPatient.id        = patient.Id;

            return(View(newPatient));
        }
        public ActionResult Edit(int id)
        {
            var service = new PatientService();
            var detail  = service.GetPatientById(id);
            var model   = new PatientEdit
            {
                PatientId = detail.PatientId,
                FirstName = detail.FirstName,
                LastName  = detail.LastName,
                DOB       = detail.DOB,
                Address   = detail.Address,
                City      = detail.City,
                State     = detail.State,
                Zip       = detail.Zip,
                Phone     = detail.Phone
            };

            return(View(model));
        }
Ejemplo n.º 11
0
 private void BtnCancel_Click(object sender, EventArgs e)
 {
     if (FirstNameBox.Text != string.Empty ||
         LastNameBox.Text != string.Empty ||
         AddressBox.Text != string.Empty ||
         PostcodeBox.Text != string.Empty ||
         PhoneBox.Text != string.Empty ||
         EmailBox.Text != string.Empty)
     {
         DialogResult alert = MessageBox.Show("Are you sure you want to abandon progress on this patient?", "Cancel patient?", MessageBoxButtons.YesNo);
         if (alert == DialogResult.Yes)
         {
             _currPatient = new PatientEdit();
         }
     }
     else
     {
         _currPatient = new PatientEdit();
     };
 }
        public ActionResult Edit(int id, PatientEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model.PatientId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }
            var service = new PatientService();

            if (service.UpdatePatient(model))
            {
                TempData["SaveResult"] = "Patient information updated.";
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Patient could not be updated.");
            return(View(model));
        }
Ejemplo n.º 13
0
        public ActionResult EditProfile(PatientProfileEditViewModel model, string returnUrl)
        {
            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            Users    user    = new Users();
            Patients patient = new Patients();

            user.RoleId = (int)Roles.Patient;
            AutoMapper.Mapper.Map(model, user);
            AutoMapper.Mapper.Map(model, patient);
            user.Id = (int)Session["userId"];

            PatientEdit Patient = new PatientEdit();

            try
            {
                if (Patient.UpdatePatient(user, patient))
                {
                    return(RedirectToAction("Profile"));
                }
                else
                {
                    return(RedirectToAction("Profile/Edit"));
                }
            }
            catch (EmailAlreadyExistsEx ex)
            {
                throw ex;
            }
            catch (PhoneAlreadyExistsEx ex)
            {
                throw ex;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 14
0
        private void tsmUpdate_Click(object sender, EventArgs e)
        {
            if (ugGrid.Rows.Count == 0)
            {
                return;
            }
            if (ugGrid.ActiveRow.IsFilterRow)
            {
                return;
            }
            if (this.ugGrid.ActiveRow.Cells["ID"].Value == DBNull.Value)
            {
                return;
            }

            PatientEdit openDialog = new PatientEdit(1, ugGrid.ActiveRow.Cells["ID"].Value.ToString());

            openDialog.ShowDialog();
            if (openDialog.DialogResult == DialogResult.OK)
            {
                LoadBucterList();
            }
        }
Ejemplo n.º 15
0
        //public void GetPatientList()
        //{
        //    List<PatientEdit> actualResult = new List<PatientEdit>();
        //    PatientDAL pxClass = new PatientDAL();
        //    actualResult = pxClass.GetPatientList();

        //    if (actualResult.Count == 0) { Assert.Fail(); };
        //}

        public void FetchPatient()
        {
            PatientEdit actualResult = new PatientEdit();
        }
Ejemplo n.º 16
0
 private void BtnNewPx_Click(object sender, EventArgs e)
 {
     PatientEdit.NewPatientEdit();
     // BindDetailsToCurrentPatient();
 }