Exemple #1
0
        private void Button_Click(object sender, EventArgs e)
        {
            Button         selectedbuton = (Button)sender;
            HospitalDetail doctor        = (HospitalDetail)cBxSelectDoctor.SelectedValue;
            Appointment    apointment    = new Appointment();

            DialogResult = MessageBox.Show("Kaydı onaylıyor musunuz?", "Randevu", MessageBoxButtons.YesNo);
            if (DialogResult.Yes == DialogResult)
            {
                apointment.PatientID      = _userID;
                apointment.DoctorID       = doctor.DoctorID;
                apointment.AppointmenDate = dTPAppointmentDate.Value.Date;
                apointment.AppointTime    = DateTime.Parse(selectedbuton.Text.ToString());

                bool save = apoBLL.Insert(apointment);
                if (save)
                {
                    MessageBox.Show("Belirtilen Tarih Ve Klinikte Randevunuz Başarıyla Alınmıştır.");
                    TimeFill();
                }
                else
                {
                    MessageBox.Show("Randevunuz alınamadı!");
                }
            }
        }
        public ActionResult Create([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.Insert(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
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //string dateChoice = ddlDateOfBirthDay.Text + " " + ddlDateOfBirthMonth.Text + " " + ddlDateOfBirthYear.Text;
            //DateTime parsedDateRescheduledTime = 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);

            //if(_app.SearchByDay(Convert.ToDateTime(txtRescheduledTime.Text))!=null)
            //{

            //}
            //else
            //{
            _boa.Reason = txtReasonForAppointment.Text;
            _boa.ReasonForReschedule = null;
            //_boa.ReasonForReschedule = txtReasonForReschedule.Text;
            _boa.RescheduledTime = parsedRescheduledChoice;
            //_boa.RescheduledTime = Convert.ToDateTime(txtRescheduledTime.Text);
            _boa.Status            = ddlStatus.Text;
            _boa.TimeAppointment   = parsedAppointmentChoice;
            _boa.TimeDeposit       = DateTime.Now;
            _boa.TypeOfAppointment = ddlTypeOfAppointment.Text;
            _boa.Urgency           = ddlDegreeOfPriority.Text;
            _boa.UserID            = Convert.ToInt32(ddlUserName.Text);
            _boa.VenueID           = Convert.ToInt32(1);
            //_boa.VenueID = Convert.ToInt32(ddlVenue.Text);
            _boa.WorkerID       = Convert.ToInt32(ddlWorkerName.Text);
            _boa.WorkerRole     = ddlWorkerRole.Text;
            _boa.WorkerSchedule = "7:30 AM-3:30 PM; MON-SAT";
            //_boa.WorkerSchedule = txtWorkerSchedule.Text;

            if (_app.Insert(_boa))
            {
                lblDesc.Text = "Successfully Added";
                clear();
            }
            else
            {
                lblDesc.Text = "Failed to add Appointment";
            }
            //}
        }
Exemple #4
0
        public ActionResult Create([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.create = "error";
                    return(View("Index"));
                }
                appBLL.Insert(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(appointment));
        }