Example #1
0
        private void CargarDatosAfiliado(int codigoAfiliado)
        {
            Afiliado afiliado;

            // Limpio
            afiliadoActual   = null;
            txtAfiliado.Text = "";
            txtPlan.Text     = "";
            txtPrecio.Value  = 0;

            using (PlanDAO dao = new PlanDAO())
            {
                afiliado = dao.buscarPlanAfiliado(codigoAfiliado);

                // Existe?
                if (afiliado == null)
                {
                    MessageBox.Show("Afiliado inexistente!");
                    return;
                }

                if (!afiliado.Habilitado)
                {
                    MessageBox.Show("El afiliado debe estar habilitado!");
                    return;
                }

                // Es valido
                afiliadoActual = afiliado;

                // Completo datos
                txtAfiliado.Text = afiliado.detalle.Nombre + ' ' + afiliado.detalle.Apellido;
                txtPlan.Text     = afiliado.plan.Nivel;
                txtPrecio.Value  = afiliado.plan.PrecioConsulta;
            }
        }