// metodo principal ejecutar consulta public static List <string> executeQuery(string query) { query = query.ToLower(); Dictionary <string, object> filters = new Dictionary <string, object>(); filters = Utilities.selectQueryReader(query); string table_name = (string)filters["table_name"]; List <string> result = new List <string>(); if (table_name == "municipio") { result = Municipio.filterMunicipio(filters); } if (table_name == "provincia") { result = Provincia.filterProvincia(filters); } if (table_name == "barrio") { result = result = Barrio.filterBarrio(filters); } if (table_name == "urbanizacion") { result = result = Urbanizacion.filterUrbanizacion(filters); } if (table_name == "distrito_municipal") { result = result = DistritoMunicipal.filterDistritoMunicipal(filters); } if (table_name == "seccion_dm") { result = result = SeccionDM.filterSeccionDM(filters); } if (table_name == "barrio_dm") { result = result = BarrioDM.filterBarrioDM(filters); } if (table_name == "urbanizacion_dm") { result = result = UrbanizacionDM.filterUrbanizacionDM(filters); } if (table_name == "persona") { result = result = Persona.filterPersona(filters); } return(result); }
public void insertarSeccionDM(SeccionDM sec_dm, bool is_editar = false) { char sep = Utils.Utilities.sep; string dir = Utilities.seccion_dm_dir; string data = (sec_dm.idseccion_dm.ToString() + sep + sec_dm.iddistrito.ToString() + sep + sec_dm.nombre + sep + sec_dm.poblacion + sep + sec_dm.area + sep + sec_dm.punto_cardinal); if (is_editar) { Utilities.updateFromFileById(dir, sec_dm.idseccion_dm, data); } else { Utilities.writeSingleLineToFile(dir, data); } }
public static string executeQueryReturnString(string query) { query = query.ToLower(); Dictionary <string, object> filters = new Dictionary <string, object>(); filters = Utilities.selectQueryReader(query); string table_name = (string)filters["table_name"]; List <string> result = new List <string>(); string result_string = ""; if (table_name == "municipio") { result = Municipio.filterMunicipio(filters); } if (table_name == "provincia") { result = Provincia.filterProvincia(filters); } if (table_name == "barrio") { result = result = Barrio.filterBarrio(filters); } if (table_name == "urbanizacion") { result = result = Urbanizacion.filterUrbanizacion(filters); } if (table_name == "distrito_municipal") { result = result = DistritoMunicipal.filterDistritoMunicipal(filters); } if (table_name == "seccion_dm") { result = result = SeccionDM.filterSeccionDM(filters); } if (table_name == "barrio_dm") { result = result = BarrioDM.filterBarrioDM(filters); } if (table_name == "urbanizacion_dm") { result = result = UrbanizacionDM.filterUrbanizacionDM(filters); } if (table_name == "persona") { result = result = Persona.filterPersona(filters); } for (int i = 0; i < result.Count; i++) { if (i != result.Count - 1) { result_string += result[i] + "["; } else { result_string += result[i]; } } return(result_string); }