private void btnAssignCurrentShifts_Click(object sender, EventArgs e) { if (cbMonday.Checked == false && cbTuesday.Checked == false && cbWednesday.Checked == false && cbThursday.Checked == false && cbFriday.Checked == false && cbSaturday.Checked == false && cbSunday.Checked == false) { MessageBox.Show("Please select a working day for the employee!"); } else if (cbMondayMorning.Checked == false && cbMondayAfternoon.Checked == false && cbMondayEvening.Checked == false && cbTuesdayMorning.Checked == false && cbTuesdayAfternoon.Checked == false && cbTuesdayEvening.Checked == false && cbWednesdayMorning.Checked == false && cbWednesdayAfternoon.Checked == false && cbWednesdayEvening.Checked == false && cbThursdayMorning.Checked == false && cbThursdayAfternoon.Checked == false && cbThursdayEvening.Checked == false && cbFridayMorning.Checked == false && cbFridayAfternoon.Checked == false && cbFridayEvening.Checked == false && cbSaturdayMorning.Checked == false && cbSaturdayAfternoon.Checked == false && cbSaturdayEvening.Checked == false && cbSundayMorning.Checked == false && cbSundayAfternoon.Checked == false && cbSundayEvening.Checked == false) { MessageBox.Show("Please select a working shift for the employee!"); } else { if (MessageBox.Show("Do you really want to save this schedule?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.workingDays.Clear(); this.workingShifts.Clear(); if (cbMonday.Checked) { if (cbMondayMorning.Checked) { this.workingDays.Add(0); this.workingShifts.Add(1); } if (cbMondayAfternoon.Checked) { this.workingDays.Add(0); this.workingShifts.Add(2); } if (cbMondayEvening.Checked) { this.workingDays.Add(0); this.workingShifts.Add(3); } } if (cbTuesday.Checked) { if (cbTuesdayMorning.Checked) { this.workingDays.Add(1); this.workingShifts.Add(1); } if (cbTuesdayAfternoon.Checked) { this.workingDays.Add(1); this.workingShifts.Add(2); } if (cbTuesdayEvening.Checked) { this.workingDays.Add(1); this.workingShifts.Add(3); } } if (cbWednesday.Checked) { if (cbWednesdayMorning.Checked) { this.workingDays.Add(2); this.workingShifts.Add(1); } if (cbWednesdayAfternoon.Checked) { this.workingDays.Add(2); this.workingShifts.Add(2); } if (cbWednesdayEvening.Checked) { this.workingDays.Add(2); this.workingShifts.Add(3); } } if (cbThursday.Checked) { if (cbThursdayMorning.Checked) { this.workingDays.Add(3); this.workingShifts.Add(1); } if (cbThursdayAfternoon.Checked) { this.workingDays.Add(3); this.workingShifts.Add(2); } if (cbThursdayEvening.Checked) { this.workingDays.Add(3); this.workingShifts.Add(3); } } if (cbFriday.Checked) { if (cbFridayMorning.Checked) { this.workingDays.Add(4); this.workingShifts.Add(1); } if (cbFridayAfternoon.Checked) { this.workingDays.Add(4); this.workingShifts.Add(2); } if (cbFridayEvening.Checked) { this.workingDays.Add(4); this.workingShifts.Add(3); } } if (cbSaturday.Checked) { if (cbSaturdayMorning.Checked) { this.workingDays.Add(5); this.workingShifts.Add(1); } if (cbSaturdayAfternoon.Checked) { this.workingDays.Add(5); this.workingShifts.Add(2); } if (cbSaturdayEvening.Checked) { this.workingDays.Add(5); this.workingShifts.Add(3); } } if (cbSunday.Checked) { if (cbSundayMorning.Checked) { this.workingDays.Add(6); this.workingShifts.Add(1); } if (cbSundayAfternoon.Checked) { this.workingDays.Add(6); this.workingShifts.Add(2); } if (cbSundayEvening.Checked) { this.workingDays.Add(6); this.workingShifts.Add(3); } } ca.AddEmployeeShifts(workingDays, workingShifts); this.Hide(); } } }