예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Program.CheckString(new string[] { textBox1.Text, textBox2.Text, textBox5.Text, textBox6.Text }))
     {
         try
         {
             string      patron = (!String.IsNullOrEmpty(textBox3.Text) ? Program.NameString(textBox3.Text) : "");
             StudentForm stud   = new StudentForm(Program.NameString(textBox1.Text), Program.NameString(textBox2.Text),
                                                  patron, Program.NameString(textBox5.Text), Program.NameString(textBox6.Text));
             stud.AddStudent(dateTimePicker1);
             ((Main)Owner).ученикиToolStripMenuItem_Click(sender, e);
             this.Close();
         }
         catch (Exception ex) { MessageBox.Show(ex.Message); }
     }
     else
     {
         MessageBox.Show("Не все поля заполнены!");
     }
 }
예제 #2
0
        // El boton realiza un Add Dependiendo el tipo de Modelo que sesivira
        private void BtnAddData_Click(object sender, RoutedEventArgs e)
        {
            switch (TypeForm)
            {
            case "Student":
                StudentForm studentForm = new StudentForm();
                studentForm.AddStudent(MainWindow);
                break;

            case "Career":
                CareerForm careerForm = new CareerForm();
                careerForm.AddCareer(MainWindow);
                break;

            case "Professor":
                ProfessorForm professorForm = new ProfessorForm();
                professorForm.AddProfessor(MainWindow);
                break;
            }
            Close();
        }