Ejemplo n.º 1
0
        private void dtGridViewSelectedDoctorDate_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            HospitalDetail detail = new HospitalDetail
            {
                HospitalId   = Convert.ToInt32(cmbHospital.SelectedValue),
                PolyclinicId = Convert.ToInt32(cmbPolyclinic.SelectedValue),
                DepartmentId = Convert.ToInt32(cmbClinicLocation.SelectedValue),
                DoctorId     = Convert.ToInt32(cmbChooseDoctor.SelectedValue),
            };
            int hospitalDetailId = hospitalDetailManagement.SearchHospitalDetails(detail);


            Appointment appointment = new Appointment
            {
                HospitalDetailId    = hospitalDetailId,
                PatientId           = UserID,
                DoctorWorkingHourId = Convert.ToInt32(dtGridViewSelectedDoctorDate.CurrentRow.Cells[0].Value),
                DateOfAppointment   = DateTime.Now
            };

            appointmentManagement.AddAppointment(appointment);

            DoctorWorkingHour workingHour = new DoctorWorkingHour
            {
                DoctorWorkingHourId = Convert.ToInt32(dtGridViewSelectedDoctorDate.CurrentRow.Cells[0].Value),
                Status = false
            };

            hourManagement.UpdateWorkingHour(workingHour);
        }
Ejemplo n.º 2
0
        public void UpdateWorkingHour(DoctorWorkingHour hour)
        {
            DoctorWorkingHour updateHour = database.DoctorWorkingHours.SingleOrDefault(h => h.DoctorWorkingHourId == hour.DoctorWorkingHourId);

            updateHour.Status = hour.Status;

            database.Set <DoctorWorkingHour>().Attach(updateHour);
            var entry = database.Entry(updateHour);

            entry.State = EntityState.Modified;
            database.SaveChanges();
        }