Exemplo n.º 1
0
        public async Task <IActionResult> GetEstadisticasV2(string UserId)
        {
            if (string.IsNullOrEmpty(UserId))
            {
                UserId = "";
            }

            var resumen = await _datosRepository.GetResumePlacasAsync(UserId, "");

            EstadisticasV2ViewModel estadisticasV2ViewModel = new EstadisticasV2ViewModel
            {
                vehiculos    = await _vehiculoProvGpsRepository.GetVehiculosAsync(UserId),
                vehiculosGps = _vehiculoGpsRepository.GetVehiculosGPSAsync(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, UserId, ""),
                //Conductores = await _datosRepository.GetConductoresAsync(UserId, ""),
                //ingresosTalleres = await _datosRepository.GetIngresosTallerAsync(UserId, ""),
                //siniestros = await _datosRepository.GetSiniestrosAsync(UserId, ""),
            };

            return(PartialView("_EstadisticasV2PartialView", estadisticasV2ViewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            MantenimientoViewModel modelView = new MantenimientoViewModel();
            DashBoardV2ViewModel   model     = new DashBoardV2ViewModel();

            modelView.DashboardMantViewModel = new DashboardMantViewModel();

            if (!string.IsNullOrEmpty(this.User.Identity.Name))
            {
                var user = await _userHelper.GetUserAsync(this.User.Identity.Name);

                if (user != null)
                {
                    model.Anios = _combosHelper.GetComboAnio();
                    model.Meses = _combosHelper.GetComboMes();
                    if (this.User.IsInRole("Cliente"))
                    {
                        modelView.ResumenPlacasViewModel = await _datosRepository.GetResumePlacasAsync(user.Cedula, "");

                        var cuantos = await _datosRepository.GetMantenimientoEstadoCuantos(user.Cedula, "", "");

                        modelView.DashboardMantViewModel = getCuantos(cuantos);
                    }
                    else if (this.User.IsInRole("Admin") || this.User.IsInRole("Renting"))
                    {
                        model.Clientes = _combosHelper.GetComboClientes();
                        model.Anios    = _combosHelper.GetComboAnio();
                        model.Meses    = _combosHelper.GetComboMes();
                        //modelView.ResumenPlacasViewModel = await _datosRepository.GetResumePlacasAsync(user.Cedula, "");
                        modelView.ResumenPlacasViewModel = await _datosRepository.GetResumePlacasAsync("", "");

                        var cuantos = await _datosRepository.GetMantenimientoEstadoCuantos("", "", "");

                        modelView.DashboardMantViewModel = getCuantos(cuantos);
                    }
                }
            }
            modelView.DashBoardV2ViewModel = model;
            return(View(modelView));
        }