private void NewDoctor_Load(object sender, EventArgs e)
        {
            try
            {
                entries();
                //NewDoctor Department comboBox
                this.comboBoxDepartment.DataSource    = DepartmentDoctorManager.getDepartmentList();
                this.comboBoxDepartment.DisplayMember = "departmentName";
                this.comboBoxDepartment.ValueMember   = "departmentId";
                //NewDoctor Nationality comboBox
                this.comboBoxNationality.DataSource    = NationalityManager.getNationalityList();
                this.comboBoxNationality.DisplayMember = "nationalityName";
                this.comboBoxNationality.ValueMember   = "nationalityId";

                //DoctorShifts Doctor Shifts comboBox
                this.comboBoxDoctorShift.DataSource    = DoctorShiftsManager.getDoctorShifts();
                this.comboBoxDoctorShift.DisplayMember = "fullDetails";
                this.comboBoxDoctorShift.ValueMember   = "shiftId";

                //Setting comboboxes to -1 index so no item apperas on load
                this.comboBoxDepartment.SelectedIndex  = -1;
                this.comboBoxDoctorShift.SelectedIndex = -1;
                this.comboBoxNationality.SelectedIndex = -1;
                this.comboBoxSex.SelectedIndex         = -1;
                this.labelHeader.Width = this.Width;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void buttonSearch_Click(object sender, EventArgs e)
 {
     if (this.textBoxSearchName.Text.Length > 0 || this.textBoxSearchId.Text.Length > 0)
     {
         //Search by Name
         if (this.textBoxSearchName.Text.Length > 0)
         {
             DoctorShiftsHL docShi = new DoctorShiftsHL();
             docShi.shiftName = this.textBoxSearchName.Text;
             DataTable dt = new DataTable();
             dt = DoctorShiftsManager.getDoctorShiftListByName(docShi);
             dataGridViewShifts.DataSource = dt;
             clearSearchBoxes();
         }
         //Search by Id
         if (this.textBoxSearchId.Text.Length > 0)
         {
             DoctorShiftsHL docShi = new DoctorShiftsHL();
             docShi.shiftId = Convert.ToInt32(this.textBoxSearchId.Text);
             DataTable dt = new DataTable();
             dt = DoctorShiftsManager.getDoctorShiftListById(docShi);
             dataGridViewShifts.DataSource = dt;
             clearSearchBoxes();
         }
     }
     else
     {
         MessageBox.Show("Please enter a value to search!");
     }
 }
        private void buttonDeleteShift_Click(object sender, EventArgs e)
        {
            DoctorShiftsHL docshi = new DoctorShiftsHL();

            try
            {
                docshi.shiftId = IdShift;
                DoctorShiftsManager.doctorShiftDelete(docshi);
                MessageBox.Show("Deleted");
                displayDataShifts();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void buttonNewShift_Click(object sender, EventArgs e)
        {
            DoctorShiftsHL docshi = new DoctorShiftsHL();

            try
            {
                docshi.shiftName = textBoxShiftsName.Text;
                docshi.from      = TimeSpan.Parse(textBoxFrom.Text);
                docshi.to        = TimeSpan.Parse(textBoxTo.Text);
                DoctorShiftsManager.doctorShiftSave(docshi);
                MessageBox.Show("Success");
                displayDataShifts();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void AssignDoctorShifts_Load(object sender, EventArgs e)
        {
            displayShifts();
            displayDoctor();
            setDataGridViewDoctorHeaders();
            setDataGridViewDoctorShiftHeaders();
            notSortableDataGridViewDoctor();
            fullRowSelectDataGridViewDoctorShift();
            fullRowSelectDataGridViewDoctor();
            toUpperCaseLabels();
            //dataGridViewDoctor.Columns[0].Visible = false;
            //dataGridViewDoctorShift.Columns[0].Visible = false;
            //ExistingDoctor Depertment comboBox
            this.comboBoxDepartment.DataSource    = DepartmentDoctorManager.getDepartmentList();
            this.comboBoxDepartment.DisplayMember = "departmentName";
            this.comboBoxDepartment.ValueMember   = "departmentId";

            //ExistingDoctor Nationality comboBox
            this.comboBoxNationality.DataSource    = NationalityManager.getNationalityList();
            this.comboBoxNationality.DisplayMember = "nationalityName";
            this.comboBoxNationality.ValueMember   = "nationalityId";

            //DoctorShifts Doctor Shifts comboBox
            this.comboBoxDoctorShift.DataSource    = DoctorShiftsManager.getDoctorShifts();
            this.comboBoxDoctorShift.DisplayMember = "fullDetails";
            this.comboBoxDoctorShift.ValueMember   = "shiftId";
            //sets colour for alternate rowns for dataGridViewDoctor
            this.dataGridViewDoctor.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
            //sets color for alternate rows for datagridviewdoctorshifts
            this.dataGridViewDoctorShift.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
            //hide Doctor Id column
            this.dataGridViewDoctor.Columns[0].Visible = false;
            //hide shift Id column
            this.dataGridViewDoctorShift.Columns[0].Visible = false;
            //allowUsersToAddRows =false
            this.dataGridViewDoctor.AllowUserToAddRows      = false;
            this.dataGridViewDoctorShift.AllowUserToAddRows = false;
            //make datagridview readonly
            this.dataGridViewDoctor.ReadOnly      = true;
            this.dataGridViewDoctorShift.ReadOnly = true;
            //For flickering problem
            this.DoubleBuffered    = true;
            this.labelHeader.Width = this.Width;
        }
        private void ExistingDoctor_Load(object sender, EventArgs e)
        {
            try
            {
                displayDoctor();

                notSortableDataGridViewExistingDoctor();
                notSortableDataGridViewAppointmentHistory();
                setdatGridViewEixsitngHeaders();
                fullRowSelectDataGridViewExistingDoctor();
                fullRowSelectDataGridViewAppointmentHistory();
                toUpperCaseLabels();
                //this.dataGridViewExistingDoctor.Columns[0].Visible = false;
                //ExistingDoctor Depertment comboBox
                this.comboBoxDepartment.DataSource    = DepartmentDoctorManager.getDepartmentList();
                this.comboBoxDepartment.DisplayMember = "departmentName";
                this.comboBoxDepartment.ValueMember   = "departmentId";

                //ExistingDoctor Nationality comboBox
                this.comboBoxNationality.DataSource    = NationalityManager.getNationalityList();
                this.comboBoxNationality.DisplayMember = "nationalityName";
                this.comboBoxNationality.ValueMember   = "nationalityId";

                //DoctorShifts Doctor Shifts comboBox
                this.comboBoxDoctorShift.DataSource    = DoctorShiftsManager.getDoctorShifts();
                this.comboBoxDoctorShift.DisplayMember = "fullDetails";
                this.comboBoxDoctorShift.ValueMember   = "shiftId";
                //sets colour for alternate rowns for dataGridViewExsitingDoctor
                this.dataGridViewExistingDoctor.AlternatingRowsDefaultCellStyle.BackColor     = Color.LightGreen;
                this.dataGridViewAppointmentHistory.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
                //Setting comboboxes to -1 index so no item apperas on load
                this.comboBoxDepartment.SelectedIndex  = -1;
                this.comboBoxNationality.SelectedIndex = -1;
                this.comboBoxSex.SelectedIndex         = -1;
                this.comboBoxDoctorShift.SelectedIndex = -1;
                //For flickering problem
                this.DoubleBuffered    = true;
                this.labelHeader.Width = this.Width;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }