private void Submit_Button_Click(object sender, EventArgs e) { //Create a list of names for the Advisors List <String> advisors = new List <String>(); //Get all checked advisors and add them to list foreach (var item in Advisor_CheckBox.CheckedItems) { advisors.Add(item.ToString()); } //get names first and add them to list List <String> employees = new List <String>(); foreach (var item in Employee_CheckBox.CheckedItems) { employees.Add(item.ToString()); } //Make form for checked employees Inputs_Form form = new Inputs_Form(employees, advisors); this.Hide(); form.Closed += (s, args) => this.Close(); form.Show(); }
private void Finished_Button_Click(object sender, EventArgs e) { if ((int)(A1Percent.Value + A2Percent.Value + A3Percent.Value + A4Percent.Value) != 100) { MessageBox.Show("Total Percent must be 100"); return; } //Get the data string name = employees[0]; //get all hours worked List <Time> dailyHoursWorked = new List <Time>(); dailyHoursWorked.Add(ConvertToTime(Day1Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day2Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day3Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day4Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day5Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day6Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day7Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day8Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day9Hours.Text)); dailyHoursWorked.Add(ConvertToTime(Day10Hours.Text)); List <Time> clockInTimes = new List <Time>(); clockInTimes.Add(new Time(Day1Picker.Value.Hour, Day1Picker.Value.Minute)); clockInTimes.Add(new Time(Day2Picker.Value.Hour, Day2Picker.Value.Minute)); clockInTimes.Add(new Time(Day3Picker.Value.Hour, Day3Picker.Value.Minute)); clockInTimes.Add(new Time(Day4Picker.Value.Hour, Day4Picker.Value.Minute)); clockInTimes.Add(new Time(Day5Picker.Value.Hour, Day5Picker.Value.Minute)); clockInTimes.Add(new Time(Day6Picker.Value.Hour, Day6Picker.Value.Minute)); clockInTimes.Add(new Time(Day7Picker.Value.Hour, Day7Picker.Value.Minute)); clockInTimes.Add(new Time(Day8Picker.Value.Hour, Day8Picker.Value.Minute)); clockInTimes.Add(new Time(Day9Picker.Value.Hour, Day9Picker.Value.Minute)); clockInTimes.Add(new Time(Day10Picker.Value.Hour, Day10Picker.Value.Minute)); List <int> advisorPercent = new List <int>(); advisorPercent.Add((int)A1Percent.Value); advisorPercent.Add((int)A2Percent.Value); advisorPercent.Add((int)A3Percent.Value); advisorPercent.Add((int)A4Percent.Value); //Set the data to the employee object Employee emp = new Employee(name, dailyHoursWorked, clockInTimes, advisorPercent); data.Add(emp); //if employees is not empty show next employee form employees.RemoveAt(0); if (employees.Count() > 0) { Inputs_Form form = new Inputs_Form(employees, advisors, data); this.Hide(); form.Closed += (s, args) => this.Close(); form.Show(); } //otherwise show calculation form else { Calculation_Form form = new Calculation_Form(data, advisors); this.Hide(); form.Closed += (s, args) => this.Close(); form.Show(); } }