Beispiel #1
0
        private bool guardaEnotar()
        {
            h_enotar obj = new h_enotar();

            obj.expediente = Convert.ToInt32(txtExpediente.Text);
            obj.n_notario  = globales.convertInt(txtN_Notario.Text);
            obj.nombre_not = txtNombre_Not.Text;
            obj.n_acta_n   = globales.convertDouble(txtNActa_N.Text);
            obj.n_volu_n   = globales.convertDouble(txtN_Volu_N.Text);
            obj.f_inscr_n  = globales.convertDatetime(txtF_Inscr_N.Text);

            dbaseORM orm = new dbaseORM();

            string query = $"select expediente from datos.h_enotar where expediente = {txtExpediente.Text}";
            List <Dictionary <string, object> > resultado = orm.query(query);

            bool boolResultado;

            if (resultado.Count == 0)
            {
                boolResultado = orm.insert <h_enotar>(obj);
            }
            else
            {
                boolResultado = orm.update <h_enotar>(obj);
            }

            return(boolResultado);
        }
Beispiel #2
0
        private bool guardaPagare()
        {
            h_spagar obj = new h_spagar();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);
            obj.f_pagare   = globales.convertDatetime(txtF_Pagare.Text);
            obj.f_primdesc = globales.convertDatetime(txtF_Primdesc.Text);

            dbaseORM orm = new dbaseORM();

            string query = $"select expediente from datos.h_spagar where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);

            bool boolResultado;

            if (resultado.Count == 0)
            {
                boolResultado = orm.insert <h_spagar>(obj);
            }
            else
            {
                boolResultado = orm.update <h_spagar>(obj);
            }

            return(boolResultado);
        }
        private bool guardaConvenio()
        {
            h_sconsj obj = new h_sconsj();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);

            obj.proyecto = txtProyecto.Text;
            obj.cred_ant = txtCred_Ant.Text;
            obj.avance_o = txtAvance_o.Text;

            obj.necesida    = txtNececidad.Text;
            obj.solvencia   = txtSolvencia.Text;
            obj.observacion = txtObvervaciones.Text;

            dbaseORM orm   = new dbaseORM();
            string   query = $"select expediente from datos.h_sconsj where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);

            bool boolResultado;

            if (resultado.Count == 0)
            {
                boolResultado = orm.insert <h_sconsj>(obj);
            }
            else
            {
                boolResultado = orm.update <h_sconsj>(obj);
            }

            return(boolResultado);
        }
Beispiel #4
0
        private bool guardarNegativo()
        {
            h_simpro obj = new h_simpro();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);
            obj.f_noproc   = globales.convertDatetime(txtF_Noproc.Text);
            obj.t_noproc   = txtT_Noproc.Text;

            dbaseORM orm = new dbaseORM();

            string query = $"select * from datos.h_simpro where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);
            bool actualizado;

            if (resultado.Count == 0)
            {
                actualizado = orm.insert <h_simpro>(obj);
            }
            else
            {
                actualizado = orm.update <h_simpro>(obj);
            }

            return(actualizado);
        }
        private bool guardarHsconvm()
        {
            h_sconvm obj = new h_sconvm();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);
            obj.f_convm    = globales.convertDatetime(txtF_Convm.Text);
            obj.nombre_t1  = txtNombre_T1.Text;
            obj.nombre_t2  = txtNombre_T2.Text;
            obj.direc_1    = txtDirec_1.Text;
            obj.direc_2    = txtDirec_2.Text;

            dbaseORM orm = new dbaseORM();

            string query = $"select * from datos.h_sconvm where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);

            bool actualizado;

            if (resultado.Count == 0)
            {
                actualizado = orm.insert <h_sconvm>(obj);
            }
            else
            {
                actualizado = orm.update <h_sconvm>(obj);
            }

            return(actualizado);
        }
Beispiel #6
0
        private bool guardaSantec()
        {
            h_santec obj = new h_santec();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);
            obj.tomo_inscr = globales.convertInt(txtTomo_Inscr.Text);
            obj.f_inscr_rp = globales.convertDatetime(txtF_Inscr_Rp.Text);
            obj.libr_inscr = globales.convertInt(txtLibr_Incr.Text);
            obj.dist_judic = txtDist_Jud.Text;

            dbaseORM orm   = new dbaseORM();
            string   query = $"select expediente from datos.h_santec where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);
            bool actualiza;

            if (resultado.Count == 0)
            {
                actualiza = orm.insert <h_santec>(obj);
            }
            else
            {
                actualiza = orm.update <h_santec>(obj);
            }

            return(actualiza);
        }
