public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null) { var sql = string.Format("select {0} * ", limite == 0 ? "" : "top " + limite); sql += " from v_predio where id_ciudad = @id order by clave, num_construccion"; var str = ConfigurationManager.ConnectionStrings["riesgos"].ConnectionString; var conn = new SqlConnection(str); conn.Open(); var mapa = new Dictionary<string, ValoresFuente>(); var reader = new SqlHelper(conn).ExecuteReader(sql, new { id = city.Id }); while (reader.Read()) { var temp = new ValoresFuente(); temp.Tipo = "construccion"; Utils.FillDict(reader, temp); var cod = temp.GetString("clave"); var num = temp.GetString("num_construccion") ?? "0"; var key = Utils.MakeKey(cod, num); if (!mapa.ContainsKey(key)) { temp.Codigo1 = cod; temp.Codigo2 = num; temp.IdItem = temp["id"]; mapa[key] = temp; } var cat = temp.GetString("clave_dato"); if (!string.IsNullOrEmpty(cat)) mapa[key][cat] = temp.GetString("valor_texto"); temp.Remove("clave_dato"); temp.Remove("valor_texto"); } reader.Close(); conn.Close(); return mapa.Values.ToList(); }
public string CodManzana(ValoresFuente fuente) { return string.Format("{0}{1}{2}", fuente.GetString("c_zona"), fuente.GetString("c_sector"), fuente.GetString("c_manzana") ); //return fuente.Codigo1.Substring(0, 6); }
public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null) { var top = limite > 0 ? "top " + limite : ""; var sql = "select " + top + " * from sta_elena order by codigo_catastral"; var str = ConfigurationManager.ConnectionStrings["riesgos"].ConnectionString; var conn = new SqlConnection(str); conn.Open(); var reader = new SqlHelper(conn).ExecuteReader(sql); var mapa = new Dictionary<string, ValoresFuente>(); var i = 0; while (reader.Read()) { i++; var temp = new ValoresFuente(); Utils.FillDict(reader, temp); var clave = temp.GetString("codigo_catastral"); if (mapa.ContainsKey(clave)) continue; var manzana = GetManzana(clave); temp.Tipo = "construccion"; temp.Codigo1 = clave; temp.Codigo2 = manzana; temp.IdItem = i; temp["clave"] = clave; temp["manzana"] = manzana; mapa[clave] = temp; } reader.Close(); conn.Close(); return mapa.Values.ToList(); }
public void CompletarDatos(Resultado res, ValoresFuente fuente) { res.Nombre = Utils.PruebeValor(fuente, new[] { "contribuyente", "direccion" }); res.Codigo3 = fuente.GetString("manzana"); foreach (var detalle in res.Detalles) { detalle.Id_componente = "1"; } res.Area = Utils.GetNumero(fuente["area_construccion"]); }
public void CompletarDatos(Resultado res, ValoresFuente fuente) { res.Nombre = Utils.PruebeValor(fuente, new[] { "nombres", "direccion" }); res.Codigo3 = CodManzana(res); if (fuente.ContainsKey("num_edif")) { var temp = fuente.GetString("num_edif"); foreach (var detalle in res.Detalles) { detalle.Id_componente = temp; } } res.Area = Utils.GetNumero(fuente["area_bloque"]); }
public void ResolverBloque(ValoresFuente fuente, string numero) { var key = string.Format(formatoBloque, numero); if (fuente.ContainsKey(key)) fuente["area_bloque"] = fuente[key]; else return; // borrar las otras areas for (var i = 1; i <= 6; i++) { if (i.ToString() == numero) continue; key = string.Format(formatoBloque, i); fuente.Remove(key); } }
public Resultado CrearResultado(ValoresFuente fuente) { var res = new Resultado { Id = Guid.NewGuid(), Codigo = fuente.Codigo1, Nombre = fuente.Codigo2, Fecha = DateTime.Now, Id_item = fuente.IdItem, Id_ciudad = City.Id, Canton = City.Nombre, Tipo_item = fuente.Tipo, Proceso = "REDES" }; return res; }
public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null) { var top = limite > 0 ? "top " + limite : ""; var sql = "select " + top + @" * from v_reporte where catalogo is not null order by zona,sector,manzana,solar, numero_edificacion, anio, area_construccion desc"; var str = ConfigurationManager.ConnectionStrings["babahoyo"].ConnectionString; var conn = new SqlConnection(str); conn.Open(); var mapa = new Dictionary<string, ValoresFuente>(); var reader = new SqlHelper(conn).ExecuteReader(sql); while (reader.Read()) { var temp = new ValoresFuente(); temp.Tipo = "construccion"; Utils.FillDict(reader, temp); var cod = temp.GetString("codigo_predio"); var num = temp.GetString("numero_edificacion"); var key = Utils.MakeKey(cod, num); if (!mapa.ContainsKey(key)) { var clave = ClaveCatastral( temp["zona"], temp["sector"], temp["manzana"], temp["solar"] ); temp["clave"] = clave; temp.Codigo1 = clave; temp.Codigo2 = temp.GetString("numero_edificacion"); temp.IdItem = temp["codigo_predio"]; mapa[key] = temp; } var cat = temp.GetString("catalogo"); if (!string.IsNullOrEmpty(cat)) mapa[key][cat] = temp.GetString("valor_catalogo"); temp.Remove("catalogo"); temp.Remove("valor_catalogo"); } reader.Close(); conn.Close(); return mapa.Values.ToList(); }
public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null) { var top = limite > 0 ? "top " + limite : ""; var sql = "select " + top + " * from v_reporte order by clave, bloque, piso, numero_pisos"; var str = ConfigurationManager.ConnectionStrings["latacunga"].ConnectionString; var conn = new SqlConnection(str); conn.Open(); var lista = new List<ValoresFuente>(); var reader = new SqlHelper(conn).ExecuteReader(sql); while (reader.Read()) { var temp = new ValoresFuente(); Utils.FillDict(reader, temp); temp.Tipo = "construccion"; temp.Codigo1 = temp.GetString("clave"); var key = string.Format("{0}.{1}", temp["bloque"], temp["piso"]); temp.Codigo2 = key; temp.IdItem = temp["id"]; lista.Add(temp); } reader.Close(); conn.Close(); return lista; }
protected IList<ValoresFuente> LlenarTabla(IWorksheet sheet, int row, FichaIndicadores ficha) { var lista = new List<ValoresFuente>(); var total = sheet.NumRows; var listaVars = ficha.Variables.Select(x => x.Value).OrderBy(x => x.Orden); for (int i = row; i <= total; i++) { var codigo = sheet.GetString("B", i); if (string.IsNullOrEmpty(codigo)) break; // IMPORTANTE var f = new ValoresFuente { Tipo = ficha.Nombre, IdItem = total++, Codigo1 = codigo }; var nombre = sheet.GetString("C", i); f.Codigo2 = string.IsNullOrEmpty(nombre) ? codigo : nombre; var off = 3; foreach (var v in listaVars) { off++; f[v.Codigo] = sheet.GetString(off, i); } lista.Add(f); } return lista; }
public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null) { var top = limite > 0 ? "top " + limite : ""; var sql = "select " + top + @" * from v_reporte v where manzana is not null order by predio_ID, num_edif, pisos, catalogo, categoria, valor_item"; var str = ConfigurationManager.ConnectionStrings["intelligov"].ConnectionString; var conn = new SqlConnection(str); conn.Open(); var reader = new SqlHelper(conn).ExecuteReader(sql); var mapa = new Dictionary<string, ValoresFuente>(); while (reader.Read()) { var temp = new ValoresFuente(); Utils.FillDict(reader, temp); var clave = temp.GetString("predio_codigo"); var numero = temp.GetString("num_edif"); var key = string.Format("{0}.{1}", clave, numero); if (!mapa.ContainsKey(key)) { temp.Tipo = "construccion"; temp.Codigo1 = clave; temp.Codigo2 = numero; temp.IdItem = temp["predio_ID"]; temp["clave"] = clave; ResolverBloque(temp, numero); temp.Remove("valor_item"); mapa[key] = temp; } var cat = temp.GetString("categoria"); var valor = temp.GetString("item_id", "").Trim(); if (string.IsNullOrEmpty(valor)) continue; if (mapa[key].ContainsKey(cat)) mapa[key][cat] += "," + valor; else mapa[key][cat] = valor; } reader.Close(); conn.Close(); return mapa.Values.ToList(); }