Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Program.CheckString(new string[] { maskedTextBox1.Text, textBox1.Text }))
     {
         try
         {
             AutoForm auto = new AutoForm(maskedTextBox1.Text, textBox1.Text, (int)numericUpDown1.Value);
             auto.AddAuto();
             ((Main)Owner).автоToolStripMenuItem_Click(sender, e);
             this.Close();
         }
         catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); }
     }
     else
     {
         MessageBox.Show("Не все поля заполнены!");
     }
 }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Program.CheckString(new string[] { textBox1.Text, maskedTextBox1.Text }))
     {
         try
         {
             var      result = ((Main)Owner).db.auto.SingleOrDefault(n => n.id_a == item2.id_a);
             AutoForm auto   = new AutoForm();
             auto.EditAuto(item2, textBox1.Text, maskedTextBox1.Text, (int)numericUpDown1.Value, result);
             ((Main)Owner).autoSheet = ((Main)Owner).db.auto.OrderBy(n => n.id_a).ToList();
             ((Main)Owner).db.SaveChanges();
             ((Main)Owner).автоToolStripMenuItem_Click(sender, e);
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }