Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        private void Modification_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.OK)
            {
                try
                {
                    if (Averagerating_TB.Text.Trim() == "")
                    {
                        Averagerating_TB.Focus();
                        throw new Exception("Средняя оценка должна содержать значение");
                    }

                    if (Age_TB.Text.Trim() == "")
                    {
                        Age_TB.Focus();
                        throw new Exception("Введите возраст");
                    }

                    String Name = Name_TB.Text.Trim();

                    if (String.IsNullOrWhiteSpace(Name))
                    {
                        throw new Exception("Введите имя");
                    }

                    String Surname = Surname_TB.Text.Trim();

                    if (String.IsNullOrWhiteSpace(Surname))
                    {
                        throw new Exception("Введите фамилию");
                    }

                    String Middlename = Middlename_TB.Text.Trim();

                    if (String.IsNullOrWhiteSpace(Middlename))
                    {
                        throw new Exception("Введите отчество");
                    }

                    if (Class_TB.Text.Trim() == "")
                    {
                        Class_TB.Focus();
                        throw new Exception("Введите класс");
                    }

                    int c = Convert.ToInt32(Class_TB.Text);

                    if (c < 1 || c > 11)
                    {
                        Class_TB.Focus();
                        throw new Exception("Номер класса должнен находиться в диапазоне от 1 до 11");
                    }

                    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 Fex)
                {
                    e.Cancel = true;
                    MessageBox.Show(Fex.Message, "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                catch (Exception ex)
                {
                    e.Cancel = true;
                    MessageBox.Show(ex.Message, "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
        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);
                }
            }
        }