예제 #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         using (databaseContext = CreateDatabaseContext())
         {
             EventiManagerNew manager = new EventiManagerNew(databaseContext);
             bool res = manager.InsertNewEventComplete(txtTitolo.Text.Trim(), txtDescription.Text.Trim(), double.Parse(txtCosto.Text.Trim()), int.Parse(txtPX.Text.Trim()), eventDates, timepickInGioco.Value, timepickFuoriGioco.Value, timepickStandardIg.Value, timepickStandardFg.Value);
             if (res)
             {
                 databaseContext.SaveChanges();
                 MessageBox.Show("Evento salvato");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Ricontrollare i dati: salvataggio non possibile");
             }
         }
     }
 }