Example #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;
            }
        }
Example #2
0
        /// <summary>
        /// لیست همه بازه های زمانی قفل شده و در حال رزرو را برای ارایه موردنظر را در تاریخ مشخص شده بر می گرداند
        /// </summary>
        /// <param name="serviceSupply">ارایه موردنظر</param>
        /// <param name="Date">تاریخ - روز</param>
        /// <returns>لیست بازه های زمانی در حال رزرو</returns>
        public IEnumerable <TimePeriodModel> Calculate_InProgressAppointments_TimePriods(ServiceSupply serviceSupply, DateTime Date)
        {
            var InProgressAppointments = _iPAsManager.GetAll(serviceSupply, Date);

            var result = InProgressAppointments.Select(item => new TimePeriodModel
            {
                StartDateTime = item.StartDateTime,
                EndDateTime   = item.EndDateTime,
                Type          = TimePeriodType.InProgressAppointment,
                Duration      = serviceSupply.Duration
            }).OrderBy(x => x.StartDateTime);

            return(result);
        }
Example #3
0
 public async Task Execute(IJobExecutionContext context)
 {
     try
     {
         var foundedToRetrive = _iPAsManager.GetAll().Where(ipa => (DateTime.Now - ipa.AddedAt).TotalMinutes >= Utils.ExpiredIpaMinutes);
         if (foundedToRetrive != null && foundedToRetrive.Count() >= 1)
         {
             _iPAsManager.DeleteRange(foundedToRetrive);
         }
     }
     catch (Exception ex)
     {
         //ReFire job if it is stopped
         var jee = new JobExecutionException(ex)
         {
             RefireImmediately = true
         };
         throw jee;
     }
 }