コード例 #1
0
 private void button_Save_Click(object sender, EventArgs e)
 {
     Model.Flight flight = new Model.Flight(
         textBox1.Text, textBox10.Text, textBox2.Text, textBox3.Text,
         dateTimePicker1.Value, dateTimePicker2.Value,
         float.Parse(textBox4.Text), int.Parse(textBox5.Text),
         float.Parse(textBox6.Text), int.Parse(textBox7.Text),
         float.Parse(textBox8.Text), int.Parse(textBox9.Text)
         );
     if (fno != "")
     {
         if (flight.Update())
         {
             MessageBox.Show("Successful!", "Information", MessageBoxButtons.OK);
             Log.Add(Program.user.ID, "Update flight " + fno + ".");
             this.Close();
         }
     }
     else
     {
         if (flight.Add())
         {
             MessageBox.Show("Successful!", "Information", MessageBoxButtons.OK);
             Log.Add(Program.user.ID, "Add a flight.");
             this.Close();
         }
     }
 }