コード例 #1
0
        //--REPORTES--
        public DataReporte ObtenerReporte(string idTienda)
        {
            try
            {
                using (var context = ChebayDBContext.CreateTenant(idTienda))
                {
                    DataReporte ret = new DataReporte();

                    //REPORTE DE USUARIOS.
                    var qUsuarios = from usr in context.usuarios
                                    select usr;
                    ret.cantUsuarios = qUsuarios.Count();

                    //REPORTE DE TRANSACCIONES.
                    var qCompras = from cmp in context.compras
                                   select cmp;
                    ret.cantTransacciones = qCompras.Count();

                    return(ret);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                throw e;
            }
        }
コード例 #2
0
        public ActionResult VerReporteTienda(DatosVerTienda datos)
        {
            try
            {
                DataReporte reporte   = idalTienda.ObtenerReporte(datos.tienda);
                string      resultado = "<table class=\"table table-hover\">";
                resultado += "<tr class=\"active\" style=\"font-weight : bold\">";
                resultado += "<td>Usuarios : </td>";
                resultado += "<td>" + reporte.cantUsuarios + "</td>";
                resultado += "</tr>";
                resultado += "<tr class=\"primary\" style=\"font-weight : bold\">";
                resultado += "<td>Transacciones : </td>";
                resultado += "<td>" + reporte.cantTransacciones + "</td>";
                resultado += "</tr>";
                resultado += "</table>";

                var result = new { Success = "True", Message = resultado };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var result = new { Success = "False", Message = "Error" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }