Exemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            DashBoardV2ViewModel model = new DashBoardV2ViewModel();

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

                if (user != null)
                {
                    if (this.User.IsInRole("Cliente"))
                    {
                        model.Anios = _combosHelper.GetComboAnio();
                        model.Meses = _combosHelper.GetComboMes();
                        EstadisticasV2ViewModel estadisticasV2ViewModel = new EstadisticasV2ViewModel
                        {
                            vehiculosGps = _vehiculoGpsRepository.GetVehiculosGPSAsync(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, user.Cedula, ""),
                        };
                        model.EstadisticasV2ViewModel = estadisticasV2ViewModel;
                    }
                    else if (this.User.IsInRole("Admin") || this.User.IsInRole("Renting"))
                    {
                        model.Clientes = _combosHelper.GetComboClientes();
                        model.Anios    = _combosHelper.GetComboAnio();
                        model.Meses    = _combosHelper.GetComboMes();
                        EstadisticasV2ViewModel estadisticasV2ViewModel = new EstadisticasV2ViewModel
                        {
                            vehiculosGps = _vehiculoGpsRepository.GetVehiculosGPSAsync(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, "", ""),
                        };
                        model.EstadisticasV2ViewModel = estadisticasV2ViewModel;
                    }
                }
            }
            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            SiniestrosDataViewModel modelView = new SiniestrosDataViewModel();
            DashBoardV2ViewModel    model     = new DashBoardV2ViewModel();

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

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

                        modelView.SiniestrosViewModel        = getCuantos(cuantos);
                        modelView.SiniestrosDetalleViewModel = await _datosRepository.GetSiniestrosDetalleAsync(user.Cedula, "");
                    }
                    else if (this.User.IsInRole("Admin") || this.User.IsInRole("Renting"))
                    {
                        model.Clientes = _combosHelper.GetComboClientes();
                        model.Anios    = _combosHelper.GetComboAnio();
                        model.Meses    = _combosHelper.GetComboMes();
                        var cuantos = await _datosRepository.GetSiniestrosAsync("", "");

                        modelView.SiniestrosViewModel        = getCuantos(cuantos);
                        modelView.SiniestrosDetalleViewModel = await _datosRepository.GetSiniestrosDetalleAsync("", "");
                    }
                    modelView.DashBoardV2ViewModel = model;
                }
            }
            return(View(modelView));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Index()
        {
            DashBoardV2ViewModel    model         = new DashBoardV2ViewModel();
            SustitutosDataViewModel dataViewModel = new SustitutosDataViewModel();

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

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

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

                        var gamas = await _context.gamas.ToListAsync();

                        dataViewModel.SustitutosCuantosViewModel = await getCuantos(dataViewModel.DiasSustitutosViewModel);
                    }
                    else if (this.User.IsInRole("Admin") || this.User.IsInRole("Renting"))
                    {
                        model.Meses    = _combosHelper.GetComboMes();
                        model.Anios    = _combosHelper.GetComboAnio();
                        model.Clientes = _combosHelper.GetComboClientes();
                        dataViewModel.DiasSustitutosViewModel = await _datosRepository.GetDiasSustitutosAsync("", "");

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

                        dataViewModel.SustitutosCuantosViewModel = await getCuantos(dataViewModel.DiasSustitutosViewModel);
                    }
                }
                dataViewModel.DashBoardV2ViewModel = model;
            }

            return(View(dataViewModel));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create(string id)
        {
            TramitesCreateViewModel tramitesCreateViewModel = new TramitesCreateViewModel();

            if (!string.IsNullOrEmpty(id))
            {
                tramitesCreateViewModel.cedula = id;
                tramitesCreateViewModel.Placas = await _combosHelper.GetComboPlacas(id);

                tramitesCreateViewModel.TramitesTypes = _combosHelper.GetComboTipoTramites();
                tramitesCreateViewModel.Meses         = _combosHelper.GetComboMes();
                tramitesCreateViewModel.Anios         = _combosHelper.GetComboAnio();
                tramitesCreateViewModel.Ciudades      = _combosHelper.GetComboCiudades();
            }
            else
            {
            }

            return(View(tramitesCreateViewModel));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Index()
        {
            //DashboardViewModel model = new DashboardViewModel();
            //if (!string.IsNullOrEmpty(this.User.Identity.Name))
            //{
            //    var user = await _userHelper.GetUserAsync(this.User.Identity.Name);
            //    if (user != null)
            //    {
            //        if (this.User.IsInRole("Cliente"))
            //        {
            //            model.Placas = await _combosHelper.GetComboPlacas(user.Cedula);
            //            model.Meses = _combosHelper.GetComboMes();
            //            model.Anios = _combosHelper.GetComboAnio();
            //            model.VehiculosClientesViewModel = await _datosRepository.GetVehiculosClienteAsync(user.Cedula);
            //            model.novedad = _novedadesRepository.GetNovedadAllNotSolution(user.Cedula);
            //            model.Tramite = _tramitesRepository.GetCountAllTramites(user.Cedula);
            //            model.Capacitaciones = _capacitacionesRepository.GetCountAllCapacitaciones();
            //            model.Analisis = _analisisRepository.GetCountAllAnalisis(user.Cedula);
            //            model.Transacciones = _tramitesRepository.GetCountAllTramites(user.Cedula) + _analisisRepository.GetCountAllAnalisis(user.Cedula);
            //            model.vehiculos = await _vehiculoProvGpsRepository.GetVehiculosAsync(user.Id);
            //            model.vehiculosGps = _vehiculoGpsRepository.GetVehiculosGPSAsync(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year,0);
            //            model.Conductores = await _datosRepository.GetConductoresAsync(user.Cedula, "");
            //            model.ingresosTalleres = await _datosRepository.GetIngresosTallerAsync(user.Cedula, "");
            //            model.siniestros = await _datosRepository.GetSiniestrosAsync(user.Cedula,"");
            //        }
            //        else if (this.User.IsInRole("Admin") || this.User.IsInRole("Renting"))
            //        {
            //            model.Clientes = _combosHelper.GetComboClientes();
            //            model.Meses = _combosHelper.GetComboMes();
            //            model.Anios = _combosHelper.GetComboAnio();

            //            var vehiculosTotal = await _datosRepository.GetDatosAutoAllAsync();
            //            model.TotalAutos = vehiculosTotal.Count();
            //            model.novedad = _novedadesRepository.GetNovedadAllNotSolution("");
            //            model.Tramite = _tramitesRepository.GetCountAllTramites("");
            //            model.Capacitaciones = _capacitacionesRepository.GetCountAllCapacitaciones();
            //            model.Analisis = _analisisRepository.GetCountAllAnalisis("");
            //            model.Transacciones = _tramitesRepository.GetCountAllTramites("") + _analisisRepository.GetCountAllAnalisis("");
            //            model.vehiculos = await _vehiculoProvGpsRepository.GetVehiculosAsync("");
            //            model.vehiculosGps = _vehiculoGpsRepository.GetVehiculosGPSAsync(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, 0);
            //            model.Conductores = await _datosRepository.GetConductoresAsync("", "");
            //            model.ingresosTalleres = await _datosRepository.GetIngresosTallerAsync("", "");
            //            model.siniestros = await _datosRepository.GetSiniestrosAsync("", "");
            //        }
            //    }
            //}
            DashBoardV2ViewModel model = new DashBoardV2ViewModel();

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

                if (user != null)
                {
                    if (this.User.IsInRole("Cliente"))
                    {
                        //model.Placas = await _combosHelper.GetComboPlacas(user.Id);
                        model.Placas = await _combosHelper.GetComboPlacasGPS(user.Cedula);

                        model.Meses = _combosHelper.GetComboMes();
                        model.Anios = _combosHelper.GetComboAnio();

                        var vehiculosTotal = await _datosRepository.GetVehiculosClienteAsync(user.Cedula);

                        EstadisticasV1ViewModel estadisticasV1ViewModel = new EstadisticasV1ViewModel
                        {
                            TotalAutos     = vehiculosTotal.Count(),
                            novedad        = _novedadesRepository.GetNovedadAllNotSolution(user.Cedula),
                            Tramite        = _tramitesRepository.GetCountAllTramites(user.Cedula),
                            Capacitaciones = _capacitacionesRepository.GetCountAllCapacitaciones(),
                            Analisis       = _analisisRepository.GetCountAllAnalisis(user.Cedula),
                            Transacciones  = _tramitesRepository.GetCountAllTramites(user.Cedula) + _analisisRepository.GetCountAllAnalisis(user.Cedula),
                        };

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


                        EstadisticasViewModel estadisticasViewModel = new EstadisticasViewModel();
                        estadisticasViewModel.EstadisticasV1ViewModel = estadisticasV1ViewModel;
                        estadisticasViewModel.EstadisticasV2ViewModel = estadisticasV2ViewModel;
                        model.EstadisticasViewModel = estadisticasViewModel;

                        //model.EstadisticasViewModel.EstadisticasV1ViewModel = estadisticasV1ViewModel;
                        //model.EstadisticasViewModel.EstadisticasV2ViewModel = estadisticasV2ViewModel;
                    }
                    else if (this.User.IsInRole("Admin") || this.User.IsInRole("Renting"))
                    {
                        model.Clientes = _combosHelper.GetComboClientes();
                        await GetPlacas("0");

                        model.Meses = _combosHelper.GetComboMes();
                        model.Anios = _combosHelper.GetComboAnio();

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

                        var vehiculosTotal = await _datosRepository.GetDatosAutoAllAsync();



                        EstadisticasV1ViewModel estadisticasV1ViewModel = new EstadisticasV1ViewModel
                        {
                            TotalAutos     = vehiculosTotal.Count(),
                            novedad        = _novedadesRepository.GetNovedadAllNotSolution(""),
                            Tramite        = _tramitesRepository.GetCountAllTramites(""),
                            Capacitaciones = _capacitacionesRepository.GetCountAllCapacitaciones(),
                            Analisis       = _analisisRepository.GetCountAllAnalisis(""),
                            Transacciones  = _tramitesRepository.GetCountAllTramites("") + _analisisRepository.GetCountAllAnalisis(""),
                        };

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

                        EstadisticasViewModel estadisticasViewModel = new EstadisticasViewModel();
                        estadisticasViewModel.EstadisticasV1ViewModel = estadisticasV1ViewModel;
                        estadisticasViewModel.EstadisticasV2ViewModel = estadisticasV2ViewModel;
                        model.EstadisticasViewModel = estadisticasViewModel;

                        //model.EstadisticasViewModel.EstadisticasV1ViewModel = estadisticasV1ViewModel;
                        //model.EstadisticasViewModel.EstadisticasV2ViewModel = estadisticasV2ViewModel;
                    }
                }
            }
            return(View(model));
        }