示例#1
0
        public static clsPabellon seleccionarPabellon(clsPabellon objPabellon)
        {
            List <SqlParameter> lstParametrosSQL = new List <SqlParameter>();
            SqlParameter        sqlParametro;

            lstParametrosSQL = crearLista(objPabellon);

            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_ManPabellon", lstParametrosSQL);

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

            return(objPabellon);
        }
示例#2
0
        public static bool eliminarPabellon(clsPabellon objPabellon)
        {
            List <SqlParameter> lstParametrosSQL = new List <SqlParameter>();
            SqlParameter        sqlParametro;

            lstParametrosSQL = crearLista(objPabellon);

            sqlParametro = new SqlParameter();
            sqlParametro.ParameterName = "@Accion";
            sqlParametro.Value         = 2;
            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_ManPabellon", lstParametrosSQL);

            if (numResultado != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        private void mostrarInformacion(clsPabellon objPabellon, int numAccion)
        {
            if (numAccion != clsComun.INSERTAR)
            {
                txtNombreDetalle.Text       = objPabellon.Nombre;
                rtxtDescripcionDetalle.Text = objPabellon.Descripcion;
            }

            if (numAccion == clsComun.VER)
            {
                txtNombreDetalle.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;
                rtxtDescripcionDetalle.Solo_Lectura = SistemaCentroSalud.Controles.cuRichTextBox.SoloLectura.falso;

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

            clsComun.tabSiguiente(tbcPabellon, tbpBuscar, tbpDetalle);
        }
示例#4
0
        public frmPabellon()
        {
            InitializeComponent();

            clsPabellon objPabellon = new clsPabellon();

            objPabellon.Estado = "TODOS";

            dtPabellones = ctrPabellon.seleccionarPabellonesCriterios(objPabellon);

            cargarGrilla();
        }
示例#5
0
        private void buscarCriterios(object sender, EventArgs e)
        {
            try
            {
                clsPabellon objPabellon = new clsPabellon();
                objPabellon.Nombre = txtNombreBuscar.Text;
                objPabellon.Estado = cboEstadoBuscar.SelectedItem.ToString();

                dtPabellones = ctrPabellon.seleccionarPabellonesCriterios(objPabellon);
                cargarGrilla();
            }
            catch
            {
            }
        }
示例#6
0
        private static List <SqlParameter> crearLista(clsPabellon objPabellon)
        {
            List <SqlParameter> lstParametrosSQL = new List <SqlParameter>();
            SqlParameter        sqlParametro;

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

                    lstParametrosSQL.Add(sqlParametro);
                }
            }

            return(lstParametrosSQL);
        }
示例#7
0
        private void btnActivar_Click(object sender, EventArgs e)
        {
            if (dgvPabellones.SelectedRows.Count > 0)
            {
                if (MessageBox.Show("¿Está seguro que desea activar este pabellón?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    numAccion = clsComun.RECUPERAR;

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

                    clsPabellon objPabellon = new clsPabellon();
                    objPabellon.IdPabellon = numIdPabellon;

                    if (ctrPabellon.recuperarPabellon(objPabellon))
                    {
                        dgvPabellones.Rows[dgvPabellones.CurrentRow.Index].Cells[2].Value = "ACTIVO";

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

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

                        MessageBox.Show("El pabellón se activó exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        if (MessageBox.Show("Ocurrió un error mientras se intentaba activar el pabellón", "Mensaje", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Cancel)
                        {
                            btnEliminar_Click(sender, e);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un pabellón", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#8
0
        private void cargarCombosPabellon()
        {
            clsPabellon objPabellon = new clsPabellon();

            DataTable dt = ctrPabellon.seleccionarPabellonesCriterios(objPabellon);

            objPabellon.Nombre = "TODOS";

            cboPabellonBuscar.Items.Add(objPabellon);
            cboPabellonDetalle.Items.Add(objPabellon);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                objPabellon = new clsPabellon();

                objPabellon.IdPabellon = Int32.Parse(dt.Rows[i]["IdPabellon"].ToString());
                objPabellon.Nombre     = dt.Rows[i]["Nombre"].ToString();

                cboPabellonBuscar.Items.Add(objPabellon);
                cboPabellonDetalle.Items.Add(objPabellon);
            }
        }
示例#9
0
        public static DataTable seleccionarPabellonesCriterios(clsPabellon objPabellon)
        {
            List <SqlParameter> lstParametrosSQL = new List <SqlParameter>();
            SqlParameter        sqlParametro;

            lstParametrosSQL = crearLista(objPabellon);

            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_ManPabellon", lstParametrosSQL));
        }
示例#10
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            if (dgvPabellones.SelectedRows.Count > 0)
            {
                numAccion = clsComun.MODIFICAR;

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

                limpiarFormulario();

                clsPabellon objPabellon = new clsPabellon();
                objPabellon.IdPabellon = numIdPabellon;

                objPabellon = ctrPabellon.seleccionarPabellon(objPabellon);

                mostrarInformacion(objPabellon, numAccion);

                txtNombreDetalle.Focus();
            }
            else
            {
                MessageBox.Show("Debe seleccionar un pabellón", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#11
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (numAccion == clsComun.VER)
            {
                clsComun.tabAnterior(tbcPabellon, tbpBuscar, tbpDetalle);

                limpiarFormulario();

                txtNombreBuscar.Focus();
            }
            else
            {
                if (validarFormulario())
                {
                    clsPabellon objPabellon = new clsPabellon();
                    objPabellon.IdPabellon  = numIdPabellon;
                    objPabellon.Nombre      = txtNombreDetalle.Text;
                    objPabellon.Descripcion = rtxtDescripcionDetalle.Text;

                    if (numAccion == clsComun.INSERTAR)
                    {
                        if (ctrPabellon.registrarPabellon(objPabellon))
                        {
                            if (MessageBox.Show("El pabellón se registró exitosamente\n¿Desea seguir registrando pabellones?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                            {
                                limpiarFormulario();

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

                                limpiarFormulario();

                                txtNombreBuscar.Focus();

                                dtPabellones = ctrPabellon.seleccionarPabellones(objPabellon);
                                cargarGrilla();
                            }
                        }
                        else
                        {
                            if (MessageBox.Show("Ocurrió un error mientras se intentaba registrar el pabellón", "Mensaje", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Cancel)
                            {
                                btnGuardar_Click(sender, e);
                            }
                        }
                    }
                    else if (numAccion == clsComun.MODIFICAR)
                    {
                        if (ctrPabellon.modificarPabellon(objPabellon))
                        {
                            MessageBox.Show("El pabellón se modificó exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            clsComun.tabAnterior(tbcPabellon, tbpBuscar, tbpDetalle);

                            limpiarFormulario();

                            txtNombreBuscar.Focus();

                            dtPabellones = ctrPabellon.seleccionarPabellones(objPabellon);
                            cargarGrilla();
                        }
                        else
                        {
                            if (MessageBox.Show("Ocurrió un error mientras se intentaba modificar el pabellón", "Mensaje", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Cancel)
                            {
                                btnGuardar_Click(sender, e);
                            }
                        }
                    }
                }
            }
        }