Exemplo n.º 1
0
        public ActionResult ManageAppointment(string ID, string DBOperation)
        {
            SharedViewModel vm = new SharedViewModel();

            //vm.Appointments = _appoDal.GetAllAppointments().TranslateAppointmentDEList();
            vm.LookUp = _appoDal.GetAllPropertyTypes().TranslateLookUpModel().ToList();
            if (DBOperation == "EDIT")
            {
                int id = Convert.ToInt32(ID);
                vm.Appointment = _appoDal.GetAppointmentById(id).TranslateAppointmentDE();
                vm.Appointment.ConfirmEmail = vm.Appointment.Email;
            }
            return(View(vm));
        }
        private async void finishEdit(object sender, RoutedEventArgs e)
        {
            try
            {
                this.ring.IsActive = true;
                var patientDal = new PatientDAL();
                var nurseDal   = new NurseDAL();
                var appointDal = new AppointmentDAL();
                var vm         = new RoutineCheckupViewModel();
                var appnt      = await appointDal.GetAppointmentById(this.AppointmentID);

                var patient = await patientDal.GetPatientById(this.PatientId);

                var nurse = await nurseDal.GetNurseByNurseId(this.NurseId);

                var date = this.CheckupDate.Date.AddHours(this.CheckupTime.Hours).AddMinutes(this.CheckupTime.Minutes);
                var sys  = !string.IsNullOrWhiteSpace(this.SystolicReading.ToString())
                    ? this.SystolicReading
                    : throw new ArgumentException("The Systolic Reading cannot be empty.");
                var dbp = !string.IsNullOrWhiteSpace(this.DiastolicBloodPressure.ToString())
                    ? this.DiastolicBloodPressure
                    : throw new ArgumentException("The blood pressure cannot be empty.");
                var weght = !string.IsNullOrWhiteSpace(this.Weight.ToString())
                    ? this.Weight
                    : throw new ArgumentException("The weight cannot be empty");
                var tep = !string.IsNullOrWhiteSpace(this.Temperature.ToString())
                    ? this.Temperature
                    : throw new ArgumentException("The tmeperature cannot be empty");
                var diag = !string.IsNullOrWhiteSpace(this.InitialDiagnosis)
                    ? this.InitialDiagnosis
                    : throw new ArgumentException("The initial diaggnosis cannot be empty");
                var checkup = new RoutineCheck(appnt, nurse, patient, date, sys, dbp, weght, tep, diag);
                await vm.EditCheckup(checkup);

                this.Editing(false);
                this.ChangesMade = true;
            }
            catch (Exception ex)
            {
                this.ring.IsActive = false;
                this.error.Text    = ex.Message;
                await Task.Delay(4000);

                this.error.Text = "";
            }

            this.ring.IsActive = false;
        }
Exemplo n.º 3
0
        private async void addCheckup(object sender, RoutedEventArgs e)
        {
            this.ring.IsActive = true;
            try
            {
                var aId            = int.Parse(this.aID.Text);
                var nId            = int.Parse(this.nID.Text);
                var time           = this.timeicker.Time;
                var date           = this.datePicker.Date.Date.AddHours(time.Hours).AddMinutes(time.Minutes);
                var sys            = int.Parse(this.sysReadind.Text);
                var bPr            = int.Parse(this.bPressure.Text);
                var _weight        = double.Parse(this.weight.Text);
                var temp           = double.Parse(this.temp.Text);
                var ini            = this.summaryTextBox.Text;
                var appointmentdal = new AppointmentDAL();
                var appointment    = await appointmentdal.GetAppointmentById(aId);

                var nursedal = new NurseDAL();
                var nurse    = await nursedal.GetNurseByNurseId(nId);

                var checkup = new RoutineCheck(appointment, nurse, appointment.Patient, date, sys, bPr, _weight, temp,
                                               ini);
                await this.viewModel.AddCheckup(checkup);

                await this.viewModel.LoadAllAppointments();

                var confirmBox = new MessageDialog($"CheckUp completed  {date.ToShortDateString()}");
                this.ring.IsActive = false;
                await confirmBox.ShowAsync();
            }
            catch (Exception ex)
            {
                this.ring.IsActive = false;
                var messageDialog = new MessageDialog(ex.Message);
                await messageDialog.ShowAsync();
            }
        }