private void CreatePlanner(Participant participant, string plannerName, DayOfWeek firstDay, List <DayOfWeek> IncludedDays, string startTimeSample, string stopTimeSample, string intervalSample) { if (plannerName.Length != 0 && startTimeSample.Length != 0 && stopTimeSample.Length != 0 && intervalSample.Length != 0) { if (!ExtractPlanners(DbAdapter.GetPlanners(this.Participant.Name)).Contains(plannerName)) { if (IsTimeFormatCorrect(startTimeSample) && IsTimeFormatCorrect(stopTimeSample) && IsTimeFormatCorrect(intervalSample)) { ClockTime startTime = ExtractClockTime(startTimeSample); ClockTime stopTime = ExtractClockTime(stopTimeSample); ClockTimeInterval interval = ExtractClockTimeInterval(intervalSample); if (IsTimeOverlap(startTime, stopTime, interval)) { try { DataTable task = GenerateTasks(startTime, stopTime, interval, IncludedDays); DbAdapter.CreatePlanner(participant.Name, plannerName, firstDay.ToString(), startTime.ToString(), stopTime.ToString(), interval.ToString(), task); AdjustPlannerListBox(); OpenPlanner(participant, plannerName); } catch (Exception exception) { MessageBox.Show(exception.Message); } } else { MessageBox.Show($"Cannot create planner of given time values"); } } else { MessageBox.Show("Time values must be expressed as hh:mm"); } } else { MessageBox.Show($"Planner {plannerName} already exists"); } } else { MessageBox.Show("All fields must be non-empty"); } }