public static List <Custodios> CargarComboBoxCustodios() { List <Custodios> lista = new List <Custodios>(); NpgsqlConnection conexion = ClsObtenerConexion.Conexion(); conexion.Open(); string cadenaSql = null; cadenaSql += "SELECT \"cusId\", \"cusCedula\"||' - '||\"cusNombre\" AS NombreDelArea "; cadenaSql += "FROM \"Custodios\" "; cadenaSql += "ORDER BY substr(\"cusNombre\", POSITION(' - ' IN \"cusNombre\"))"; NpgsqlCommand cmd = new NpgsqlCommand(cadenaSql, conexion); NpgsqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Custodios pCustodios = new Custodios { CusId = Convert.ToInt32(dr[0]), CusNombre = Convert.ToString(dr[1]) }; lista.Add(pCustodios); } dr.Close(); conexion.Close(); //cb.SelectedIndex = 0; return(lista); }
public static List <Prestamos> CargarComboBoxFiltroNombre() { List <Prestamos> lista = new List <Prestamos>(); NpgsqlConnection conexion = ClsObtenerConexion.Conexion(); conexion.Open(); string cadenaSql = null; cadenaSql += "SELECT \"empId\", \"empCedula\"||' - '||\"empNombre\" AS NombreDelEmpleado "; cadenaSql += "FROM \"Empleados\" "; cadenaSql += "ORDER BY substr(\"empNombre\", POSITION(' - ' IN \"empNombre\"))"; NpgsqlCommand cmd = new NpgsqlCommand(cadenaSql, conexion); NpgsqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Prestamos pPrestamos = new Prestamos { EmpId = Convert.ToInt32(dr[0]), EmpNombre = Convert.ToString(dr[1]) }; lista.Add(pPrestamos); } dr.Close(); conexion.Close(); //cb.SelectedIndex = 0; return(lista); }
public static List <PlanCuentas> CargarComboBoxPlanCuentas() { List <PlanCuentas> lista = new List <PlanCuentas>(); NpgsqlConnection conexion = ClsObtenerConexion.Conexion(); conexion.Open(); string cadenaSql = null; cadenaSql += "SELECT \"pctId\",\"pctCuenta\"||' - '||\"pctNombre\"||' - ['||\"pctVidaUtilAnios\"||']' AS NombreDelArea "; cadenaSql += "FROM \"PlanCuentas\" "; cadenaSql += "ORDER BY substr(\"pctNombre\", POSITION(' - ' IN \"pctNombre\"))"; NpgsqlCommand cmd = new NpgsqlCommand(cadenaSql, conexion); NpgsqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { PlanCuentas pPlanCuentas = new PlanCuentas { PctId = Convert.ToInt32(dr[0]), PctNombre = Convert.ToString(dr[1]), }; lista.Add(pPlanCuentas); } dr.Close(); conexion.Close(); //cb.SelectedIndex = 0; return(lista); }