private void NewStaff_Load(object sender, EventArgs e) { try { entries(); //NewPatient Department comboBox this.comboBoxDepartment.DataSource = DepartmentStaffManager.getDepartmentList(); this.comboBoxDepartment.DisplayMember = "departmentName"; this.comboBoxDepartment.ValueMember = "departmentId"; //NewPatient Nationality comboBox this.comboBoxNationality.DataSource = NationalityManager.getNationalityList(); this.comboBoxNationality.DisplayMember = "nationalityName"; this.comboBoxNationality.ValueMember = "nationalityId"; //Staff shifts combobox this.comboBoxStaffShift.DataSource = StaffShiftsManager.getStaffShifts(); this.comboBoxStaffShift.DisplayMember = "fullDetails"; this.comboBoxStaffShift.ValueMember = "shiftId"; //Setting comboboxes to -1 index so no item apperas on load this.comboBoxDepartment.SelectedIndex = -1; this.comboBoxNationality.SelectedIndex = -1; this.comboBoxSex.SelectedIndex = -1; this.comboBoxStaffShift.SelectedIndex = -1; this.labelHeader.Width = this.Width; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void AssignStaffShifts_Load(object sender, EventArgs e) { try { //display staff in dataGridView displayStaff(); displayShifts(); toUpperCaseLabels(); // Department comboBox this.comboBoxDepartment.DisplayMember = "departmentName"; this.comboBoxDepartment.ValueMember = "departmentId"; this.comboBoxDepartment.DataSource = DepartmentStaffManager.getDepartmentList(); // Nationality comboBox this.comboBoxNationality.DisplayMember = "nationalityName"; this.comboBoxNationality.ValueMember = "nationalityId"; this.comboBoxNationality.DataSource = NationalityManager.getNationalityList(); // shift combobox this.comboBoxStaffShift.DataSource = StaffShiftsManager.getStaffShifts(); this.comboBoxStaffShift.DisplayMember = "fullDetails"; this.comboBoxStaffShift.ValueMember = "shiftId"; //sets colour for alternate rowns for dataGridViewStaff this.dataGridViewStaff.AlternatingRowsDefaultCellStyle.BackColor = Color.Bisque; //sets colour for laternate rows for datagridviewstaffshift this.dataGridViewStaffShift.AlternatingRowsDefaultCellStyle.BackColor = Color.Bisque; //Setting comboboxes to -1 index so no item apperas on load this.comboBoxDepartment.SelectedIndex = -1; this.comboBoxNationality.SelectedIndex = -1; this.comboBoxSex.SelectedIndex = -1; this.comboBoxStaffShift.SelectedIndex = -1; this.labelHeader.Width = this.Width; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }