private void enableValidTimeButtons() { //Enable and uncheck all radio buttons. foreach (var element in timeButtons) { element.Item1.Enabled = true; element.Item1.Checked = false; } //Check if any doctor is selected. if (dataGridViewDoctors.SelectedCells.Count > 0 && dataGridViewDoctors.CurrentRow != null) { //Get Doctor information. BusinessLayer.DoctorInformation doctorInfo = new BusinessLayer.DoctorInformation(); doctorInfo.DoctorID = (int)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[0].Value); doctorInfo.FirstName = (string)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[1].Value); doctorInfo.LastName = (string)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[2].Value); doctorInfo.PWZ = (int)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[3].Value); //Get selected date. DateTime date = dateTimePickerAppointmentDate.Value.Date; //Get inavailable times. var inavailableTimes = BusinessLayer.ReceptionistFacade.GetAppointmentTimes(doctorInfo, date); //Disable buttons for inavailable times. foreach (TimeSpan t in inavailableTimes) { int buttonIndex = (t.Hours - 6) * 2 + t.Minutes / 30; timeButtons[buttonIndex].Item1.Enabled = false; } } }
private void buttonAddAppointment_Click(object sender, EventArgs e) { //Check if any doctor is selected. if (dataGridViewDoctors.SelectedCells.Count > 0) { //Check if proper date and time is selected. if (!validAppointmentDateTime()) { MessageBox.Show("Please select a proper date and time for the appointment.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //Get Doctor information. BusinessLayer.DoctorInformation doctorInfo = new BusinessLayer.DoctorInformation(); doctorInfo.DoctorID = (int)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[0].Value); doctorInfo.FirstName = (string)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[1].Value); doctorInfo.LastName = (string)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[2].Value); doctorInfo.PWZ = (int)(dataGridViewDoctors.Rows[dataGridViewDoctors.CurrentCell.RowIndex].Cells[3].Value); //Get appointment date. DateTime appointmentDate = getAppointmentDateTime(); //Add appointment newAppointment = new BusinessLayer.ReceptionistFacade.ReceptionistAppointment(); newAppointment.Date = appointmentDate; newAppointment.DoctorFirstName = doctorInfo.FirstName; newAppointment.DoctorLastName = doctorInfo.LastName; BusinessLayer.ReceptionistFacade.AddAppointment(receptionistInformation, patientInformation, doctorInfo, appointmentDate); DialogResult = DialogResult.OK; } else { MessageBox.Show("Please select a doctor to register an appointment.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public FormDoctor(int userID) { activeDoctorInformation = BusinessLayer.DoctorFacade.GetDoctor(userID); InitializeComponent(); //Set window title. this.Text = "Doctor - " + activeDoctorInformation.FirstName + " " + activeDoctorInformation.LastName; searchForAppointmentsForToday(); }
public FormDoctorHistory(BusinessLayer.AppointmentInformation actApp, BusinessLayer.PatientInformation actPat, BusinessLayer.DoctorInformation actDoc) { InitializeComponent(); //Set window title. this.Text = "Patient History - " + actPat.FirstName + " " + actPat.LastName; activeAppointment = actApp; activeDoctor = actDoc; activePatient = actPat; textBoxFirstName.Text = actPat.FirstName; textBoxLastName.Text = actPat.LastName; searchForAppointments(); }
public FormDoctorManageExaminations(BusinessLayer.AppointmentInformation actApp, BusinessLayer.PatientInformation actPat, BusinessLayer.DoctorInformation actDoc) { InitializeComponent(); //Set window title. this.Text = "Examinations - " + actPat.FirstName + " " + actPat.LastName; activeAppointment = actApp; activeDoctor = actDoc; activePatient = actPat; textBoxFirstName.Text = activePatient.FirstName; textBoxLastName.Text = activePatient.LastName; //Initial search. searchForPhysExams(); searchForLabExams(); }
private void searchForDoctors() { //Get search criteria. BusinessLayer.DoctorInformation doctorSearchCriteria = new BusinessLayer.DoctorInformation(); doctorSearchCriteria.FirstName = textBoxDoctorFirstName.Text; doctorSearchCriteria.LastName = textBoxDoctorLastName.Text; //Search and display. dataGridViewDoctors.Columns.Clear(); dataGridViewDoctors.DataSource = BusinessLayer.ReceptionistFacade.GetDoctors(doctorSearchCriteria); dataGridViewDoctors.Columns[0].Visible = false; dataGridViewDoctors.Columns[1].Width = 120; dataGridViewDoctors.Columns[2].Width = 120; dataGridViewDoctors.Columns[3].Width = 120; //Select first doctor. if (dataGridViewDoctors.Rows.Count > 0) { dataGridViewDoctors.CurrentCell = dataGridViewDoctors[1, 0]; } enableValidTimeButtons(); }