Exemplo n.º 1
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         if (grbCargaDe.Text == "Ingrese Alergia")
         {
             Alergia_Service alerg_ser = new Alergia_Service();
             Alergia         alergias  = new Alergia();
             if (txtNombre.Text == "")
             {
                 MessageBox.Show("Debe completar el campo");
                 txtNombre.Focus();
             }
             else
             {
                 // FALTA VERIFICAR QUE NO SE REPITA
                 alergias.Nombre1 = txtNombre.Text.Trim();
                 alerg_ser.CargarAlergia(alergias);
                 MessageBox.Show("Se cargo con exito");
                 this.Dispose();
             }
         }
         else if (grbCargaDe.Text == "Ingrese Medicamento")
         {
             Medicamento_Service Medicament_Ser = new Medicamento_Service();
             Medicamento         Medicament     = new Medicamento();
             if (txtNombre.Text == "")
             {
                 MessageBox.Show("Debe completar el campo");
                 txtNombre.Focus();
             }
             else
             {
                 // FALTA VERIFICAR QUE NO SE REPITA
                 Medicament.Nombre1 = txtNombre.Text.Trim();
                 Medicament_Ser.CargarMedicamento(Medicament);
                 MessageBox.Show("Se cargo con exito");
                 this.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }