Ejemplo n.º 1
0
        public ActionResult AdministrarCasasAdmin()
        {
            IEnumerable <Cliente> casas = ClientesImportados.GetClientes();

            foreach (Cliente c in casas)
            {
                c.CargarDisps();
            }

            return(View(casas));
        }
Ejemplo n.º 2
0
        public ActionResult ReporteHogar()
        {
            ViewBag.consumo = "";
            IEnumerable <Cliente> casas   = ClientesImportados.GetClientes();//se carga lista de casas
            List <SelectListItem> hogares = new List <SelectListItem>();

            foreach (Cliente c in casas)
            {
                hogares.Add(new SelectListItem()
                {
                    Value = c.UsuarioID.ToString(), Text = c.Username
                });
            }
            ViewBag.IdSeleccionado = hogares;

            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult SimplexView(SubmitViewModel model)
        {
            if (User.Identity.IsAuthenticated || ClientesImportados.GetClientes() != null)
            {
                Cliente clie = new Cliente(User.Identity.Name);
                ViewBag.recomendaciones = clie.SolicitarRecomendacion().ToList();

                /*
                 * if (@System.Boolean.) {
                 *  clie.AccionAutomaticaON();
                 * }
                 * else
                 * {
                 *  clie.AccionAutomaticaOFF();
                 * }*/
                return(View());
            }

            ViewBag.simplexResultado = "Hubo un error al ejecutar el simplex";
            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult ReporteHogar(SubmitViewModel model, DateTime FechaInicio, DateTime FechaFin)
        {
            IEnumerable <Cliente> casas   = ClientesImportados.GetClientes();//se carga lista de casas
            List <SelectListItem> hogares = new List <SelectListItem>();

            foreach (Cliente c in casas)
            {
                hogares.Add(new SelectListItem()
                {
                    Value = c.UsuarioID.ToString(), Text = c.Username
                });
            }
            ViewBag.IdSeleccionado = hogares;


            Cliente usu           = new Cliente(model.IdSeleccionado);
            Reporte reporteModelo = new Reporte("Hogar", usu.UsuarioID.ToString(), 0, FechaInicio, FechaFin);

            //if(reporte esta en mongo){find} else{ se crea y se guarda en mongo}
            var reportesEncontrados = Mongo.getReporte("Hogar", usu.UsuarioID.ToString(), FechaInicio, FechaFin);

            if (reportesEncontrados.Count > 0)
            {
                var reporte = reportesEncontrados[0];
                ViewBag.consumo = "Consumo: " + reporte.consumo.ToString() + "Kw";
            }
            else
            {
                reporteModelo.consumo = usu.CalcularConsumo(FechaInicio, FechaFin);
                ViewBag.consumo       = "Consumo: " + reporteModelo.consumo + " Kw";
                Mongo.insertarReporte(reporteModelo);
            }
            ViewBag.fechas = FechaInicio.ToShortDateString() + " - " + FechaFin.ToShortDateString();
            ViewBag.nombre = usu.Username;
            return(View());
        }