private void groupNumber_comboBox_SelectedIndexChanged_1(object sender, EventArgs e) { if (Path_textBox.Text != "") { try { SecretaryController.myConnection.Open(); duetNumber_textBox.Text = ""; //duetNumber_textBox.Text = (SecretaryController.TakeMax("Номер", "duets", Path_textBox.Text) + 1).ToString(); duetNumber_textBox.Text = (SecretaryController.TakeMax("Номер", "duets", "Номер_Группы", groupNumber_comboBox.SelectedIndex + 1, Path_textBox.Text) + 1).ToString(); GroupAgeCategoryList.Clear(); string retstr = ""; //MessageBox.Show(tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList.Count.ToString()); for (int i = 0; i < tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList.Count; i++) { GroupAgeCategoryList.Add(tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList[i].Replace(" ", string.Empty)); retstr += tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList[i].Replace(" ", string.Empty); } groupName_textBox.Text = tournir.groups[groupNumber_comboBox.SelectedIndex].name; MessageBox.Show(retstr); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void Path_textBox_TextChanged(object sender, EventArgs e) { groupNumber_comboBox.Items.Clear(); groupName_textBox.Text = ""; GroupAgeCategoryList.Clear(); folderName = Path_textBox.Text; try { tournir = SecretaryController.TakeTournir(folderName); for (int i = 0; i < tournir.groups.Count; i++) { groupNumber_comboBox.Items.Add(tournir.groups[i].number); MessageBox.Show("Категорий в группе " + (i + 1).ToString() + " " + tournir.groups[i].number.ToString()); for (int j = 0; j < tournir.groups[i].CategoryList.Count; j++) { if (!GroupAgeCategoryList.Contains(tournir.groups[i].CategoryList[j])) { MessageBox.Show(tournir.groups[i].CategoryList[j]); GroupAgeCategoryList.Add(tournir.groups[i].CategoryList[j]); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Path_textBox_TextChanged(object sender, EventArgs e) { folderName = Path_textBox.Text; //try //{ tournir = SecretaryController.TakeTournir(folderName); //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message); //} }
private void Path_textBox_TextChanged(object sender, EventArgs e) { folderName = Path_textBox.Text; try { tournir = SecretaryController.TakeTournir(folderName); for (int i = 0; i < tournir.groups.Count; i++) { groupNumber_comboBox.Items.Add(tournir.groups[i].number); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void groupNumber_comboBox_SelectedIndexChanged(object sender, EventArgs e) { try { duetNumber_textBox.Text = ""; duetNumber_textBox.Text = SecretaryController.TakeMax("Номер", "duets", Path_textBox.Text).ToString(); for (int i = 0; i < tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList.Count; i++) { AgeCategoryList.Add(tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList[i]); //AgeCategory2_comboBox.Items.Add(tournir.groups[groupNumber_comboBox.SelectedIndex].CategoryList[i]); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void registr_button_Click(object sender, EventArgs e) { Judge judge = new Judge(); judge.Surname = JudgeSurname_textBox.Text; judge.Name = JudgeName_textBox.Text; judge.Patronymic = JudgePatronymic_textBox.Text; judge.JudgeClass = JudgeClass_textBox.Text; if (Path_textBox.Text != "") { SecretaryController.insertInJudges(judge, Path_textBox.Text); judge.Number = (ushort)(SecretaryController.TakeMax("Номер", "judges", Path_textBox.Text)); judge.judgeChar = (char)(64 + judge.Number); tournir.judges.Add(judge); MessageBox.Show("Новый судья: \n" + judge.Surname + "\n" + judge.Name + "\n" + judge.Patronymic + "\n" + judge.JudgeClass + "\n" + judge.Number + " " + judge.judgeChar + "\n" + "Успешно зарегистрирован!"); } else { MessageBox.Show("Необходимо выбрать базу Турнира!"); } }
public TournirClass(string cn) { this.groups = new List <GroupClass>(); SecretaryController.TakeTournir(cn); }
private void registrationButton_Click(object sender, EventArgs e) { //bool searchFailedFlag = false; //if (BookNumber1_textBox.Text != "" && BookNumber2_textBox.Text != "") //try //{ //sportsman_first = Controller.SearchByBookNumber(Convert.ToInt32(BookNumber1_textBox.Text)); //sportsman_second = Controller.SearchByBookNumber(Convert.ToInt32(BookNumber2_textBox.Text)); //if (sportsman_first.Name != "NotDefined" || sportsman_second.Name != "NotDefined") //{ // searchFailedFlag = true; //} //} //catch (Exception ex) //{ // MessageBox.Show($"{ex.Message}"); //} //else //{ // MessageBox.Show("Заполните поле 'Номер Книжки' для первого спортсмена!"); //} if (checkAllBoxes()) { sportsman_first.Name = Name1textBox.Text; sportsman_first.Surname = Surname1textBox.Text; sportsman_first.Patronymic = Patronymic1textBox.Text; sportsman_second.Name = Name2textBox.Text; sportsman_second.Surname = Surname2textBox.Text; sportsman_second.Patronymic = Patronymic2textBox.Text; sportsman_first.BirthDate = new MyDate(); sportsman_second.BirthDate = new MyDate(); //sportsman_first.BirthDate = new DateTime(2020 - YearOfBirth1_comboBox.SelectedIndex, MounthOfBirth1_comboBox.SelectedIndex + 1, DayOfBirth1_comboBox.SelectedIndex + 1); //sportsman_second.BirthDate = new DateTime(2020 - YearOfBirth2_comboBox.SelectedIndex, MounthOfBirth2_comboBox.SelectedIndex + 1, DayOfBirth2_comboBox.SelectedIndex + 1); sportsman_first.BirthDate.Day = DayOfBirth1_comboBox.SelectedIndex + 1; sportsman_first.BirthDate.Month = MounthOfBirth1_comboBox.SelectedIndex + 1; sportsman_first.BirthDate.Year = 2020 - YearOfBirth1_comboBox.SelectedIndex; //MessageBox.Show(sportsman_first.BirthDate.ToShortDateString() + "\n" + sportsman_second.BirthDate.ToShortDateString()); sportsman_second.BirthDate.Day = DayOfBirth2_comboBox.SelectedIndex + 1; sportsman_second.BirthDate.Month = MounthOfBirth2_comboBox.SelectedIndex + 1; sportsman_second.BirthDate.Year = 2020 - YearOfBirth2_comboBox.SelectedIndex; //sportsman_first.BookNumber = Convert.ToInt32(BookNumber1_textBox.Text); //sportsman_second.BookNumber = Convert.ToInt32(BookNumber2_textBox.Text); sportsman_first.BookNumber = 0; sportsman_second.BookNumber = 0; sportsman_first.ClubName = ClubName_textBox.Text; sportsman_first.City = City_textBox.Text; sportsman_second.ClubName = ClubName_textBox.Text; sportsman_second.City = City_textBox.Text; sportsman_first.OlderTrainer = new Trainer(NameOfOldTrainer_textBox.Text, SurnameOfOldTrainer_textBox.Text, PatronymicOfOldTrainer_textBox.Text, 1); sportsman_second.OlderTrainer = new Trainer(NameOfOldTrainer_textBox.Text, SurnameOfOldTrainer_textBox.Text, PatronymicOfOldTrainer_textBox.Text, 1); sportsman_first.AgeCategory = Controller.AgeCategoryAutoFill(DayOfBirth1_comboBox, MounthOfBirth1_comboBox, YearOfBirth1_comboBox, AgeCategoryList); sportsman_first.SportClass = Convert.ToString(SportClass1_comboBox.SelectedItem); sportsman_first.SportCategory = Convert.ToString(SportCategory1_comboBox.SelectedItem); sportsman_second.AgeCategory = Controller.AgeCategoryAutoFill(DayOfBirth2_comboBox, MounthOfBirth2_comboBox, YearOfBirth2_comboBox, AgeCategoryList); sportsman_second.SportClass = Convert.ToString(SportClass2_comboBox.SelectedItem); sportsman_second.SportCategory = Convert.ToString(SportCategory2_comboBox.SelectedItem); //if (searchFailedFlag) //{ // Controller.insertInSportDB(sportsman_first); // Controller.insertInSportDB(sportsman_second); // // Controller.insertTrainer(sportsman_first.OlderTrainer, sportsman_first.BookNumber); //} SecretaryController.insertInParticipants(sportsman_first, Path_textBox.Text); SecretaryController.insertInParticipants(sportsman_second, Path_textBox.Text); SecretaryController.insertParticipantsInDuet(Convert.ToInt32(duetNumber_textBox.Text), sportsman_first, sportsman_second, Convert.ToInt32(groupNumber_comboBox.Text), Path_textBox.Text); } else { MessageBox.Show("Не все необходимые поля заполнены!"); } }
private void registrationButton_Click(object sender, EventArgs e) { if (checkAllBoxes()) { sportsman.Name = Name_textBox.Text; sportsman.Surname = Surname_textBox.Text; sportsman.Patronymic = Patronymic_textBox.Text; sportsman.NumberInTournir = Convert.ToInt32(duetNumber_textBox.Text); //sportsman.BirthDate = new DateTime(2020 - YearOfBirth_comboBox.SelectedIndex, MounthOfBirth_comboBox.SelectedIndex + 1, DayOfBirth_comboBox.SelectedIndex + 1); sportsman.BirthDate.Day = DayOfBirth_comboBox.SelectedIndex + 1; sportsman.BirthDate.Month = MounthOfBirth_comboBox.SelectedIndex + 1; sportsman.BirthDate.Year = 2020 - YearOfBirth_comboBox.SelectedIndex; //sportsman.BookNumber = Convert.ToInt32(BookNumber_textBox.Text); sportsman.GroupNumber = Convert.ToInt32(groupNumber_comboBox.Text); sportsman.ClubName = ClubName_textBox.Text; sportsman.City = City_textBox.Text; //string retstr = ""; //foreach (CheckBox item in danceCheckList) //{ // if (item.Checked) // { // sportsman.danceList.Add(new danceClass(item.Text)); // retstr += item.Text + "\n"; // } //} //MessageBox.Show(retstr); sportsman.OlderTrainer = new Trainer(NameOfOldTrainer_textBox.Text, SurnameOfOldTrainer_textBox.Text, PatronymicOfOldTrainer_textBox.Text, 1); if (FirstTrainer_checkBox.Checked) { sportsman.FirstTrainer = new Trainer(NameFirstTrainer_textBox.Text, SurnameFirstTrainer_textBox.Text, PatronymicFirstTrainer_textBox.Text, 1); } if (SecondTrainer_checkBox.Checked) { sportsman.SecondTrainer = new Trainer(NameSecondTrainer_textBox.Text, SurnameSecondTrainer_textBox.Text, PatronymicSecondTrainer_textBox.Text, 1); } //sportsman.AgeCategory = Controller.AgeCategoryAutoFill(DayOfBirth_comboBox, MounthOfBirth_comboBox, YearOfBirth_comboBox, GroupAgeCategoryList); //if (sportsman.AgeCategory == "0") //{ // MessageBox.Show("Процесс регистрации прерван. Ни одна из категория группы не подходит возрасту спортсмена!"); // return; //} //Controller.checkAgeCategory(sportsman.AgeCategory, GroupAgeCategoryList); //string retstr = ""; //for (int g = 0; g < GroupAgeCategoryList.Count; g++) //{ // retstr += GroupAgeCategoryList[g]; //} //MessageBox.Show(retstr); if (!GroupAgeCategoryList.Contains(sportsman.AgeCategory)) { MessageBox.Show("В группее нет категорий, подходящих спортсмену!"); return; } sportsman.SportClass = Convert.ToString(SportClass_comboBox.SelectedItem); sportsman.SportCategory = Convert.ToString(SportCategory_comboBox.SelectedItem); MessageBox.Show($"Новый спортсмен \nФамилия: {sportsman.Surname}\nИмя: {sportsman.Name}\nОтчество: {sportsman.Patronymic}" + $"\nНомер Книжки: {sportsman.BookNumber}\nГород: {sportsman.City}\nВозростная Категория: {sportsman.AgeCategory}" + $"\nСпортивный Класс: {sportsman.SportClass}\nРазраяд: {sportsman.SportCategory}\nСтарший тренер: {sportsman.OlderTrainer.Name} {sportsman.OlderTrainer.Surname}"); //////Controller.insertInSportDB(sportsman); //////Controller.insertTrainer(sportsman.OlderTrainer, sportsman.BookNumber); //////if (FirstTrainer_checkBox.Checked) ////// Controller.insertTrainer(sportsman.FirstTrainer, sportsman.BookNumber); //////if (SecondTrainer_checkBox.Checked) ////// Controller.insertTrainer(sportsman.SecondTrainer, sportsman.BookNumber); SecretaryController.insertInParticipants(sportsman, Path_textBox.Text); //SecretaryController.insertInParticipants(sportsman, Path_textBox.Text); //if (setNumber_comboBox.SelectedIndex != -1) SecretaryController.insertParticipantsInDuet(Convert.ToInt32(duetNumber_textBox.Text), sportsman, Convert.ToInt32(groupNumber_comboBox.Text), Path_textBox.Text); } else { MessageBox.Show("Не все необходимые поля заполнены!"); } }