public static string cargaRepoDia() { UsuarioCompleto UsuarioCompleto = (UsuarioCompleto)HttpContext.Current.Session["UsuarioCompleto"]; Reporte reportedia = new Reporte(); ReporteRepository r = new ReporteRepository(); Reportes relocal = new Reportes(); Reporte reporDia = r.calcularNutrientesDiarios(UsuarioCompleto.Usuario.id_usuario, relocal.fechaAnterior(1)); var json = JsonConvert.SerializeObject(reporDia, Formatting.Indented); return(json); }
public static string cargaRepoQuince() { UsuarioCompleto UsuarioCompleto = (UsuarioCompleto)HttpContext.Current.Session["UsuarioCompleto"]; ReporteRepository r = new ReporteRepository(); Reportes relocal = new Reportes(); Reporte reporte1 = new Reporte(); Reporte reporte2 = new Reporte(); Reporte reporte3 = new Reporte(); Reporte reporte4 = new Reporte(); Reporte reporte5 = new Reporte(); reporte1 = r.calcularNutrientesDiarios(UsuarioCompleto.Usuario.id_usuario, relocal.fechaAnterior(1)); reporte2 = r.calcularNutrientesDiarios(UsuarioCompleto.Usuario.id_usuario, relocal.fechaAnterior(4)); reporte3 = r.calcularNutrientesDiarios(UsuarioCompleto.Usuario.id_usuario, relocal.fechaAnterior(8)); reporte4 = r.calcularNutrientesDiarios(UsuarioCompleto.Usuario.id_usuario, relocal.fechaAnterior(12)); reporte5 = r.calcularNutrientesDiarios(UsuarioCompleto.Usuario.id_usuario, relocal.fechaAnterior(15)); Dictionary <String, Decimal> lista1 = new Dictionary <String, Decimal> { { relocal.fechaAnterior(15).ToString("yyyy-MM-dd hh:mm"), reporte5.proteina }, { relocal.fechaAnterior(12).ToString("yyyy-MM-dd hh:mm"), reporte4.proteina }, { relocal.fechaAnterior(8).ToString("yyyy-MM-dd hh:mm"), reporte3.proteina }, { relocal.fechaAnterior(4).ToString("yyyy-MM-dd hh:mm"), reporte2.proteina }, { relocal.fechaAnterior(1).ToString("yyyy-MM-dd hh:mm"), reporte1.proteina } }; Dictionary <String, Decimal> lista2 = new Dictionary <String, Decimal> { { relocal.fechaAnterior(15).ToString("yyyy-MM-dd hh:mm"), reporte5.carbohidratos }, { relocal.fechaAnterior(12).ToString("yyyy-MM-dd hh:mm"), reporte4.carbohidratos }, { relocal.fechaAnterior(8).ToString("yyyy-MM-dd hh:mm"), reporte3.carbohidratos }, { relocal.fechaAnterior(4).ToString("yyyy-MM-dd hh:mm"), reporte2.carbohidratos }, { relocal.fechaAnterior(1).ToString("yyyy-MM-dd hh:mm"), reporte1.carbohidratos } }; Dictionary <String, Decimal> lista3 = new Dictionary <String, Decimal> { { relocal.fechaAnterior(15).ToString("yyyy-MM-dd hh:mm"), reporte5.grasa }, { relocal.fechaAnterior(12).ToString("yyyy-MM-dd hh:mm"), reporte4.grasa }, { relocal.fechaAnterior(8).ToString("yyyy-MM-dd hh:mm"), reporte3.grasa }, { relocal.fechaAnterior(4).ToString("yyyy-MM-dd hh:mm"), reporte2.grasa }, { relocal.fechaAnterior(1).ToString("yyyy-MM-dd hh:mm"), reporte1.grasa } }; Dictionary <String, Decimal> lista4 = new Dictionary <String, Decimal> { { relocal.fechaAnterior(15).ToString("yyyy-MM-dd hh:mm"), reporte5.agua }, { relocal.fechaAnterior(12).ToString("yyyy-MM-dd hh:mm"), reporte4.agua }, { relocal.fechaAnterior(8).ToString("yyyy-MM-dd hh:mm"), reporte3.agua }, { relocal.fechaAnterior(4).ToString("yyyy-MM-dd hh:mm"), reporte2.agua }, { relocal.fechaAnterior(1).ToString("yyyy-MM-dd hh:mm"), reporte1.agua } }; Dictionary <String, Decimal> lista5 = new Dictionary <String, Decimal> { { relocal.fechaAnterior(15).ToString("yyyy-MM-dd hh:mm"), reporte5.fibra }, { relocal.fechaAnterior(12).ToString("yyyy-MM-dd hh:mm"), reporte4.fibra }, { relocal.fechaAnterior(8).ToString("yyyy-MM-dd hh:mm"), reporte3.fibra }, { relocal.fechaAnterior(4).ToString("yyyy-MM-dd hh:mm"), reporte2.fibra }, { relocal.fechaAnterior(1).ToString("yyyy-MM-dd hh:mm"), reporte1.fibra } }; List <Object> listafull = new List <Object>(); listafull.Add(lista1); listafull.Add(lista2); listafull.Add(lista3); listafull.Add(lista4); listafull.Add(lista5); var json = JsonConvert.SerializeObject(listafull, Formatting.Indented); return(json); }