Esempio n. 1
0
        private void Spisok_LB_SelectedValueChanged(object sender, EventArgs e)
        {
            if (Spisok_LB.SelectedItem != null)
            {
                Schoolboy SchoolboyDB = Spisok_LB.SelectedItem as Schoolboy;

                if (SchoolboyDB != null)
                {
                    Averagerating_TB.Text = SchoolboyDB.Averagerating.ToString();
                    Age_TB.Text           = SchoolboyDB.Age.ToString();
                    Name_TB.Text          = SchoolboyDB.Name;
                    Surname_TB.Text       = SchoolboyDB.Surname;
                    Middlename_TB.Text    = SchoolboyDB.Middlename;
                    Class_TB.Text         = SchoolboyDB.Class.ToString();
                    Ranked_TB.Text        = SchoolboyDB.Ranked.ToString();
                }

                StateButton(true);
            }
            else
            {
                Averagerating_TB.Clear();
                Age_TB.Clear();
                Name_TB.Clear();
                Surname_TB.Clear();
                Middlename_TB.Clear();
                Class_TB.Clear();
                Ranked_TB.Clear();

                StateButton(false);
            }
        }
Esempio n. 2
0
        private void Spisok_LB_SelectedValueChanged(object sender, EventArgs e)
        {
            if (Spisok_LB.SelectedItem != null)
            {
                Runner runnerDB = Spisok_LB.SelectedItem as Runner;

                if (runnerDB != null)
                {
                    Height_TB.Text  = runnerDB.Height.ToString();
                    Weight_TB.Text  = runnerDB.Weight.ToString();
                    Age_TB.Text     = runnerDB.Age.ToString();
                    Name_TB.Text    = runnerDB.Name;
                    Surname_TB.Text = runnerDB.Surname;
                    Ranked_TB.Text  = runnerDB.Ranked.ToString();
                }

                StateButton(true);
            }
            else
            {
                Height_TB.Clear();
                Weight_TB.Clear();
                Age_TB.Clear();
                Name_TB.Clear();
                Surname_TB.Clear();
                Ranked_TB.Clear();

                StateButton(false);
            }
        }
Esempio n. 3
0
        private void RegistrationMail_F_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.OK)
            {
                try
                {
                    if (String.IsNullOrEmpty(DataReg_TB.Text))
                    {
                        DataReg_TB.Focus();
                        throw new Exception("Необходимо указать дату регистрации электронной почты");
                    }

                    if (String.IsNullOrEmpty(Name_TB.Text))
                    {
                        Name_TB.Focus();
                        throw new Exception("Необходимо указать имя владельца почты");
                    }

                    if (String.IsNullOrEmpty(Surname_TB.Text))
                    {
                        Surname_TB.Focus();
                        throw new Exception("Необходимо указать фамилию владельца почты");
                    }

                    if (String.IsNullOrEmpty(MiddleName_TB.Text))
                    {
                        MiddleName_TB.Focus();
                        throw new Exception("Необходимо указать отчество владельца почты");
                    }

                    if (String.IsNullOrEmpty(AddressMail_TB.Text))
                    {
                        AddressMail_TB.Focus();
                        throw new Exception("Необходимо указать адрес почты");
                    }

                    if (AddressMail_TB.Text.Trim().IndexOf('@') == -1)
                    {
                        AddressMail_TB.Focus();
                        throw new Exception("Неверный формат почты");
                    }
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message, "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                }
            }
        }
        private void Modification_F_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.OK)
            {
                try
                {
                    if (Height_TB.Text.Trim() == "")
                    {
                        Height_TB.Focus();
                        throw new Exception("Вы не ввели рост бегуна");
                    }

                    if (Weight_TB.Text.Trim() == "")
                    {
                        Weight_TB.Focus();
                        throw new Exception("Вы не ввели вес бегуна");
                    }

                    if (Age_TB.Text.Trim() == "")
                    {
                        Age_TB.Focus();
                        throw new Exception("Вы не ввели возраст бегуна");
                    }

                    if (Name_TB.Text.Trim() == "")
                    {
                        Name_TB.Focus();
                        throw new Exception("Вы не ввели имя бегуна");
                    }

                    if (Surname_TB.Text.Trim() == "")
                    {
                        Surname_TB.Focus();
                        throw new Exception("Вы не ввели фамилию бегуна");
                    }

                    if (Ranked_TB.Text.Trim() == "")
                    {
                        Ranked_TB.Focus();
                        throw new Exception("Вы не ввели место, которое бегун занял на олимпиаде");
                    }

                    int R = Convert.ToInt32(Ranked_TB.Text);

                    if (R < 1 || R > 3)
                    {
                        Ranked_TB.Focus();
                        throw new Exception("Занятое место на олимпиаде должно находиться в диапазоне 1...3");
                    }
                }
                catch (FormatException Fx)
                {
                    e.Cancel = true;
                    MessageBox.Show(Fx.Message, "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                catch (Exception Ex)
                {
                    e.Cancel = true;
                    MessageBox.Show(Ex.Message, "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Esempio n. 5
0
        private void RegistrationUser_F_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.OK)
            {
                try
                {
                    if (String.IsNullOrEmpty(DataReg_TB.Text))
                    {
                        DataReg_TB.Focus();
                        throw new Exception("Необходимо указать дату регистрации пользователя");
                    }

                    if (String.IsNullOrEmpty(Surname_TB.Text))
                    {
                        Surname_TB.Focus();
                        throw new Exception("Необходимо указать фамилию пользователя");
                    }
                    if (String.IsNullOrEmpty(Name_TB.Text))
                    {
                        Name_TB.Focus();
                        throw new Exception("Необходимо указать имя пользователя");
                    }

                    if (String.IsNullOrEmpty(MiddleName_TB.Text))
                    {
                        MiddleName_TB.Focus();
                        throw new Exception("Необходимо указать отчество пользователя");
                    }

                    if (Position_CB.SelectedIndex < 0)
                    {
                        Position_CB.Focus();
                        throw new Exception("Необходимо выбрать должность сотрудника");
                    }

                    if (String.IsNullOrEmpty(Login_TB.Text))
                    {
                        Login_TB.Focus();
                        throw new Exception("Необходимо указать логин пользователя");
                    }

                    List <User> TempList = SystemArgs.Users;

                    if (TempUser != null)
                    {
                        TempList.Remove(TempUser);
                    }

                    for (Int32 i = 0; i < TempList.Count(); i++)
                    {
                        if (TempList[i].Login == Login_TB.Text.Trim())
                        {
                            Login_TB.Focus();
                            throw new Exception("Пользователь с указанным логином уже существует");
                        }
                    }

                    if (String.IsNullOrEmpty(HashPassword_TB.Text))
                    {
                        HashPassword_TB.Focus();
                        throw new Exception("Необходимо указать пароль пользователя");
                    }

                    if (HashPassword_TB.Text.Length < 4)
                    {
                        HashPassword_TB.Focus();
                        throw new Exception("Длина пароля должна быть 4 и более символов");
                    }
                }
                catch (FormatException)
                {
                    MessageBox.Show("Указан неверный формат даты рождения", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message, "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                }
            }
        }