Пример #1
0
        public async Task <bool> SetMessages(string userId, int departmentId)
        {
            // Trying to speed this up (may need to ditch it all together) but at times
            // this is a big hit on NewRelic, most likely because it's constructing the
            // message and call service every time. It's not an ideal solution, but hopefully
            // it will help for a bit.
            // TODO: Make a SQL Call
            try
            {
                var stats = await _departmentsService.GetDepartmentStatsByDepartmentUserIdAsync(departmentId, userId);

                NewMessages = stats.UnreadMessageCount;
                NewCalls    = stats.OpenCallsCount;
            }
            catch (Exception)
            {
                _departmentsService = ServiceLocator.Current.GetInstance <IDepartmentsService>();

                var stats = await _departmentsService.GetDepartmentStatsByDepartmentUserIdAsync(departmentId, userId);

                NewMessages = stats.UnreadMessageCount;
                NewCalls    = stats.OpenCallsCount;
            }

            return(true);
        }
Пример #2
0
 public StatusScheduleLogic()
 {
     _userStateService      = Bootstrapper.GetKernel().Resolve <IUserStateService>();
     _scheduledTasksService = Bootstrapper.GetKernel().Resolve <IScheduledTasksService>();
     _departmentsService    = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
     _actionLogsService     = Bootstrapper.GetKernel().Resolve <IActionLogsService>();
 }
Пример #3
0
 public SectionsController(ApplicationDbContext context, IDepartmentsService departmentsService, ISectionsService sectionsService, UserManager <ApplicationUser> userManager)
 {
     this.context            = context;
     this.departmentsService = departmentsService;
     this.sectionsService    = sectionsService;
     this.userManager        = userManager;
 }
Пример #4
0
 public DispatchController(
     IUsersService usersService,
     IActionLogsService actionLogsService,
     IDepartmentsService departmentsService,
     IUserProfileService userProfileService,
     IUserStateService userStateService,
     IUnitsService unitsService,
     ICallsService callsService,
     IDepartmentGroupsService departmentGroupsService,
     IPersonnelRolesService personnelRolesService,
     ICustomStateService customStateService,
     IGeoLocationProvider geoLocationProvider,
     ICqrsProvider cqrsProvider,
     IDepartmentSettingsService departmentSettingsService,
     ITemplatesService templatesService
     )
 {
     _usersService              = usersService;
     _actionLogsService         = actionLogsService;
     _departmentsService        = departmentsService;
     _userProfileService        = userProfileService;
     _userStateService          = userStateService;
     _unitsService              = unitsService;
     _callsService              = callsService;
     _departmentGroupsService   = departmentGroupsService;
     _personnelRolesService     = personnelRolesService;
     _customStateService        = customStateService;
     _geoLocationProvider       = geoLocationProvider;
     _cqrsProvider              = cqrsProvider;
     _departmentSettingsService = departmentSettingsService;
     _templatesService          = templatesService;
 }
Пример #5
0
 public EditController(IEmployesService employesService, IDepartmentsService departmentsService, ILanguagesService languagesService, IExperienceService experienceService)
 {
     _employesService    = employesService;
     _departmentsService = departmentsService;
     _languagesService   = languagesService;
     _experienceService  = experienceService;
 }
Пример #6
0
 public CoreDataController(
     IUsersService usersService,
     IDepartmentsService departmentsService,
     IUserProfileService userProfileService,
     IUnitsService unitsService,
     IDepartmentGroupsService departmentGroupsService,
     IPersonnelRolesService personnelRolesService,
     ICustomStateService customStateService,
     IPermissionsService permissionsService,
     ICallsService callsService,
     IFirebaseService firebaseService,
     IDepartmentSettingsService departmentSettingsService
     )
 {
     _usersService              = usersService;
     _departmentsService        = departmentsService;
     _userProfileService        = userProfileService;
     _unitsService              = unitsService;
     _departmentGroupsService   = departmentGroupsService;
     _personnelRolesService     = personnelRolesService;
     _customStateService        = customStateService;
     _permissionsService        = permissionsService;
     _callsService              = callsService;
     _firebaseService           = firebaseService;
     _departmentSettingsService = departmentSettingsService;
 }
