private void btnAddTime_Click(object sender, EventArgs e)//_______________________________Add___________________________________ { if (isValid.isTimeRouteValid(cbTimeRoute.SelectedIndex) && (isValid.isTimeValid(tbStartHour.Text, tbStartMin.Text, tbFinishHour.Text, tbFinishMin.Text))) { string s = cbTimeRoute.Text; if (timesDataLink.Exists(s.Substring(0, s.IndexOf("-") - 1), s.Substring(s.IndexOf("-") + 2))) { MessageBox.Show("Для данного маршрута уже выбрано время полета"); } else { Time time = new Time() { Start = s.Substring(0, s.IndexOf("-") - 1), Finish = s.Substring(s.IndexOf("-") + 2), StartHour = Convert.ToInt32(tbStartHour.Text), StartMin = Convert.ToInt32(tbStartMin.Text), FinishHour = Convert.ToInt32(tbFinishHour.Text), FinishMin = Convert.ToInt32(tbFinishMin.Text) }; timesDataLink.Add(time); fillTimeTable(); } cbTimeRoute.SelectedIndex = -1; tbStartHour.Text = ""; tbStartMin.Text = ""; tbFinishHour.Text = ""; tbFinishMin.Text = ""; } }