Exemple #1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string   dateChoice              = ddlDateOfBirthDay.Text + " " + ddlDateOfBirthMonth.Text + " " + ddlDateOfBirthYear.Text;
            DateTime parsedTimeDeposit       = DateTime.Parse(dateChoice);
            string   dateAppointmentChoice   = ddlAppointmentDay.Text + " " + ddlAppointmentMonth.Text + " " + ddlAppointmentYear.Text;
            DateTime parsedAppointmentChoice = DateTime.Parse(dateAppointmentChoice);
            string   dateRescheduledTime     = ddlRescheduledDay.Text + " " + ddlRescheduledMonth.Text + " " + ddlReschduledYear.Text;
            DateTime parsedRescheduledChoice = DateTime.Parse(dateRescheduledTime);

            _boa.Reason = txtReasonForAppointment.Text;
            _boa.ReasonForReschedule = txtReasonForReschedule.Text;
            _boa.RescheduledTime     = parsedRescheduledChoice;
            _boa.Status            = ddlStatus.Text;
            _boa.TimeAppointment   = parsedAppointmentChoice;
            _boa.TimeDeposit       = parsedTimeDeposit;
            _boa.TypeOfAppointment = ddlTypeOfAppointment.Text;
            _boa.Urgency           = ddlDegreeOfPriority.Text;
            _boa.UserID            = Convert.ToInt32(ddlUserName.Text);
            _boa.VenueID           = Convert.ToInt32(ddlVenue.Text);
            _boa.WorkerID          = Convert.ToInt32(ddlWorkerName.Text);
            _boa.WorkerRole        = ddlWorkerRole.Text;
            _boa.WorkerSchedule    = txtWorkerSchedule.Text;
            if (_app.Update(_boa))
            {
                lblDesc.Text = "Successfully Updated";
                clear();
            }
            else
            {
                lblDesc.Text = "Failed to Update Appointment";
            }
        }
        public ActionResult Edit([Bind(Include = "Id,Date,Hour,DoctorId,PatientId,RoomId")] AppointmentModel appointment)
        {
            try
            {
                if (appointment.Date == null)
                {
                    ModelState.AddModelError("Date", "Debe ingresar una fecha");
                }

                if (appointment.Hour == 0)
                {
                    ModelState.AddModelError("Hour", "Debe ingresar una hora");
                }


                IEnumerable <Appointment> appointments = appointmentBusiness.GetByFilters(AppointmentModel.FromModel(appointment));

                if (appointments.ToList().Count > 0)
                {
                    var ap = appointments.FirstOrDefault();

                    if (ap.DoctorId == appointment.DoctorId)
                    {
                        ModelState.AddModelError("Model", "El doctor ya tiene un turno asignado para el día y hora seleccionados");
                    }
                    else
                    {
                        ModelState.AddModelError("Model", "El paciente ya tiene un turno asignado en el día y horario seleccionados");
                    }
                }

                if (ModelState.IsValid)
                {
                    appointmentBusiness.Update(AppointmentModel.FromModel(appointment));

                    return(RedirectToAction("Index"));
                }

                ViewBag.DoctorId  = new SelectList(doctorBusiness.List(), "Id", "Name");
                ViewBag.PatientId = new SelectList(patientBusiness.List(), "Id", "Name");
                ViewBag.RoomId    = new SelectList(roomBusiness.List(), "Id", "Name");
                return(View(appointment));
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                return(View());
            }
        }
Exemple #3
0
        public ActionResult Edit([Bind(Include = "Id,PatientId,RoomId,DoctorId,StartDate,EndDate,Description")] Appointment appointment)
        {
            ViewBag.error = "";

            if (ModelState.IsValid)
            {
                var error = validate(appointment);
                if (error != null)
                {
                    ViewBag.error   = error;
                    ViewBag.errorId = appointment.Id.ToString();

                    return(View("Index"));
                }
                appBLL.Update(appointment);
                return(RedirectToAction("Index"));
            }
            ViewBag.DoctorId  = new SelectList(docBLL.List(), "Id", "Name", appointment.DoctorId);
            ViewBag.PatientId = new SelectList(patientBLL.List(), "Id", "Name", appointment.PatientId);
            ViewBag.RoomId    = new SelectList(roomBLL.List(), "Id", "Name", appointment.RoomId);
            return(View("Index"));
        }
Exemple #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (apo != null)
     {
         DialogResult = MessageBox.Show("Randevunuzu İptal Etmek İstiyormusunuz?", "Randevu İptal", MessageBoxButtons.YesNo);
         if (DialogResult.Yes == DialogResult)
         {
             bool save = _apoBLL.Update(apo);
             if (save)
             {
                 MessageBox.Show("Randevunuz İptal edilmiştir.");
                 GetAppointmentList();
             }
             else
             {
                 MessageBox.Show("Randevunuz iptal edilemedi!");
             }
         }
     }
     else
     {
         MessageBox.Show("Randevu Seçmeden İptal Edemessiniz!");
     }
 }