Beispiel #7
0
        private void frmMovimientos_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                button2_Click(null, null);
            }

            if (e.KeyCode == Keys.Insert)
            {
                if (datos.Rows.Count == 0)
                {
                    DialogResult dialogo = globales.MessageBoxQuestion("¿Deseas insertar un nuevo movimiento?", "Aviso", globales.menuPrincipal);
                    if (dialogo == DialogResult.Yes)
                    {
                        this.esInsertar = true;

                        object[] obj = new object[] { "", "", "", "" };
                        datos.Rows.Insert(0, obj);
                        datos.Rows[0].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);

                        movimientos m   = new movimientos();
                        dbaseORM    orm = new dbaseORM();
                        m = orm.insert <movimientos>(m, true);

                        datos.Rows[0].Cells[3].Value = m.id;
                        datos.CurrentCell            = datos.Rows[0].Cells[0];

                        this.esInsertar = false;
                    }
                }
            }
        }
        private bool guardarNotifi()
        {
            h_snotif obj = new h_snotif();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);

            obj.f_notif = globales.convertDatetime(txtF_Notif.Text);
            obj.n_notif = txtN_Notif.Text;
            obj.c_notif = txtC_Notif.Text;
            obj.numemis = txtNumemis.Text;
            obj.t_notif = txtT_Notif.Text;

            dbaseORM orm   = new dbaseORM();
            string   query = $"select expediente from datos.h_snotif where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);

            bool actualizando;

            if (resultado.Count == 0)
            {
                actualizando = orm.insert <h_snotif>(obj);
            }
            else
            {
                actualizando = orm.update <h_snotif>(obj);
            }

            return(actualizando);
        }
Beispiel #9
0
        private void frmSocioEconomico_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                cerrar();
            }
            if (this.principalActiva)
            {
                if (this.ventanaPrincipal.dtggrid.Rows.Count == 0)
                {
                    h_sdepec sdepec    = new h_sdepec();
                    int      rowactual = this.ventanaPrincipal.dtggrid.Rows.Count;
                    if (e.KeyCode == Keys.Insert && !globales.boolConsulta)
                    {
                        if (this.ventanaPrincipal.dtggrid.Rows.Count != 0)
                        {
                            return;
                        }

                        if (!this.conExpediente)
                        {
                            globales.MessageBoxExclamation("No se puede insertar registros a la solicitud sin expediente", "Aviso", globales.menuPrincipal);
                            return;
                        }

                        DialogResult p = globales.MessageBoxQuestion("¿Deseas registrar una nuevo registro?", "Aviso", globales.menuPrincipal);
                        if (p == DialogResult.No)
                        {
                            return;
                        }
                        this.esInsertar = true;

                        this.ventanaPrincipal.dtggrid.Rows.Insert(0);
                        this.ventanaPrincipal.dtggrid.Rows[0].Cells[0].Value             = "";
                        this.ventanaPrincipal.dtggrid.Rows[0].Cells[1].Value             = "";
                        this.ventanaPrincipal.dtggrid.Rows[0].Cells[2].Value             = "";
                        this.ventanaPrincipal.dtggrid.Rows[0].Cells[3].Value             = "";
                        this.ventanaPrincipal.dtggrid.Rows[0].Cells[4].Value             = "";
                        this.ventanaPrincipal.dtggrid.Rows[0].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);

                        h_sdepec depec = new h_sdepec();
                        depec.expediente = Convert.ToInt32(txtExpediente.Text);
                        depec.sec        = this.secuencia;

                        dbaseORM orm = new dbaseORM();
                        depec = orm.insert <h_sdepec>(depec, true);

                        this.ventanaPrincipal.dtggrid.Rows[0].Cells[5].Value = depec.id;
                        this.ventanaPrincipal.dtggrid.CurrentCell            = this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[0];
                    }
                }
                this.esInsertar = false;
            }
            else
            {
            }
        }
Beispiel #10
0
        private void insertaSecundario(h_sestse obj)
        {
            dbaseORM orm       = new dbaseORM();
            bool     insertado = orm.insert <h_sestse>(obj);

            if (insertado)
            {
                globales.MessageBoxSuccess("Registro actualizado correctamente", "Aviso", globales.menuPrincipal);
            }
        }
Beispiel #11
0
        private bool guardaSemisi()
        {
            h_semisi obj = new h_semisi();

            obj.expediente = globales.convertInt(txtExpediente.Text);
            obj.sec        = Convert.ToString(this.secuencia);
            obj.n_emision  = txtN_Emision.Text;
            obj.f_recibo   = globales.convertDatetime(txtF_Recibo.Text);
            obj.importe    = globales.convertDouble(txtImporte.Text);

            dbaseORM orm   = new dbaseORM();
            string   query = $"select * from datos.h_semisi where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
            List <Dictionary <string, object> > resultado = orm.query(query);


            bool actualiza;

            if (this.nuevaemision)
            {
                actualiza = orm.insert <h_semisi>(obj);
            }
            else
            {
                if (resultado.Count == 0)
                {
                    actualiza = orm.insert <h_semisi>(obj);
                }
                else
                {
                    actualiza = orm.update <h_semisi>(obj);
                }
            }

            this.nuevaemision    = false;
            this.button1.Visible = true;

            return(actualiza);
        }
