Ejemplo n.º 1
0
 private void buttonVerificar_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBox_afil_numero.Text))
     {
         MessageBox.Show("Debe ingresar el número de Afiliado a validar.", "Hay campos incompletos",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         String nombreAfiliado = AfiliadoRol.verificarQueExistaElAfiliado(textBox_afil_numero.Text);
         if (nombreAfiliado != "")
         {
             if (AfiliadoRol.validarHabilitacion(textBox_afil_numero.Text))
             {
                 labelStatus.Text            = "El afiliado " + nombreAfiliado + " se encuentra actualmente habilitado.";
                 button_habilitar.Enabled    = false;
                 button_deshabilitar.Enabled = true;
             }
             else
             {
                 labelStatus.Text            = "El afiliado " + nombreAfiliado + " se encuentra actualmente inhabilitado.";
                 button_habilitar.Enabled    = true;
                 button_deshabilitar.Enabled = false;
             }
         }
         else
         {
             labelStatus.Text            = "El afiliado Nº " + textBox_afil_numero.Text + " no pertenece al sistema.";
             button_habilitar.Enabled    = false;
             button_deshabilitar.Enabled = false;
         }
     }
 }
Ejemplo n.º 2
0
 private void buttonDatos_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBox_afil_numero.Text))
     {
         MessageBox.Show("Debe ingresar el número de Afiliado a modificar.", "Hay campos incompletos",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         String nombreAfiliado = AfiliadoRol.verificarQueExistaElAfiliado(textBox_afil_numero.Text);
         if (nombreAfiliado != "")
         {
             labelStatus.Text = "";
             permitirControles(true);
             traerDatosAfiliado();
             llenarComboPlan();
             llenarComboEstadoCivil();
             textBox_afil_telefono.Text  = afiliado.telefono.ToString();
             textBox_afil_mail.Text      = afiliado.mail;
             textBox_afil_Direccion.Text = afiliado.direccion;
         }
         else
         {
             labelStatus.Text = "El afiliado Nº " + textBox_afil_numero.Text + " no pertenece al sistema.";
             permitirControles(false);
             textBox_afil_telefono.Text              = "";
             textBox_afil_mail.Text                  = "";
             textBox_afil_Direccion.Text             = "";
             comboBox_afil_plan.SelectedIndex        = -1;
             comboBox_afil_estadoCivil.SelectedIndex = -1;
         }
     }
 }
Ejemplo n.º 3
0
        protected void traerDatosAfiliado()
        {
            SqlConnection conn = new SqlConnection(conexion.cadena);

            using (conn)
            {
                conn.Open();
                SqlCommand command = new SqlCommand("select ISNULL(afil_estado_civil, 'none'), afil_plan_medico, user_mail, user_direccion, user_telefono " +
                                                    "from LOS_TRIGGERS.Afiliado, LOS_TRIGGERS.Usuario where afil_numero=@afiliado AND user_afiliado=afil_numero", conn);
                command.Parameters.AddWithValue("@afiliado", Convert.ToDecimal(textBox_afil_numero.Text));

                SqlDataReader reader = command.ExecuteReader();
                reader.Read();
                afiliado = new AfiliadoRol(reader.GetString(0), reader.GetDecimal(1), reader.GetString(2),
                                           reader.GetString(3), reader.GetDecimal(4));
                reader.Close();
                conn.Close();
            }
        }