コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtNombre.Text.Trim() == "")
     {
         MessageBox.Show("Asegurese de ingresar el nombre-", "Close Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtNombre.Focus();
     }
     else if (txtEtd.Text.Trim() == "")
     {
         MessageBox.Show("Asegurese de ingresar el ETD.", "Close Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtEtd.Focus();
     }
     else if (txtTipoAeronave.Text.Trim() == "")
     {
         MessageBox.Show("Asegurese de ingresar el tipo de aeronave.", "Close Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtTipoAeronave.Focus();
     }
     else if (txtVelocidadCrucero.Text.Trim() == "")
     {
         MessageBox.Show("Asegurese de ingresar la velocidad crucero.", "Close Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtVelocidadCrucero.Focus();
     }
     else if (txtReglasDeVuelo.Text.Trim() == "")
     {
         MessageBox.Show("Asegurese de ingresar las reglas de vuelo.", "Close Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtReglasDeVuelo.Focus();
     }
     else
     {
         ConsumeWebApi consume            = new ConsumeWebApi();
         Boolean       registrarPlanVuelo = consume.crearPlan(txtNombre.Text, txtEtd.Value.ToString("dd-MMMM-yyyy", CultureInfo.CreateSpecificCulture("en-US")), txtQrf.Value.ToString("dd-MMMM-yyyy", CultureInfo.CreateSpecificCulture("en-US")), txtTipoAeronave.Text, txtVelocidadCrucero.Text, txtReglasDeVuelo.Text, txtSalida.Text, txtDestino.Text);
         if (registrarPlanVuelo)
         {
             MessageBox.Show("Nuevo plan de vuelo creado.", "Close Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show("Ha ocurrido un error.", "Close Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }