コード例 #1
0
        public virtual async Task <IActionResult> Index()
        {
            try
            {
                (int site, int app, int kiosk, int sms, int ussd, int voip, int outOfSchedule) = await _appointmentService.GetReservationChannelStatisticsAsync();

                var channelReservationModel = new ChannelReservationStatisticsViewModel
                {
                    KioskAppointmentsCount          = kiosk,
                    WebsiteAppointmentsCount        = site,
                    AndroidAppAppointmentsCount     = app,
                    ReserveOutsideAppointmentsCount = outOfSchedule,
                    SMSAppointmentsCount            = sms,
                    VoipAppointmentsCount           = voip,
                    USSDAppointmentsCount           = ussd
                };

                var dashboard_model = new IndexViewModel
                {
                    OnlineUsers = 0, //(int)HttpContext.Application["OnlineUsersCount"],
                    TodayVisits = await _statisticsService.GetTodayVisitsCountAsync(),
                    //UniquVisitors = await context.Statisticses.GroupBy(ta => ta.IpAddress).Select(ta => ta.Key).CountAsync(),
                    UniquVisitors = 0,
                    TotallVisits  = await _statisticsService.GetTotalVisitsCountAsync(),

                    HospitalsCount               = await _hospitalService.GetHospitalsCountAsync(),
                    ClinicsCount                 = await _clinicService.GetAllClinicsCountAsync(),
                    PoliClinicsCount             = await _polyclinicService.GetAllApprovedShiftCentersCountAsync(),
                    AllAppointmentsCount         = await _appointmentService.GetAllAppointmentsCountAsync(),
                    InProgressAppointmentsCount  = _iPAsManager.GetAll().Count(),
                    PendingAppointmentsCount     = await _appointmentService.GetAllAppointmentsCountByStatusAsync(AppointmentStatus.Pending),
                    DoneAppointmentsountCount    = await _appointmentService.GetAllAppointmentsCountByStatusAsync(AppointmentStatus.Done),
                    CanceledAppointmentsCount    = await _appointmentService.GetAllAppointmentsCountByStatusAsync(AppointmentStatus.Canceled),
                    AllUsersCount                = await _userService.GetAllPersonsCountAsync(),
                    ChannelReservationStatistics = channelReservationModel
                };

                ViewData["NewPoliclinicRequests"] = await _polyclinicService.GetAllUnApprovedIndependentShiftCentersCountAsync();

                ViewData["AdminContactUsCount"] = await _contactUsService.GetAllUnreadMessagesCountAsync();

                return(View(dashboard_model));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.InnerException);
                throw;
            }
        }