Exemple #1
0
 public IHttpActionResult GetByPatientId(int id)
 {
     try
     {
         var emergencyContact    = _emergencyContactManager.GetWithWhereCondition <EmergencyContact>($"PatientId = {id}").FirstOrDefault();
         var emergencyContactDTO = _emergencyContactFactory.CreateEmergencyContactDTO(emergencyContact);
         return(Content(HttpStatusCode.OK, emergencyContactDTO));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Exemple #2
0
        private void PatientInformation_Load(object sender, EventArgs e)
        {
            txtFirstName.Text            = patient.FirstName;
            txtLastName.Text             = patient.LastName;
            txtGender.Text               = patient.Gender;
            dateTimePickerBirthDate.Text = patient.BirthDate.ToString();
            txtContactNumber.Text        = patient.ContactNumber;
            txtEmail.Text      = patient.Email;
            txtOccupation.Text = patient.Occupation;

            var address = addressManager.GetWithWhereCondition <Address>($"PatientID = {patient.Id}").FirstOrDefault();

            if (address != null)
            {
                txtCity.Text       = address.City;
                txtProvince.Text   = address.Province;
                txtPostalCode.Text = address.PostalCode;
            }
            else
            {
                txtCity.Text = txtProvince.Text = txtPostalCode.Text = string.Empty;
            }


            var emergencyContact = emergencyContactManager.GetWithWhereCondition <EmergencyContact>($"PatientId = {patient.Id}").FirstOrDefault();

            if (emergencyContact != null)
            {
                txtEcFirstname.Text  = emergencyContact.FirstName;
                txtECLastName.Text   = emergencyContact.LastName;
                txtECContactNum.Text = emergencyContact.ContactNumber;
            }
            else
            {
                txtEcFirstname.Text = txtECLastName.Text = txtECContactNum.Text = string.Empty;
            }
        }
        public IHttpActionResult GetById(int id)
        {
            try
            {
                var patient          = _patientManager.GetById <Patient>(id);
                var address          = _addressManager.GetWithWhereCondition <Address>($"Patientid = {id}").FirstOrDefault();
                var emergencyContact = _emergencyContactManager.GetWithWhereCondition <EmergencyContact>($"Patientid = {id}").FirstOrDefault();
                var consultations    = _consultationManager.GetWithWhereCondition <Consultation>($"PatientId = {id}");
                var appointments     = _appointmentManager.GetWithWhereCondition <Appointment>($"PatientId = {id}");
                var patientDTO       = _patientFactory.CreatePatientDTO(patient, address, emergencyContact, consultations, appointments);

                return(Content(HttpStatusCode.OK, patientDTO));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex.Message));
            }
        }