Esempio n. 1
0
        public static bool recuperarFinanciadorSalud(clsFinanciadorSalud objFinanciadorSalud)
        {
            List<SqlParameter> lstParametrosSQL = new List<SqlParameter>();
            SqlParameter sqlParametro;

            lstParametrosSQL = crearLista(objFinanciadorSalud);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@Accion";
            sqlParametro.Value = 3;
            sqlParametro.Direction = ParameterDirection.Input;

            lstParametrosSQL.Add(sqlParametro);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@IdGenerado";
            sqlParametro.Value = 0;
            sqlParametro.Direction = ParameterDirection.Output;

            lstParametrosSQL.Add(sqlParametro);

            int numResultado = clsGestorBD.ejecutarStoredProcedureInt("up_ManFinanciadorSalud", lstParametrosSQL);

            if (numResultado != 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 2
0
        public frmFinanciadorSalud()
        {
            InitializeComponent();

            clsFinanciadorSalud objFinanciadorSalud = new clsFinanciadorSalud();
            objFinanciadorSalud.Estado = "TODOS";

            dtFinanciadoresSalud = ctrFinanciadorSalud.seleccionarFinanciadoresSaludCriterios(objFinanciadorSalud);

            cargarGrilla();
        }
Esempio n. 3
0
        private void btnActivar_Click(object sender, EventArgs e)
        {
            if (dgvFinanciadoresSalud.SelectedRows.Count > 0)
            {
                if (MessageBox.Show("¿Está seguro que desea activar este financiador de salud?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    numAccion = clsComun.RECUPERAR;

                    numIdFinanciadorSalud = Int32.Parse(dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[0].Value.ToString());

                    clsFinanciadorSalud objFinanciadorSalud = new clsFinanciadorSalud();
                    objFinanciadorSalud.IdFinanciadorSalud = numIdFinanciadorSalud;

                    if (ctrFinanciadorSalud.recuperarFinanciadorSalud(objFinanciadorSalud))
                    {
                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[3].Value = "ACTIVO";

                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[1].Style.ForeColor = Color.Black;
                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[1].Style.BackColor = Color.White;
                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[2].Style.ForeColor = Color.Black;
                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[2].Style.BackColor = Color.White;
                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[3].Style.ForeColor = Color.Black;
                        dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[3].Style.BackColor = Color.White;

                        btnActivar.Visible = false;
                        btnEliminar.Visible = true;

                        MessageBox.Show("El financiador de salud se activó exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        if (MessageBox.Show("Ocurrió un error mientras se intentaba activar el financiador de salud", "Mensaje", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Cancel)
                        {
                            btnEliminar_Click(sender, e);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un financiador de salud", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 4
0
        private static List<SqlParameter> crearLista(clsFinanciadorSalud objFinanciadorSalud)
        {
            List<SqlParameter> lstParametrosSQL = new List<SqlParameter>();
            SqlParameter sqlParametro;

            foreach (PropertyInfo pi in objFinanciadorSalud.GetType().GetProperties())
            {
                if (pi.CanRead)
                {
                    sqlParametro = new SqlParameter();
                    sqlParametro.ParameterName = "@" + pi.Name;
                    sqlParametro.Value = pi.GetValue(objFinanciadorSalud, null);
                    sqlParametro.Direction = ParameterDirection.Input;

                    lstParametrosSQL.Add(sqlParametro);
                }
            }

            return lstParametrosSQL;
        }
Esempio n. 5
0
        public static clsFinanciadorSalud seleccionarFinanciadorSalud(clsFinanciadorSalud objFinanciadorSalud)
        {
            List<SqlParameter> lstParametrosSQL = new List<SqlParameter>();
            SqlParameter sqlParametro;

            lstParametrosSQL = crearLista(objFinanciadorSalud);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@Accion";
            sqlParametro.Value = 4;
            sqlParametro.Direction = ParameterDirection.Input;

            lstParametrosSQL.Add(sqlParametro);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@IdGenerado";
            sqlParametro.Value = 0;
            sqlParametro.Direction = ParameterDirection.Output;

            lstParametrosSQL.Add(sqlParametro);

            DataTable dtResultado = clsGestorBD.ejecutarStoredProcedureDataTable("up_ManFinanciadorSalud", lstParametrosSQL);

            objFinanciadorSalud.Codigo = dtResultado.Rows[0]["Codigo"].ToString();
            objFinanciadorSalud.Nombre = dtResultado.Rows[0]["Nombre"].ToString();
            objFinanciadorSalud.Descripcion = dtResultado.Rows[0]["Descripcion"].ToString();

            return objFinanciadorSalud;
        }
Esempio n. 6
0
        public static DataTable seleccionarFinanciadoresSaludCriterios(clsFinanciadorSalud objFinanciadorSalud)
        {
            List<SqlParameter> lstParametrosSQL = new List<SqlParameter>();
            SqlParameter sqlParametro;

            lstParametrosSQL = crearLista(objFinanciadorSalud);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@Accion";
            sqlParametro.Value = 6;
            sqlParametro.Direction = ParameterDirection.Input;

            lstParametrosSQL.Add(sqlParametro);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@IdGenerado";
            sqlParametro.Value = 0;
            sqlParametro.Direction = ParameterDirection.Output;

            lstParametrosSQL.Add(sqlParametro);

            return clsGestorBD.ejecutarStoredProcedureDataTable("up_ManFinanciadorSalud", lstParametrosSQL);
        }
Esempio n. 7
0
        private void mostrarInformacion(clsFinanciadorSalud objFinanciadorSalud, int numAccion)
        {
            if (numAccion != clsComun.INSERTAR)
            {
                txtNombreDetalle.Text = objFinanciadorSalud.Nombre;
                txtCodigoDetalle.Text = objFinanciadorSalud.Codigo;
                rtxtDescripcionDetalle.Text = objFinanciadorSalud.Descripcion;
            }

            if (numAccion == clsComun.VER)
            {
                txtNombreDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuTextBox.SoloLectura.verdadero;
                txtCodigoDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuTextBox.SoloLectura.verdadero;
                rtxtDescripcionDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuRichTextBox.SoloLectura.verdadero;

                btnCancelar.Visible = false;
                btnGuardar.Text = "Volver";
            }
            else
            {
                txtNombreDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuTextBox.SoloLectura.falso;
                txtCodigoDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuTextBox.SoloLectura.falso;
                rtxtDescripcionDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuRichTextBox.SoloLectura.falso;

                btnCancelar.Visible = true;
                btnGuardar.Text = "Guardar";
            }

            clsComun.tabSiguiente(tbcFinanciadorSalud, tbpBuscar, tbpDetalle);
        }
Esempio n. 8
0
        private void buscarCriterios(object sender, EventArgs e)
        {
            try
            {
                clsFinanciadorSalud objFinanciadorSalud = new clsFinanciadorSalud();
                objFinanciadorSalud.Nombre = txtNombreBuscar.Text;
                objFinanciadorSalud.Codigo = txtCodigoBuscar.Text;
                objFinanciadorSalud.Estado = cboEstadoBuscar.SelectedItem.ToString();

                dtFinanciadoresSalud = ctrFinanciadorSalud.seleccionarFinanciadoresSaludCriterios(objFinanciadorSalud);
                cargarGrilla();
            }
            catch
            {
            }
        }
Esempio n. 9
0
        private void btnVer_Click(object sender, EventArgs e)
        {
            if (dgvFinanciadoresSalud.SelectedRows.Count > 0)
            {
                numAccion = clsComun.VER;

                numIdFinanciadorSalud = Int32.Parse(dgvFinanciadoresSalud.Rows[dgvFinanciadoresSalud.CurrentRow.Index].Cells[0].Value.ToString());

                limpiarFormulario();

                clsFinanciadorSalud objFinanciadorSalud = new clsFinanciadorSalud();
                objFinanciadorSalud.IdFinanciadorSalud = numIdFinanciadorSalud;

                objFinanciadorSalud = ctrFinanciadorSalud.seleccionarFinanciadorSalud(objFinanciadorSalud);

                mostrarInformacion(objFinanciadorSalud, numAccion);

                txtNombreDetalle.Focus();
            }
            else
            {
                MessageBox.Show("Debe seleccionar un financiador de salud", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 10
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (numAccion == clsComun.VER)
            {
                clsComun.tabAnterior(tbcFinanciadorSalud, tbpBuscar, tbpDetalle);

                limpiarFormulario();

                txtNombreBuscar.Focus();
            }
            else
            {
                if (validarFormulario())
                {
                    clsFinanciadorSalud objFinanciadorSalud = new clsFinanciadorSalud();
                    objFinanciadorSalud.IdFinanciadorSalud = numIdFinanciadorSalud;
                    objFinanciadorSalud.Codigo = txtCodigoDetalle.Text;
                    objFinanciadorSalud.Nombre = txtNombreDetalle.Text;
                    objFinanciadorSalud.Descripcion = rtxtDescripcionDetalle.Text;

                    if (numAccion == clsComun.INSERTAR)
                    {
                        if (ctrFinanciadorSalud.registrarFinanciadorSalud(objFinanciadorSalud))
                        {
                            if (MessageBox.Show("El financiador de salud se registró exitosamente\n¿Desea seguir registrando financiadores de salud?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                            {
                                limpiarFormulario();

                                txtNombreDetalle.Focus();
                            }
                            else
                            {
                                clsComun.tabAnterior(tbcFinanciadorSalud, tbpBuscar, tbpDetalle);

                                limpiarFormulario();

                                txtNombreBuscar.Focus();

                                dtFinanciadoresSalud = ctrFinanciadorSalud.seleccionarFinanciadoresSalud(objFinanciadorSalud);
                                cargarGrilla();
                            }
                        }
                        else
                        {
                            if (MessageBox.Show("Ocurrió un error mientras se intentaba registrar el financiador de salud", "Mensaje", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Cancel)
                            {
                                btnGuardar_Click(sender, e);
                            }
                        }
                    }
                    else if (numAccion == clsComun.MODIFICAR)
                    {
                        if (ctrFinanciadorSalud.modificarFinanciadorSalud(objFinanciadorSalud))
                        {
                            MessageBox.Show("El financiador de salud se modificó exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            clsComun.tabAnterior(tbcFinanciadorSalud, tbpBuscar, tbpDetalle);

                            limpiarFormulario();

                            txtNombreBuscar.Focus();

                            dtFinanciadoresSalud = ctrFinanciadorSalud.seleccionarFinanciadoresSalud(objFinanciadorSalud);
                            cargarGrilla();
                        }
                        else
                        {
                            if (MessageBox.Show("Ocurrió un error mientras se intentaba modificar el financiador de salud", "Mensaje", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Cancel)
                            {
                                btnGuardar_Click(sender, e);
                            }
                        }
                    }
                }
            }
        }