Beispiel #12
0
        private void btnP_hipote_Click(object sender, EventArgs e)
        {
            DialogResult dialogo = globales.MessageBoxQuestion("¿Deseas guardar los cambios?", "Aviso", globales.menuPrincipal);

            if (dialogo == DialogResult.No)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(txtExpediente.Text))
            {
                globales.MessageBoxExclamation("Favor de elegir un expediente", "Aviso", globales.menuPrincipal);
                return;
            }

            dbaseORM orm    = new dbaseORM();
            p_hipote hipote = llenarHipote();

            bool actualizado = orm.update <p_hipote>(hipote);

            if (actualizado)
            {
                string query = $"select expediente from datos.h_sretec where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'";
                List <Dictionary <string, object> > resultado = orm.query(query);
                h_sretec sretec = new h_sretec();
                sretec.expediente = globales.convertInt(txtExpediente.Text);
                sretec.sec        = Convert.ToString(this.secuencia);
                sretec            = llenarSretec(sretec);

                if (resultado.Count == 0)
                {
                    actualizado = orm.insert <h_sretec>(sretec);
                }
                else
                {
                    actualizado = orm.update <h_sretec>(sretec);
                }

                if (actualizado)
                {
                    globales.MessageBoxSuccess("Registro actualizado correctamente", "Aviso", globales.menuPrincipal);
                }
            }
        }
Beispiel #13
0
        private void insertar()
        {
            p_marcha obj = rellenarPagoMarcha();
            dbaseORM orm = new dbaseORM();

            List <Dictionary <string, object> > resultado = orm.query("select COALESCE(max(folio)+1,1) as maximo from datos.p_marcha");
            string maximo = string.Empty;

            if (resultado.Count != 0)
            {
                maximo = Convert.ToString(resultado[0]["maximo"]);
            }

            obj.folio = globales.convertInt(maximo);

            bool insertado = orm.insert <p_marcha>(obj);

            if (insertado)
            {
                globales.MessageBoxSuccess("Registro guardado correctamente", "Aviso", globales.menuPrincipal);
            }
        }
Beispiel #14
0
        private void nuevo(p_hipote obj)
        {
            dbaseORM orm       = new dbaseORM();
            bool     insertado = orm.insert <p_hipote>(obj);

            if (insertado)
            {
                globales.MessageBoxSuccess("NUEVO FOLIO AGREGADO:" + txtExpediente.Text, "PROCESO CORRECTO", globales.menuPrincipal);
                controles(false);
                limpiacampos();
                btnGuardar.Enabled = false;
                btnGuardar.Visible = false;

                btnModifica.Enabled = true;
                btnModifica.Visible = true;

                btnNuevo.Visible = true;
                btnNuevo.Enabled = true;
            }
            else
            {
                globales.MessageBoxError("ERROR , CONTACTE A SISTEMAS", "Aviso", globales.menuPrincipal);
            }
        }
Beispiel #15
0
        private void datos_KeyDown(object sender, KeyEventArgs e)
        {
            if (datos.Rows.Count == 0)
            {
                return;
            }

            try
            {
                int rowactual = datos.Rows.Count;
                if (e.KeyCode == Keys.Insert)
                {
                    if (datos.Rows.Count != 0)
                    {
                        DialogResult dialogo = globales.MessageBoxQuestion("¿Deseas insertar un nuevo movimiento?", "Aviso", globales.menuPrincipal);
                        if (dialogo == DialogResult.Yes)
                        {
                            this.esInsertar = true;
                            int      rowActual = this.row + 1;
                            object[] obj       = new object[] { "", "", "", "" };
                            datos.Rows.Insert(rowActual, obj);
                            datos.Rows[rowActual].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);

                            movimientos m   = new movimientos();
                            dbaseORM    orm = new dbaseORM();
                            m = orm.insert <movimientos>(m, true);

                            datos.Rows[rowActual].Cells[3].Value = m.id;
                            datos.CurrentCell = datos.Rows[rowActual].Cells[0];

                            this.esInsertar = false;
                        }
                    }
                }

                if (e.KeyCode == Keys.Delete && !globales.boolConsulta)
                {
                    DialogResult p = globales.MessageBoxQuestion("¿Desea eliminar el movimiento?", "Aviso", globales.menuPrincipal);
                    if (p == DialogResult.No)
                    {
                        return;
                    }

                    int    id             = Convert.ToInt32(datos.Rows[this.row].Cells[3].Value);
                    string tipoMovimiento = Convert.ToString(datos.Rows[this.row].Cells[0].Value);

                    movimientos m = new movimientos();
                    m.id       = id;
                    m.tipo_mov = tipoMovimiento;

                    dbaseORM orm       = new dbaseORM();
                    bool     eliminado = orm.delete <movimientos>(m);
                    datos.Rows.RemoveAt(this.row);
                    if (eliminado)
                    {
                        globales.MessageBoxSuccess("Movimiento eliminado correctamente", "Aviso", globales.menuPrincipal);
                    }
                }
            }
            catch
            {
            }

            this.esInsertar = false;
        }