Пример #7
0
 public CallsController(
     ICallsService callsService,
     IDepartmentsService departmentsService,
     IUserProfileService userProfileService,
     IGeoLocationProvider geoLocationProvider,
     IAuthorizationService authorizationService,
     IQueueService queueService,
     IUsersService usersService,
     IUnitsService unitsService,
     IActionLogsService actionLogsService,
     IDepartmentGroupsService departmentGroupsService,
     IPersonnelRolesService personnelRolesService
     )
 {
     _callsService            = callsService;
     _departmentsService      = departmentsService;
     _userProfileService      = userProfileService;
     _geoLocationProvider     = geoLocationProvider;
     _authorizationService    = authorizationService;
     _queueService            = queueService;
     _usersService            = usersService;
     _unitsService            = unitsService;
     _actionLogsService       = actionLogsService;
     _departmentGroupsService = departmentGroupsService;
     _personnelRolesService   = personnelRolesService;
 }
Пример #8
0
 public EmailController(IDepartmentSettingsService departmentSettingsService, INumbersService numbersService,
                        ILimitsService limitsService, ICallsService callsService, IQueueService queueService, IDepartmentsService departmentsService,
                        IUserProfileService userProfileService, ITextCommandService textCommandService, IActionLogsService actionLogsService,
                        IUserStateService userStateService, ICommunicationService communicationService, IDistributionListsService distributionListsService,
                        IUsersService usersService, IEmailService emailService, IDepartmentGroupsService departmentGroupsService, IMessageService messageService,
                        IFileService fileService, IUnitsService unitsService)
 {
     _departmentSettingsService = departmentSettingsService;
     _numbersService            = numbersService;
     _limitsService             = limitsService;
     _callsService             = callsService;
     _queueService             = queueService;
     _departmentsService       = departmentsService;
     _userProfileService       = userProfileService;
     _textCommandService       = textCommandService;
     _actionLogsService        = actionLogsService;
     _userStateService         = userStateService;
     _communicationService     = communicationService;
     _distributionListsService = distributionListsService;
     _usersService             = usersService;
     _emailService             = emailService;
     _departmentGroupsService  = departmentGroupsService;
     _messageService           = messageService;
     _fileService  = fileService;
     _unitsService = unitsService;
 }
