private void textBox7_TextChanged(object sender, EventArgs e) { string cuentaPunto = txtMayor.Text; if (cuentaPunto.Length < 3) { return; } int c; int largo = cuentaPunto.Length; string cadena = string.Empty; string pos = string.Empty; for (c = 0; c <= 2; c++) { if (c == 0 || c == 2) { pos = "."; } if (c == 1) { pos = pos + cuentaPunto.Substring(0, 3); } } dtggrid.Rows.Clear(); List <cuentas> obj = new dbaseORM().queryForList <SISPE_MIGRACION.codigo.repositorios.financieros.cuentas>($"SELECT * FROM cg_fondos.cuentas WHERE (cuenta LIKE '{txtfolio.Text}%' OR descripcion LIKE '%{txtfolio.Text}%') AND CHAR_LENGTH (cuenta) >= 10 AND cuenta SIMILAR to '%{pos}%' ORDER BY cuenta LIMIT 30"); obj.ForEach(o => dtggrid.Rows.Add(o.cuenta, o.descripcion, o.naturaleza, o.nivel, o.tipo, o.id)); }
private void modalEmpleados_Load(object sender, EventArgs e) { string query = $"select rfc,nombre_em from datos.empleados where pendiente = 'f' order by rfc asc limit 100"; List <Dictionary <string, object> > obj = new dbaseORM().query(query); obj.ForEach(o => { dtggrid.Rows.Add(o["rfc"], o["nombre_em"]); }); }
private void modalQuirografario_Load(object sender, EventArgs e) { MemberInfo informacion = typeof(clase); Type tipoAssemby = typeof(clase); this.tabla = informacion.Name; label45.Text = this.tabla == "p_edocta" ? "Quirografarios" : "Hipotecarios"; string[] nombreEsquemaArray = tipoAssemby.Namespace.Split('.'); this.esquema = nombreEsquemaArray[nombreEsquemaArray.Length - 1]; string query = string.Empty; if (!string.IsNullOrWhiteSpace(this.t_prestamo)) { query = $"select * from {esquema}.{tabla} where {t_prestamo.Replace("and","")} order by folio desc limit 100"; } else { if (this.bandera == "true") { query = $"select * from {esquema}.{tabla} where historial_pagado is null order by folio desc limit 100"; } else { query = $"select * from {esquema}.{tabla} order by folio desc limit 100"; } } List <Dictionary <string, object> > obj = new dbaseORM().query(query); obj.ForEach(o => { dtggrid.Rows.Add(o["folio"], o["rfc"], o["nombre_em"]); }); if (!string.IsNullOrWhiteSpace(this.t_prestamo)) { query = $"select length(COALESCE(max(folio),0)::text) as cantidad from {this.esquema}.{this.tabla} where {t_prestamo.Replace("and","")}"; } else { query = $"select length(COALESCE(max(folio),0)::text) as cantidad from {this.esquema}.{this.tabla}"; } // query = $"select length(COALESCE(max(folio),0)::text) as cantidad from {this.esquema}.{this.tabla} where historial_pagado is null"; obj = new dbaseORM().query(query); this.totalFolio = globales.convertInt(Convert.ToString(obj[0]["cantidad"])); txtBuscar.Text = this.buscar; }
private void txtBuscar_TextChanged(object sender, EventArgs e) { string query = string.Empty; try { if (!string.IsNullOrWhiteSpace(txtBuscar.Text)) { if (txtBuscar.Text.Contains("..") || txtBuscar.Text.Contains(".")) { string texto = txtBuscar.Text.Replace("..", "."); string[] split = texto.Split('.'); string nombre_em = string.Empty; foreach (string i in split) { if (string.IsNullOrWhiteSpace(i)) { continue; } nombre_em += $" nombre_em like '%{i}%' ,"; } nombre_em = nombre_em.Substring(0, nombre_em.Length - 1).Replace(",", " and "); query = $"select * from datos.empleados where pendiente = 'f' and (rfc like '{txtBuscar.Text}%' or {nombre_em}) order by rfc,nombre_em desc limit 100"; } else { query = $"select * from datos.empleados where pendiente = 'f' and (rfc like '{txtBuscar.Text}%' or nombre_em like '%{txtBuscar.Text}%') order by rfc,nombre_em desc limit 100"; } } else { query = $"select rfc,nombre_em from datos.empleados where pendiente = 'f' order by rfc,nombre_em asc limit 100"; } } catch { } dtggrid.Rows.Clear(); List <Dictionary <string, object> > obj = new dbaseORM().query(query); obj.ForEach(o => { dtggrid.Rows.Add(o["rfc"], o["nombre_em"]); }); }
private void recibiendoampliacion(string expediente, int opcion, Dictionary <string, object> datos) { limpiacampos(); this.expediente = expediente; txtExpediente.Text = expediente; string query = $"select expediente,sec from datos.h_solici where expediente = {expediente} and sec = '{opcion}'"; List <Dictionary <string, object> > resultado = globales.consulta(query); string tramite = string.Empty; tramite = (opcion == 0) ? "Solicitud inicial" : opcion + "° Ampliación"; this.secuencia = opcion.ToString(); this.txtamplia.Text = tramite; query = "select * from datos.p_hipote where folio = " + expediente; p_hipote hipo = new dbaseORM().queryForMap <p_hipote>(query); this.ventanaPrincipal.txtRfc.Text = hipo.rfc; this.ventanaPrincipal.txtNombre_em.Text = hipo.nombre_em; this.ventanaPrincipal.txtDireccion.Text = hipo.direccion; this.ventanaPrincipal.txtSecretaria.Text = hipo.secretaria; this.ventanaPrincipal.txtDirec_inmueb.Text = hipo.direc_inmu; this.ventanaPrincipal.txtDescripcion.Text = hipo.descripcion; this.ventanaPrincipal.txtTel_ofic.Text = hipo.tel_ofici; if (resultado.Count == 0) { this.conExpediente = false; globales.MessageBoxExclamation($"Expediente N° {expediente} \nNo se encontro {tramite}", "Aviso", globales.menuPrincipal); return; } this.conExpediente = true; query = $"select * from datos.h_sdepec where expediente = {hipo.folio} and sec = '{resultado[0]["sec"]}' order by id "; List <h_sdepec> sdepec = new dbaseORM().queryForList <h_sdepec>(query); sdepec.ForEach(o => { this.ventanaPrincipal.dtggrid.Rows.Add( o.nom_depec, o.edad, o.parentesco, o.escolaridad, o.ocupacion, o.id ); }); query = $"select * from datos.h_sestse where expediente = {hipo.folio} and sec = '{resultado[0]["sec"]}'"; h_sestse sestse = new dbaseORM().queryForMap <h_sestse>(query); rellenarSecundario(sestse); }
private void txtBuscar_TextChanged(object sender, EventArgs e) { string query = string.Empty; if (string.IsNullOrWhiteSpace(txtBuscar.Text)) { if (!string.IsNullOrWhiteSpace(t_prestamo)) { query = $"select * from {esquema}.{tabla} where {t_prestamo.Replace("and","")} order by folio desc limit 100"; } else { query = $"select * from {esquema}.{tabla} order by folio desc limit 100"; } } else if (char.IsNumber(txtBuscar.Text.First())) { if (this.bandera == "true") { query = $"select * from {this.esquema}.{this.tabla} where historial_pagado is null and "; } else { query = $"select * from {this.esquema}.{this.tabla} where "; /// } string aux = string.Empty; if (this.totalFolio == txtBuscar.Text.Length) { aux = " folio = " + txtBuscar.Text; } else { string strFolio = txtBuscar.Text; string desde = strFolio; string hasta = strFolio; string between = "folio = " + strFolio; for (int x = txtBuscar.Text.Length; x < this.totalFolio; x++) { desde += "0"; hasta += "9"; between += $" or folio between {desde} and {hasta} "; } aux = between + $" {t_prestamo} order by folio asc limit 100"; } query += aux; } else { if (txtBuscar.Text.Contains("..") || txtBuscar.Text.Contains(".")) { string texto = txtBuscar.Text.Replace("..", "."); string[] split = texto.Split('.'); string nombre_em = string.Empty; foreach (string i in split) { if (string.IsNullOrWhiteSpace(i)) { continue; } nombre_em += $" nombre_em like '%{i}%' ,"; } nombre_em = nombre_em.Substring(0, nombre_em.Length - 1).Replace(",", " and "); query = $"select * from {this.esquema}.{this.tabla} where rfc like '{txtBuscar.Text}%' or {nombre_em} {t_prestamo} order by folio desc limit 100"; } else { if (this.bandera == "true") { query = $"select * from {this.esquema}.{this.tabla} where rfc like '{txtBuscar.Text}%' or nombre_em like '%{txtBuscar.Text}%' {t_prestamo} and historial_pagado is null order by folio desc limit 100"; } else { query = $"select * from {this.esquema}.{this.tabla} where rfc like '{txtBuscar.Text}%' or nombre_em like '%{txtBuscar.Text}%' {t_prestamo} order by folio desc limit 100"; } } } dtggrid.Rows.Clear(); List <Dictionary <string, object> > obj = new dbaseORM().query(query); obj.ForEach(o => { dtggrid.Rows.Add(o["folio"], o["rfc"], o["nombre_em"]); }); }
private void frmCuentas_Load(object sender, EventArgs e) { List <cuentas> obj = new dbaseORM().queryForList <SISPE_MIGRACION.codigo.repositorios.financieros.cuentas>("select * from cg_fondos.cuentas order by cuenta"); obj.ForEach(o => dtggrid.Rows.Add(o.cuenta, o.descripcion, o.naturaleza, o.nivel, o.tipo, o.id)); }
private void txtfolio_TextChanged(object sender, EventArgs e) { if (this.bandera == false) { string cuenta = txtfolio.Text; string completa = string.Empty; if (cuenta.Length == 1) { completa = cuenta + "."; } if (cuenta.Length == 2) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "."; } if (cuenta.Length == 3) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "."; } if (cuenta.Length == 4) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "."; } if (cuenta.Length == 5) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "."; } if (cuenta.Length == 6) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 1); } if (cuenta.Length == 7) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 2); } if (cuenta.Length == 8) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 3); } if (cuenta.Length == 9) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 3) + "." + cuenta.Substring(8, 1); } if (cuenta.Length == 10) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 3) + "." + cuenta.Substring(8, 2); } if (cuenta.Length == 111) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 3) + "." + cuenta.Substring(8, 3); } if (cuenta.Length == 12) { completa = cuenta.Substring(0, 1) + "." + cuenta.Substring(1, 1) + "." + cuenta.Substring(2, 1) + "." + cuenta.Substring(3, 1) + "." + cuenta.Substring(4, 1) + "." + cuenta.Substring(5, 3) + "." + cuenta.Substring(8, 4); } dtggrid.Rows.Clear(); List <cuentas> obj = new dbaseORM().queryForList <SISPE_MIGRACION.codigo.repositorios.financieros.cuentas>($"select * from cg_fondos.cuentas where (cuenta like '{completa}%' or descripcion like '%{txtfolio.Text}%') AND CHAR_LENGTH (cuenta) >= 10 order by cuenta limit 30"); obj.ForEach(o => dtggrid.Rows.Add(o.cuenta, o.descripcion, o.naturaleza, o.nivel, o.tipo, o.id)); } else { dtggrid.Rows.Clear(); List <cuentas> obj = new dbaseORM().queryForList <SISPE_MIGRACION.codigo.repositorios.financieros.cuentas>($"select * from cg_fondos.cuentas where (cuenta like '{txtfolio.Text}%' or descripcion like '%{txtfolio.Text}%') AND CHAR_LENGTH (cuenta) >= 10 order by cuenta limit 30"); obj.ForEach(o => dtggrid.Rows.Add(o.cuenta, o.descripcion, o.naturaleza, o.nivel, o.tipo, o.id)); } }