Beispiel #16
0
        private void metodoConsejo()
        {
            string fecha = globales.parseDateTime(globales.convertDatetime(txtxFecha1.Text));

            txtxFecha1.Text = fecha;
            if (string.IsNullOrWhiteSpace(fecha))
            {
                globales.MessageBoxExclamation("Ingresar fecha correcta", "Aviso", globales.menuPrincipal);
                return;
            }

            dbaseORM orm   = new dbaseORM();
            string   query = $"select * from datos.h_solici where f_autorizacion = '{fecha}'";

            List <h_solici> lista = orm.queryForList <h_solici>(query);

            if (lista.Count != 0)
            {
                foreach (h_solici item in lista)
                {
                    string   sec     = item.sec;
                    int      folio   = item.expediente;
                    h_sconsj consejo = new h_sconsj();

                    query   = $"select * from datos.h_sconsj where expediente = {folio} and sec = '{sec}'";
                    consejo = orm.queryForMap <h_sconsj>(query);

                    consejo.proyecto = (item.finalidad == "04" || item.finalidad == "05" || item.finalidad == "06" || item.finalidad == "07") ? "XXXXXXXXXX" : consejo.proyecto;

                    if (sec == "0")
                    {
                        consejo.proyecto  = "CONGRUENTE";
                        consejo.necesida  = "COMPROBADA";
                        consejo.solvencia = "COMPROBADA";
                    }
                    else
                    {
                        consejo.cred_ant  = "COMPROBADO";
                        consejo.avance_o  = "COMPROBADO";
                        consejo.necesida  = "COMPROBADA";
                        consejo.solvencia = "COMPROBADA";
                    }

                    bool actualizacion = false;

                    if (consejo.expediente == 0)
                    {
                        consejo.expediente = folio;
                        consejo.sec        = sec;

                        actualizacion = orm.insert <h_sconsj>(consejo);
                    }
                    else
                    {
                        actualizacion = orm.update <h_sconsj>(consejo);
                    }
                }


                globales.MessageBoxSuccess("Se agregaron datos complementarios P/CONSEJO", "Aviso", globales.menuPrincipal);
            }
            else
            {
                globales.MessageBoxExclamation($"No se encuentran registros con fecha de autorización {txtxFecha1.Text}", "Aviso", globales.menuPrincipal);
            }
        }
Beispiel #17
0
        private void frmexpediente_KeyDown(object sender, KeyEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtExpediente.Text))
            {
                return;
            }
            if (e.KeyCode == Keys.F2)
            {
                Close();
            }

            if (e.KeyCode == Keys.F12)
            {
                limpiacampos();
            }

            if (e.KeyCode == Keys.F9)
            {
            }

            if (e.KeyCode == Keys.F5)
            {
                btnFolio_Click(null, null);
            }

            int rowactual = dtggrid.Rows.Count;

            if (e.KeyCode == Keys.Insert && !globales.boolConsulta)
            {
                if (dtggrid.Rows.Count != 0)
                {
                    return;
                }
                DialogResult p = globales.MessageBoxQuestion("¿Deseas registrar una nuevo registro?", "Aviso", globales.menuPrincipal);
                if (p == DialogResult.No)
                {
                    return;
                }
                this.esInsertar = true;

                string fecha = string.Format("{0:d}", DateTime.Now);



                dtggrid.Rows.Insert(0);
                dtggrid.Rows[0].Cells[0].Value             = "";
                dtggrid.Rows[0].Cells[1].Value             = fecha;
                dtggrid.Rows[0].Cells[2].Value             = "";
                dtggrid.Rows[0].Cells[3].Value             = "";
                dtggrid.Rows[0].Cells[4].Value             = "";
                dtggrid.Rows[0].Cells[5].Value             = "";
                dtggrid.Rows[0].Cells[6].Value             = "";
                dtggrid.Rows[0].Cells[7].Value             = "";
                dtggrid.Rows[0].Cells[8].Value             = "";
                dtggrid.Rows[0].Cells[9].Value             = "";
                dtggrid.Rows[0].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);

                fecha = string.Format("'{0:yyyy-MM-dd}'", DateTime.Now);

                h_solici solicitud = new h_solici();
                solicitud.f_solicitud    = DateTime.Now;
                solicitud.f_autorizacion = DateTime.Now;
                solicitud.expediente     = Convert.ToInt32(txtExpediente.Text);

                dbaseORM orm = new dbaseORM();
                solicitud = orm.insert <h_solici>(solicitud, true);

                dtggrid.Rows[rowactual].Cells[10].Value = solicitud.id;
                dtggrid.CurrentCell = dtggrid.Rows[rowactual].Cells[0];
            }
        }