Пример #9
0
        public void PopulateQueue()
        {
            if (!_isLocked)
            {
                _isLocked = true;

                _departmentsService    = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
                _scheduledTasksService = Bootstrapper.GetKernel().Resolve <IScheduledTasksService>();
                _usersService          = Bootstrapper.GetKernel().Resolve <IUsersService>();

                Task t1 = new Task(() =>
                {
                    try
                    {
                        var allItems = _scheduledTasksService.GetUpcomingScheduledTaks();

                        // Filter only the past items and ones that are 5 minutes 30 seconds in the future
                        var items = from st in allItems
                                    let department                         = _departmentsService.GetDepartmentByUserId(st.UserId)
                                                                 let email = _usersService.GetMembershipByUserId(st.UserId).Email
                                                                             let runTime = st.WhenShouldJobBeRun(TimeConverterHelper.TimeConverter(DateTime.UtcNow, department))
                                                                                           where
                                                                                           st.TaskType == (int)TaskTypes.ReportDelivery && runTime.HasValue &&
                                                                                           runTime.Value >= TimeConverterHelper.TimeConverter(DateTime.UtcNow, department) &&
                                                                                           runTime.Value <= TimeConverterHelper.TimeConverter(DateTime.UtcNow, department).AddMinutes(5).AddSeconds(30)
                                                                                           select new
                        {
                            ScheduledTask = st,
                            Department    = department,
                            Email         = email
                        };

                        foreach (var i in items)
                        {
                            var qi           = new ReportDeliveryQueueItem();
                            qi.ScheduledTask = i.ScheduledTask;
                            qi.Department    = i.Department;
                            qi.Email         = i.Email;

                            _queue.Enqueue(qi);
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogException(ex);
                    }
                    finally
                    {
                        _isLocked = false;
                        _cleared  = false;

                        _departmentsService    = null;
                        _scheduledTasksService = null;
                        _usersService          = null;
                    }
                });

                t1.Start();
            }
        }
Пример #10
0
 public UnitAppController(
     IUsersService usersService,
     IActionLogsService actionLogsService,
     IDepartmentsService departmentsService,
     IUserProfileService userProfileService,
     IWebEventPublisher webEventPublisher,
     IUserStateService userStateService,
     IUnitsService unitsService,
     ICallsService callsService,
     IDepartmentGroupsService departmentGroupsService,
     IPersonnelRolesService personnelRolesService,
     ICustomStateService customStateService,
     IGeoLocationProvider geoLocationProvider,
     ICqrsProvider cqrsProvider
     )
 {
     _usersService            = usersService;
     _actionLogsService       = actionLogsService;
     _departmentsService      = departmentsService;
     _userProfileService      = userProfileService;
     _webEventPublisher       = webEventPublisher;
     _userStateService        = userStateService;
     _unitsService            = unitsService;
     _callsService            = callsService;
     _departmentGroupsService = departmentGroupsService;
     _personnelRolesService   = personnelRolesService;
     _customStateService      = customStateService;
     _geoLocationProvider     = geoLocationProvider;
     _cqrsProvider            = cqrsProvider;
 }
Пример #11
0
 public HomeController(IDepartmentsService departmentsService, IUsersService usersService, IActionLogsService actionLogsService,
                       IUserStateService userStateService, IDepartmentGroupsService departmentGroupsService, Resgrid.Model.Services.IAuthorizationService authorizationService,
                       IUserProfileService userProfileService, ICallsService callsService, IGeoLocationProvider geoLocationProvider, IDepartmentSettingsService departmentSettingsService,
                       IUnitsService unitsService, IAddressService addressService, IPersonnelRolesService personnelRolesService, IPushService pushService, ILimitsService limitsService,
                       ICustomStateService customStateService, IEventAggregator eventAggregator, IOptions <AppOptions> appOptionsAccessor, UserManager <IdentityUser> userManager)
 {
     _departmentsService        = departmentsService;
     _usersService              = usersService;
     _actionLogsService         = actionLogsService;
     _userStateService          = userStateService;
     _departmentGroupsService   = departmentGroupsService;
     _authorizationService      = authorizationService;
     _userProfileService        = userProfileService;
     _callsService              = callsService;
     _geoLocationProvider       = geoLocationProvider;
     _departmentSettingsService = departmentSettingsService;
     _unitsService              = unitsService;
     _addressService            = addressService;
     _personnelRolesService     = personnelRolesService;
     _pushService        = pushService;
     _limitsService      = limitsService;
     _customStateService = customStateService;
     _eventAggregator    = eventAggregator;
     _appOptionsAccessor = appOptionsAccessor;
     _userManager        = userManager;
 }
Пример #12
0
 public BigBoardController(
     IUsersService usersService,
     IActionLogsService actionLogsService,
     IDepartmentsService departmentsService,
     IUserProfileService userProfileService,
     IUserStateService userStateService,
     IUnitsService unitsService,
     ICallsService callsService,
     IDepartmentGroupsService departmentGroupsService,
     IPersonnelRolesService personnelRolesService,
     ICustomStateService customStateService,
     IDepartmentSettingsService departmentSettingsService,
     IGeoLocationProvider geoLocationProvider
     )
 {
     _usersService              = usersService;
     _actionLogsService         = actionLogsService;
     _departmentsService        = departmentsService;
     _userProfileService        = userProfileService;
     _userStateService          = userStateService;
     _unitsService              = unitsService;
     _callsService              = callsService;
     _departmentGroupsService   = departmentGroupsService;
     _personnelRolesService     = personnelRolesService;
     _customStateService        = customStateService;
     _departmentSettingsService = departmentSettingsService;
     _geoLocationProvider       = geoLocationProvider;
 }
 //------------- CONSTRUCTORS --------------
 /// <summary>
 /// Initializes a new <see cref="OperatingLocationsService"/>.
 /// </summary>
 /// <param name="dbContext">Database context</param>
 public OperatingLocationsService(ApplicationDbContext dbContext, IDepartmentsService departmentsService, IPhonesService phonesService, IEmployeesService employeesService)
 {
     this.dbContext          = dbContext;
     this.departmentsService = departmentsService;
     this.phonesService      = phonesService;
     this.employeesService   = employeesService;
 }
Пример #14
0
 public TrainingsController(IDepartmentGroupsService departmentGroupsService, IDepartmentsService departmentService, ITrainingService trainingService, IPersonnelRolesService personnelRolesService)
 {
     _departmentGroupsService = departmentGroupsService;
     _departmentsService      = departmentService;
     _trainingService         = trainingService;
     _personnelRolesService   = personnelRolesService;
 }
 public DepartmentController(IRepository <Department, int> departmentRepository, IDepartmentsService departmentsService, IRepository <Teacher, int> teacherRepository, AppDbContext dbContext)
 {
     _departmentRepository = departmentRepository;
     _departmentsService   = departmentsService;
     _teacherRepository    = teacherRepository;
     _dbContext            = dbContext;
 }
Пример #16
0
        public EmailService(IUserProfileService userProfileService, IUsersService usersService, IGeoLocationProvider geoLocationProvider, IEmailProvider emailProvider,
                            IDepartmentsService departmentsService, ICallEmailProvider callEmailProvider, IEmailSender emailSender, IAmazonEmailSender amazonEmailSender)
        {
            _userProfileService  = userProfileService;
            _usersService        = usersService;
            _geoLocationProvider = geoLocationProvider;
            _emailProvider       = emailProvider;
            _departmentsService  = departmentsService;
            _callEmailProvider   = callEmailProvider;
            _emailSender         = emailSender;
            _amazonEmailSender   = amazonEmailSender;

            _smtpClient = new SmtpClient
            {
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Host           = Config.OutboundEmailServerConfig.Host
            };
            _smtpClient.Credentials = new System.Net.NetworkCredential(Config.OutboundEmailServerConfig.UserName, Config.OutboundEmailServerConfig.Password);

            IEmailSender sender = new EmailSender
            {
                CreateClientFactory = () => new SmtpClientWrapper(_smtpClient)
            };

            _emailProvider.Configure(emailSender, "*****@*****.**");
        }
Пример #17
0
 public ProtocolsController(IProtocolsService protocolsService, ICallsService callsService, IAuthorizationService authorizationService, IDepartmentsService departmentsService)
 {
     _protocolsService     = protocolsService;
     _callsService         = callsService;
     _authorizationService = authorizationService;
     _departmentsService   = departmentsService;
 }
Пример #18
0
 public TopIconsModel()
 {
     if (_departmentsService == null)
     {
         _departmentsService = ServiceLocator.Current.GetInstance <IDepartmentsService>();
     }
 }
Пример #19
0
 //ITeachersService teachersService;
 //ISubjectsService subjectsService;
 public StudentDepartmentsService(IUnitOfWork db, IStudentsService studentsService, IDepartmentsService departmentsService)
 {
     this.db = db;
     this.studentsService    = studentsService;
     this.departmentsService = departmentsService;
     //this.teachersService = teachersService;
     //this.subjectsService = subjectsService;
 }
 public CourseController(IInstructorService instructorService,
                         IDepartmentsService departmentsService,
                         ICoursesService coursesService)
 {
     _instructorService  = instructorService;
     _departmentsService = departmentsService;
     _coursesService     = coursesService;
 }
Пример #21
0
 public UserProfileService(IUserProfilesRepository userProfileRepository, IDepartmentsService departmentsService, ICacheProvider cacheProvider,
                           IGenericDataRepository <DepartmentMember> departmentMemberRepository)
 {
     _userProfileRepository      = userProfileRepository;
     _departmentsService         = departmentsService;
     _cacheProvider              = cacheProvider;
     _departmentMemberRepository = departmentMemberRepository;
 }
Пример #22
0
 public EmployeesService(UserManager <Employee> userManger, SignInManager <Employee> signInManager, OmmDbContext context, IDepartmentsService departmentsService, ISendGrid emailSender)
 {
     this.userManger         = userManger;
     this.signInManager      = signInManager;
     this.context            = context;
     this.departmentsService = departmentsService;
     this.emailSender        = emailSender;
 }
Пример #23
0
 public ScheduledTasksService(IScheduledTasksRepository scheduledTaskRepository, IScheduledTaskLogsRepository scheduledTaskLogRepository,
                              IDepartmentsService departmentsService, ICacheProvider cacheProvider)
 {
     _scheduledTaskRepository    = scheduledTaskRepository;
     _scheduledTaskLogRepository = scheduledTaskLogRepository;
     _departmentsService         = departmentsService;
     _cacheProvider = cacheProvider;
 }
Пример #24
0
 public SecurityController(IDepartmentsService departmentsService, IAuditService auditService,
                           IPermissionsService permissionsService, IEventAggregator eventAggregator)
 {
     _departmentsService = departmentsService;
     _auditService       = auditService;
     _permissionsService = permissionsService;
     _eventAggregator    = eventAggregator;
 }
Пример #25
0
 public CalendarService(ICalendarItemsRepository calendarItemRepository, ICalendarItemTypeRepository calendarItemTypeRepository,
                        ICalendarItemAttendeeRepository calendarItemAttendeeRepository, IDepartmentsService departmentsService)
 {
     _calendarItemRepository         = calendarItemRepository;
     _calendarItemTypeRepository     = calendarItemTypeRepository;
     _calendarItemAttendeeRepository = calendarItemAttendeeRepository;
     _departmentsService             = departmentsService;
 }
Пример #26
0
 public StudentController(UserManager <SapIdentityUser> userManager, IStudentsService studentsService, IPersonsService personsService, IDepartmentsService departmentsService, IDepartmentPersonsService departmentPersonsService, ICoursesService coursesService) : base(userManager, null, null)
 {
     _studentsService          = studentsService;
     _personsService           = personsService;
     _departmentsService       = departmentsService;
     _departmentPersonsService = departmentPersonsService;
     _coursesService           = coursesService;
 }
Пример #27
0
 public InventoryController(IInventoryService inventoryService, IDepartmentGroupsService departmentGroupsService, IUnitsService unitsService, IDepartmentsService departmentsService, IUserProfileService userProfileService)
 {
     _inventoryService        = inventoryService;
     _departmentGroupsService = departmentGroupsService;
     _unitsService            = unitsService;
     _departmentsService      = departmentsService;
     _userProfileService      = userProfileService;
 }
Пример #28
0
 public UserStateService(IUserStatesRepository userStateRepository, IDepartmentsService departmentsService,
                         IEventAggregator eventAggregator, ICacheProvider cacheProvider)
 {
     _userStateRepository = userStateRepository;
     _departmentsService  = departmentsService;
     _eventAggregator     = eventAggregator;
     _cacheProvider       = cacheProvider;
 }
Пример #29
0
 public CalendarNotifierLogic()
 {
     _communicationService      = Bootstrapper.GetKernel().Resolve <ICommunicationService>();
     _userProfileService        = Bootstrapper.GetKernel().Resolve <IUserProfileService>();
     _departmentSettingsService = Bootstrapper.GetKernel().Resolve <IDepartmentSettingsService>();
     _calendarService           = Bootstrapper.GetKernel().Resolve <ICalendarService>();
     _departmentGroupsService   = Bootstrapper.GetKernel().Resolve <IDepartmentGroupsService>();
     _departmentsService        = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
 }
Пример #30
0
 public QueueService(IGenericDataRepository <QueueItem> queueItemsRepository, IOutboundQueueProvider outboundQueueProvider, IDepartmentSettingsService departmentSettingsService,
                     IDepartmentsService departmentsService, IGeoLocationProvider geoLocationProvider)
 {
     _queueItemsRepository      = queueItemsRepository;
     _outboundQueueProvider     = outboundQueueProvider;
     _departmentSettingsService = departmentSettingsService;
     _departmentsService        = departmentsService;
     _geoLocationProvider       = geoLocationProvider;
 }
 public HospitalsController(
     IHospitalsService hospitals,
     IDoctorsService doctors,
     IUsersService users,
     IDepartmentsService departments)
 {
     this.hospitals = hospitals;
     this.doctors = doctors;
     this.users = users;
     this.departments = departments;
 }
 public DepartmentsController(IDepartmentsService departments, IHospitalsService hospitals, ICacheService cache)
 {
     this.departmentsService = departments;
     this.hospitalsService = hospitals;
     this.cache = cache;
 }