Exemplo n.º 1
0
        public void Save(RegisterMedicalExaminationModel model, int type)
        {
            MedicalService medicalExamination = null;

            Patient patient = new Patient
            {
                Name    = model.PatientName,
                Address = new Address
                {
                    City         = model.City,
                    Street       = model.Street,
                    StreetNumber = model.StreetNumber
                },
                Phone = model.Phone,
                Ucn   = model.Ucn,
            };

            medicalExamination = new MedicalService
            {
                Patient            = patient,
                Disease            = model.Disease,
                DoctorId           = model.DoctorId,
                MedicalOpinion     = model.MedicalOpinion,
                MedicalServiceDate = DateTime.ParseExact(model.Date, "MM/dd/yyyy", null),
                MedicalServiceType = (MedicalServiceType)type
            };
            medicalServiceRepository.Add(medicalExamination);
        }
 private void button3_Click(object sender, EventArgs e)
 {
     FindControls(this, controls, ControlIdentifier);
     if (!FieldValidator.HasEmptyFields(controls.ToArray()))
     {
         RegisterMedicalExaminationModel medicalExaminationModel = CreateModel();
         medicalServiceSevice.Save(medicalExaminationModel, MedicalServiceType);
         MessageBox.Show("Successfully recorded medical examination");
         this.Close();
     }
     else
     {
         MessageBox.Show("Fill in all fileds");
     }
 }
        private RegisterMedicalExaminationModel CreateModel()
        {
            RegisterMedicalExaminationModel model = new RegisterMedicalExaminationModel
            {
                PatientName    = PatientNameTextBox_Required.Text,
                Ucn            = PatientUCNTextBox_Required.Text,
                City           = PatientCityComboBox_Required.Text,
                Street         = PatientStreetNumberTextBox_Required.Text,
                StreetNumber   = PatientStreetNumberTextBox_Required.Text,
                Date           = ExaminationDatePicker_Required.Value.ToString("MM/dd/yyyy"),
                Disease        = DiseaseTextBox_Required.Text,
                MedicalOpinion = MedicalOpinionTextBox_Required.Text,
                Phone          = PhoneNumberTextBox_Required.Text,
                DoctorId       = this.doctorId
            };

            return(model);
        }