Beispiel #18
0
        private void dtggrid_KeyDown(object sender, KeyEventArgs e)
        {
            if (dtggrid.Rows.Count == 0)
            {
                return;
            }

            try
            {
                int rowactual = dtggrid.Rows.Count;
                if (e.KeyCode == Keys.Insert && !globales.boolConsulta)
                {
                    DialogResult p = globales.MessageBoxQuestion("¿Deseas registrar una nuevo registro?", "Aviso", globales.menuPrincipal);
                    if (p == DialogResult.No)
                    {
                        return;
                    }
                    this.esInsertar = true;

                    string fecha = string.Format("{0:d}", DateTime.Now);



                    dtggrid.Rows.Insert(rowactual);
                    dtggrid.Rows[rowactual].Cells[0].Value             = "";
                    dtggrid.Rows[rowactual].Cells[1].Value             = fecha;
                    dtggrid.Rows[rowactual].Cells[2].Value             = "";
                    dtggrid.Rows[rowactual].Cells[3].Value             = "";
                    dtggrid.Rows[rowactual].Cells[4].Value             = "";
                    dtggrid.Rows[rowactual].Cells[5].Value             = "";
                    dtggrid.Rows[rowactual].Cells[6].Value             = "";
                    dtggrid.Rows[rowactual].Cells[7].Value             = "";
                    dtggrid.Rows[rowactual].Cells[8].Value             = "";
                    dtggrid.Rows[rowactual].Cells[9].Value             = "";
                    dtggrid.Rows[rowactual].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);

                    fecha = string.Format("'{0:yyyy-MM-dd}'", DateTime.Now);

                    h_solici solicitud = new h_solici();
                    solicitud.f_solicitud    = DateTime.Now;
                    solicitud.f_autorizacion = DateTime.Now;
                    solicitud.expediente     = Convert.ToInt32(txtExpediente.Text);


                    dbaseORM orm = new dbaseORM();
                    solicitud = orm.insert <h_solici>(solicitud, true);

                    dtggrid.Rows[rowactual].Cells[10].Value = solicitud.id;
                    dtggrid.CurrentCell = dtggrid.Rows[rowactual].Cells[0];
                }

                if (e.KeyCode == Keys.Delete && !globales.boolConsulta)
                {
                    DialogResult p = globales.MessageBoxQuestion("¿Desea eliminar el registro?", "Aviso", globales.menuPrincipal);
                    if (p == DialogResult.No)
                    {
                        return;
                    }



                    string id = dtggrid.Rows[row].Cells[10].Value.ToString();
                    dtggrid.Rows.RemoveAt(row);
                    string query = "delete from datos.h_solici where expediente = {0} and id = {1} ";
                    query = string.Format(query, txtExpediente.Text, id);
                    if (globales.consulta(query, true))
                    {
                        globales.MessageBoxSuccess("Registro eliminado correctamente", "Aviso", globales.menuPrincipal);
                    }
                }



                if (e.Control && e.KeyCode == Keys.D)
                {
                    if (this.row > 1)
                    {
                        dtggrid.Rows[row].Cells[this.column].Value = dtggrid.Rows[row - 1].Cells[this.column].Value;
                    }
                }

                if (e.KeyCode == Keys.F6)
                {
                    string id          = dtggrid.Rows[row].Cells[10].Value.ToString();
                    string query       = $"select sec,tot_prest,tot_prim,plazo,plazoa,tot_unit from datos.h_solici where expediente = {txtExpediente.Text} and id = {id}";
                    var    resultado   = globales.consulta(query);
                    var    diccionario = resultado[0];

                    double tot_prest = string.IsNullOrWhiteSpace(Convert.ToString(diccionario["tot_prest"])) ? 0 : Convert.ToDouble(diccionario["tot_prest"]);
                    double tot_prim  = string.IsNullOrWhiteSpace(Convert.ToString(diccionario["tot_prim"])) ? 0 : Convert.ToDouble(diccionario["tot_prim"]);
                    string plazo     = Convert.ToString(diccionario["plazo"]);
                    int    plazoa    = string.IsNullOrWhiteSpace(Convert.ToString(diccionario["plazoa"])) ? 0 : Convert.ToInt32(diccionario["plazoa"]);
                    double tot_unit  = string.IsNullOrWhiteSpace(Convert.ToString(diccionario["tot_unit"])) ? 0 : Convert.ToDouble(diccionario["tot_unit"]);

                    int tiempo = (plazo == "Q") ? ((plazoa * 24) - 1): ((plazoa * 24) - 1);

                    string cabecera  = $"{diccionario["sec"]}° Ampliación";
                    string contenido = $"TOTAL DEL PRESTAMO : {string.Format("{0:C}",tot_prest)}\nPrimer pago: {string.Format("{0:c}",tot_prim)}\n{tiempo} PAG.POR NOMINA.: {string.Format("{0:c}",tot_unit)}";
                    globales.MessageBoxInformation(contenido, cabecera, globales.menuPrincipal);
                }

                if (e.KeyCode == Keys.F1)
                {
                    if (this.column == 2)
                    {
                        frmCatalogoGeneral finalida = new frmCatalogoGeneral();
                        finalida.tabla  = "finalidad";
                        finalida.metodo = llenarFinalidad;
                        finalida.ShowDialog();
                        SendKeys.Send("{TAB}");
                    }
                }
            }
            catch
            {
            }

            this.esInsertar = false;

            if (e.KeyCode == Keys.Enter)
            {
                e.SuppressKeyPress = true;
                try
                {
                    e.SuppressKeyPress = true;
                    int iColumn = dtggrid.CurrentCell.ColumnIndex;
                    int iRow    = dtggrid.CurrentCell.RowIndex;
                    if (iColumn == dtggrid.ColumnCount - 1)
                    {
                        if (dtggrid.RowCount > (iRow + 1))
                        {
                            dtggrid.CurrentCell = dtggrid[1, iRow + 1];
                        }
                        else
                        {
                            //focus next control
                        }
                    }
                    else
                    {
                        dtggrid.CurrentCell = dtggrid[iColumn + 1, iRow];
                    }
                }
                catch
                {
                }
            }
        }
Beispiel #19
0
        private void gridKey(object sender, KeyEventArgs e)
        {
            if (this.ventanaPrincipal.dtggrid.Rows.Count != 0)
            {
                h_sdepec sdepec    = new h_sdepec();
                int      rowactual = this.ventanaPrincipal.dtggrid.Rows.Count;
                if (e.KeyCode == Keys.Insert && !globales.boolConsulta)
                {
                    if (!this.conExpediente)
                    {
                        globales.MessageBoxExclamation("No se puede insertar registros a la solicitud sin expediente", "Aviso", globales.menuPrincipal);
                        return;
                    }

                    DialogResult p = globales.MessageBoxQuestion("¿Deseas registrar una nuevo registro?", "Aviso", globales.menuPrincipal);
                    if (p == DialogResult.No)
                    {
                        return;
                    }
                    this.esInsertar = true;

                    this.ventanaPrincipal.dtggrid.Rows.Insert(rowactual);
                    this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[0].Value             = "";
                    this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[1].Value             = "";
                    this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[2].Value             = "";
                    this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[3].Value             = "";
                    this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[4].Value             = "";
                    this.ventanaPrincipal.dtggrid.Rows[rowactual].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);

                    h_sdepec depec = new h_sdepec();
                    depec.expediente = Convert.ToInt32(txtExpediente.Text);
                    depec.sec        = this.secuencia;

                    dbaseORM orm = new dbaseORM();
                    depec = orm.insert <h_sdepec>(depec, true);

                    this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[5].Value = depec.id;
                    this.ventanaPrincipal.dtggrid.CurrentCell = this.ventanaPrincipal.dtggrid.Rows[rowactual].Cells[0];
                }
            }

            this.esInsertar = false;

            if (e.KeyCode == Keys.Enter)
            {
                e.SuppressKeyPress = true;
                try
                {
                    e.SuppressKeyPress = true;
                    int iColumn = this.ventanaPrincipal.dtggrid.CurrentCell.ColumnIndex;
                    int iRow    = this.ventanaPrincipal.dtggrid.CurrentCell.RowIndex;
                    if (iColumn == this.ventanaPrincipal.dtggrid.ColumnCount - 1)
                    {
                        if (this.ventanaPrincipal.dtggrid.RowCount > (iRow + 1))
                        {
                            this.ventanaPrincipal.dtggrid.CurrentCell = this.ventanaPrincipal.dtggrid[1, iRow + 1];
                        }
                        else
                        {
                            //focus next control
                        }
                    }
                    else
                    {
                        this.ventanaPrincipal.dtggrid.CurrentCell = this.ventanaPrincipal.dtggrid[iColumn + 1, iRow];
                    }
                }
                catch
                {
                }
            }
        }
        private void btnP_hipote_Click(object sender, EventArgs e)
        {
            if (exito.Visible)
            {
                globales.MessageBoxExclamation("LA SUPERVIVENCIA YA SE REGISTRO EN EL PERIODO", "AVISO", globales.menuPrincipal);
                return;
            }

            if (string.IsNullOrWhiteSpace(txtNumerobuscar.Text))
            {
                globales.MessageBoxExclamation("Favor de ingresar Jubilado, Pensionado o Pensionista para la firma de supervivencia", "Aviso", globales.menuPrincipal);
                return;
            }

            DialogResult dialogo = globales.MessageBoxQuestion("¿Deseas realizar la firma de supervivencia?", "Aviso", globales.menuPrincipal);

            if (dialogo == DialogResult.No)
            {
                return;
            }

            this.registro = true;

            supervive obj = new supervive();

            obj.jpp           = this.jpp;
            obj.numjpp        = globales.convertInt(txtNum.Text);
            obj.anio          = globales.convertInt(txtSupervive_anio.Text);
            obj.periodo       = txtsupervive_periodo.SelectedIndex + 1;
            obj.tipo          = txtSupervive_supervivencia.SelectedIndex + 1;
            obj.observaciones = txtSupervive_observacion.Text;
            obj.firma         = radio_firma.Checked ? 1 : 2;
            obj.q_captura     = globales.usuario;
            obj.f_captura     = DateTime.Now;
            obj.tomafirma     = globales.usuario;
            obj.fecha         = globales.convertDatetime(txtSuperivive_fecha.Text);

            string queyr = $"select * from nominas_catalogos.maestro where rfc = '{txtRfc.Text}'";

            dbaseORM orm = new dbaseORM();

            List <maestro> lista = orm.queryForList <maestro>(queyr);

            if (lista.Count > 1)
            {
                strMasDos = "";

                List <supervive> supers = new List <supervive>();
                foreach (maestro ma in lista)
                {
                    supervive obj1 = new supervive();
                    obj1.jpp           = ma.jpp;
                    obj1.numjpp        = ma.num;
                    obj1.anio          = globales.convertInt(txtSupervive_anio.Text);
                    obj1.periodo       = txtsupervive_periodo.SelectedIndex + 1;
                    obj1.tipo          = txtSupervive_supervivencia.SelectedIndex + 1;
                    obj1.observaciones = txtSupervive_observacion.Text;
                    obj1.firma         = radio_firma.Checked ? 1 : 2;
                    obj1.q_captura     = globales.usuario;
                    obj1.f_captura     = DateTime.Now;
                    obj1.tomafirma     = globales.usuario;
                    obj1.fecha         = globales.convertDatetime(txtSuperivive_fecha.Text);

                    supers.Add(obj1);

                    if (!(obj1.jpp == this.jpp && obj1.numjpp == globales.convertInt(txtNum.Text)))
                    {
                        strMasDos += $", {obj1.jpp}{obj1.numjpp} ";
                    }
                }

                orm.insertAll <supervive>(supers);

                globales.MessageBoxSuccess("Supervivencia registrada", "Aviso", globales.menuPrincipal);
                no.Visible    = false;
                exito.Visible = true;
                string periodo = string.Empty;
                switch (obj.periodo)
                {
                case 1:
                    periodo = "01 AL 21 DE ENERO";
                    break;

                case 2:
                    periodo = "01 AL 21 DE MAYO";
                    break;

                case 3:
                    periodo = "01 AL 21 DE SEPTIEMBRE";
                    break;

                default:
                    break;
                }
                dtggrid.Rows.Add(txtSupervive_anio.Text, periodo, globales.parseDateTime(obj.fecha));
            }
            else
            {
                if (orm.insert <supervive>(obj))
                {
                    globales.MessageBoxSuccess("Supervivencia registrada", "Aviso", globales.menuPrincipal);
                    no.Visible    = false;
                    exito.Visible = true;
                    string periodo = string.Empty;
                    switch (obj.periodo)
                    {
                    case 1:
                        periodo = "01 AL 21 DE ENERO";
                        break;

                    case 2:
                        periodo = "01 AL 21 DE MAYO";
                        break;

                    case 3:
                        periodo = "01 AL 21 DE SEPTIEMBRE";
                        break;

                    default:
                        break;
                    }
                    dtggrid.Rows.Add(txtSupervive_anio.Text, periodo, globales.parseDateTime(obj.fecha));
                }
            }

            if (string.IsNullOrWhiteSpace(textBox1.Text))
            {
                printDocument2.PrinterSettings.PrinterName = "EPSON TM-T20II Receipt5";
                printDocument3.PrinterSettings.PrinterName = "EPSON TM-T20II Receipt5";
                this.bandera = true;
            }
            else
            {
                printDocument2.PrinterSettings.PrinterName = $@"\\{piobtenida}\EPSON TM-T20II Receipt5";
                printDocument3.PrinterSettings.PrinterName = $@"\\{piobtenida}\EPSON TM-T20II Receipt5";
                this.bandera = true;
            }

            try
            {
                printDocument2.Print();
                printDocument3.Print();


                if (DialogResult.Yes == globales.MessageBoxQuestion("¿Deseas imprimir el sobre de págo?", "Sobre de pago", globales.menuPrincipal))
                {
                    this.button1_Click_2(null, null);
                }
            }
            catch
            {
                return;
            }
        }
        private void dtggrid_KeyDown(object sender, KeyEventArgs e)
        {
            if (dtggrid.Rows.Count == 0)
            {
                return;
            }

            if (!this.abierto)
            {
                dtggrid.AllowUserToDeleteRows = false;
                return;
            }
            ;



            if (this.esConsulta)
            {
                return;
            }

            try
            {
                if (e.KeyCode == Keys.Insert)
                {
                    DialogResult p = globales.MessageBoxQuestion("¿Deseas registrar una nueva poliza?", "Aviso", globales.menuPrincipal);
                    if (p == DialogResult.No)
                    {
                        return;
                    }
                    this.esInsertar = true;
                    string cuenta      = "";
                    string descripcion = "";
                    string debe        = "0.00";
                    string haber       = "0.00";
                    string grupo       = "";
                    string docto       = "";

                    int rowfinal = row + 1;



                    dtggrid.Rows.Insert(rowfinal);
                    dtggrid.Rows[rowfinal].Cells[0].Value             = cuenta;
                    dtggrid.Rows[rowfinal].Cells[1].Value             = descripcion;
                    dtggrid.Rows[rowfinal].Cells[2].Value             = debe;
                    dtggrid.Rows[rowfinal].Cells[3].Value             = haber;
                    dtggrid.Rows[rowfinal].Cells[4].Value             = grupo;
                    dtggrid.Rows[rowfinal].Cells[5].Value             = docto;
                    dtggrid.Rows[rowfinal].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);


                    codigo.repositorios.cg_fondos.pol pol = new codigo.repositorios.cg_fondos.pol {
                        entidad    = "801",
                        subsistema = "P",
                        polmes     = this.polmes,
                        poltipo    = this.poltipo,
                        polnumero  = this.polnumero,
                        fecha      = DateTime.Parse(txtFecha.Text),
                        cuenta     = "",
                        naturaleza = "",
                        grupo      = "000",
                        anio       = this.polanio,
                        prefijo    = this.prefijo
                    };

                    dbaseORM orm = new dbaseORM();
                    pol = orm.insert <codigo.repositorios.cg_fondos.pol>(pol, true);

                    //query = string.Format(query, txtrfc.Text, string.Format("{0:yyyy-MM-dd}", DateTime.Parse(inicio)), string.Format("{0:yyyy-MM-dd}", DateTime.Parse(final)), cuenta, string.Format("{0:yyyy-MM-dd}", DateTime.Parse(fecha)), globales.id_usuario);


                    dtggrid.Rows[row + 1].Cells[6].Value = pol.id;
                    dtggrid.CurrentCell = dtggrid.Rows[row + 1].Cells[0];
                }

                if (e.KeyCode == Keys.Delete)
                {
                    DialogResult p = globales.MessageBoxQuestion("¿Desea eliminar la poliza?", "Aviso", globales.menuPrincipal);
                    if (p == DialogResult.No)
                    {
                        return;
                    }
                    string id = dtggrid.Rows[row].Cells[6].Value.ToString();
                    dtggrid.Rows.RemoveAt(row);
                    string query = "delete from cg_fondos.pol where id={0}";
                    query = string.Format(query, id);
                    if (globales.consulta(query, true))
                    {
                        globales.MessageBoxSuccess("Poliza eliminada correctamente", "Aviso", globales.menuPrincipal);
                    }
                }

                if (e.KeyCode == Keys.F1)
                {
                    frmCuentas cuenta = new frmCuentas(true);
                    cuenta.enviar = rellenar;
                    cuenta.ShowDialog();
                }
            }
            catch (Exception ee)
            {
            }

            this.esInsertar = false;
            if (e.KeyCode == Keys.Enter)
            {
                if (this.columna == 5)
                {
                    this.ejecutarMetodo();
                }
                try
                {
                    e.SuppressKeyPress = true;
                    int iColumn = dtggrid.CurrentCell.ColumnIndex;
                    int iRow    = dtggrid.CurrentCell.RowIndex;
                    if (iColumn == dtggrid.ColumnCount - 1)
                    {
                        if (dtggrid.RowCount > (iRow + 1))
                        {
                            dtggrid.CurrentCell = dtggrid[1, iRow + 1];
                        }
                        else
                        {
                            //focus next control
                        }
                    }
                    else
                    {
                        dtggrid.CurrentCell = dtggrid[iColumn + 1, iRow];
                    }
                }
                catch
                {
                }
            }
        }