示例#1
0
 public CommunicationService(ISmsService smsService, IEmailService emailService, IPushService pushService, IGeoLocationProvider geoLocationProvider,
                             IOutboundVoiceProvider outboundVoiceProvider, IUserProfileService userProfileService, IDepartmentSettingsService departmentSettingsService)
 {
     _smsService                = smsService;
     _emailService              = emailService;
     _pushService               = pushService;
     _geoLocationProvider       = geoLocationProvider;
     _outboundVoiceProvider     = outboundVoiceProvider;
     _userProfileService        = userProfileService;
     _departmentSettingsService = departmentSettingsService;
 }
示例#2
0
 public ResourceOrdersService(IResourceOrdersRepository resourceOrdersRepository, IDepartmentsService departmentsService,
                              IDepartmentSettingsService departmentSettingsService, IEventAggregator eventAggregator, IResourceOrderItemRepository resourceOrderItemRepository,
                              IResourceOrderFillRepository resourceOrderFillRepository, IResourceOrderSettingsRepository resourceOrderSettingsRepository)
 {
     _resourceOrdersRepository        = resourceOrdersRepository;
     _departmentsService              = departmentsService;
     _departmentSettingsService       = departmentSettingsService;
     _eventAggregator                 = eventAggregator;
     _resourceOrderItemRepository     = resourceOrderItemRepository;
     _resourceOrderFillRepository     = resourceOrderFillRepository;
     _resourceOrderSettingsRepository = resourceOrderSettingsRepository;
 }
示例#3
0
 public DepartmentController(
     ICallsService callsService,
     IDepartmentGroupsService departmentGroupsService,
     IDepartmentSettingsService departmentSettingsService,
     IDepartmentsService departmentsService
     )
 {
     _callsService              = callsService;
     _departmentGroupsService   = departmentGroupsService;
     _departmentSettingsService = departmentSettingsService;
     _departmentsService        = departmentsService;
 }
示例#4
0
 public ResourceOrdersService(IResourceOrdersRepository resourceOrdersRepository, IDepartmentsService departmentsService, IDepartmentSettingsService departmentSettingsService,
                              IEventAggregator eventAggregator, IGenericDataRepository <ResourceOrder> genericResourceOrderRepository, IGenericDataRepository <ResourceOrderItem> genericResourceOrderItemRepository,
                              IGenericDataRepository <ResourceOrderFill> genericResourceOrderFillRepository)
 {
     _resourceOrdersRepository           = resourceOrdersRepository;
     _departmentsService                 = departmentsService;
     _departmentSettingsService          = departmentSettingsService;
     _eventAggregator                    = eventAggregator;
     _genericResourceOrderRepository     = genericResourceOrderRepository;
     _genericResourceOrderItemRepository = genericResourceOrderItemRepository;
     _genericResourceOrderFillRepository = genericResourceOrderFillRepository;
 }
示例#5
0
 public DepartmentProfileService(IGenericDataRepository <DepartmentProfile> departmentProfileRepository, IGenericDataRepository <DepartmentProfileArticle> departmentProfileArticleRepository,
                                 IGenericDataRepository <DepartmentProfileInvite> departmentProfileInviteRepository, IGenericDataRepository <DepartmentProfileMessage> departmentProfileMessageRepository,
                                 IDepartmentsService departmentsService, IDepartmentSettingsService departmentSettingsService, IGenericDataRepository <DepartmentProfileUser> departmentProfileUserRepository,
                                 IGenericDataRepository <DepartmentProfileUserFollow> departmentProfileUserFollowRepository)
 {
     _departmentProfileRepository        = departmentProfileRepository;
     _departmentProfileArticleRepository = departmentProfileArticleRepository;
     _departmentProfileInviteRepository  = departmentProfileInviteRepository;
     _departmentProfileMessageRepository = departmentProfileMessageRepository;
     _departmentsService                    = departmentsService;
     _departmentSettingsService             = departmentSettingsService;
     _departmentProfileUserRepository       = departmentProfileUserRepository;
     _departmentProfileUserFollowRepository = departmentProfileUserFollowRepository;
 }
示例#6
0
 public DepartmentGroupsService(IDepartmentGroupsRepository departmentGroupsRepository, IDepartmentGroupMembersRepository departmentGroupMembersRepository,
                                ISubscriptionsService subscriptionsService, IAddressService addressService, IDepartmentsService departmentsService, IGeoLocationProvider geoLocationProvider,
                                IDepartmentSettingsService departmentSettingsService, IEventAggregator eventAggregator, ICacheProvider cacheProvider,
                                IIdentityRepository identityRepository)
 {
     _departmentGroupsRepository       = departmentGroupsRepository;
     _departmentGroupMembersRepository = departmentGroupMembersRepository;
     _subscriptionsService             = subscriptionsService;
     _addressService            = addressService;
     _departmentsService        = departmentsService;
     _geoLocationProvider       = geoLocationProvider;
     _departmentSettingsService = departmentSettingsService;
     _eventAggregator           = eventAggregator;
     _cacheProvider             = cacheProvider;
     _identityRepository        = identityRepository;
 }
示例#7
0
 public ActionLogsService(IActionLogsRepository actionLogsRepository, IUsersService usersService,
                          IDepartmentMembersRepository departmentMembersRepository, IDepartmentGroupsService departmentGroupsService,
                          IDepartmentsService departmentsService, IDepartmentSettingsService departmentSettingsService, IEventAggregator eventAggregator,
                          IGeoService geoService, ICustomStateService customStateService, ICacheProvider cacheProvider)
 {
     _actionLogsRepository        = actionLogsRepository;
     _usersService                = usersService;
     _departmentMembersRepository = departmentMembersRepository;
     _departmentGroupsService     = departmentGroupsService;
     _departmentsService          = departmentsService;
     _departmentSettingsService   = departmentSettingsService;
     _eventAggregator             = eventAggregator;
     _geoService         = geoService;
     _customStateService = customStateService;
     _cacheProvider      = cacheProvider;
 }
示例#8
0
 public TextMessagesController(IDepartmentSettingsService departmentSettingsService, INumbersService numbersService,
                               ILimitsService limitsService, ICallsService callsService, IQueueService queueService, IDepartmentsService departmentsService,
                               IUserProfileService userProfileService, ITextCommandService textCommandService, IActionLogsService actionLogsService,
                               IUserStateService userStateService, ICommunicationService communicationService)
 {
     _departmentSettingsService = departmentSettingsService;
     _numbersService            = numbersService;
     _limitsService             = limitsService;
     _callsService         = callsService;
     _queueService         = queueService;
     _departmentsService   = departmentsService;
     _userProfileService   = userProfileService;
     _textCommandService   = textCommandService;
     _actionLogsService    = actionLogsService;
     _userStateService     = userStateService;
     _communicationService = communicationService;
 }
示例#9
0
 public UnitsController(IDepartmentsService departmentsService, IUsersService usersService, IUnitsService unitsService, Model.Services.IAuthorizationService authorizationService,
                        ILimitsService limitsService, IDepartmentGroupsService departmentGroupsService, ICallsService callsService, IEventAggregator eventAggregator, ICustomStateService customStateService,
                        IGeoService geoService, IDepartmentSettingsService departmentSettingsService, IGeoLocationProvider geoLocationProvider)
 {
     _departmentsService      = departmentsService;
     _usersService            = usersService;
     _unitsService            = unitsService;
     _authorizationService    = authorizationService;
     _limitsService           = limitsService;
     _departmentGroupsService = departmentGroupsService;
     _callsService            = callsService;
     _eventAggregator         = eventAggregator;
     _customStateService      = customStateService;
     _geoService = geoService;
     _departmentSettingsService = departmentSettingsService;
     _geoLocationProvider       = geoLocationProvider;
 }
示例#10
0
 public DepartmentsService(IDepartmentsRepository departmentRepository, IDepartmentMembersRepository departmentMembersRepository,
                           ISubscriptionsService subscriptionsService, IDepartmentCallEmailsRepository departmentCallEmailsRepository,
                           IGenericDataRepository <DepartmentCallPruning> departmentCallPruningRepository, ICacheProvider cacheProvider, IUsersService usersService,
                           IDepartmentSettingsService departmentSettingsService, IGenericDataRepository <UserProfile> userProfileRepository,
                           IEventAggregator eventAggregator, IIdentityRepository identityRepository)
 {
     _departmentRepository            = departmentRepository;
     _departmentMembersRepository     = departmentMembersRepository;
     _subscriptionsService            = subscriptionsService;
     _departmentCallEmailsRepository  = departmentCallEmailsRepository;
     _departmentCallPruningRepository = departmentCallPruningRepository;
     _cacheProvider             = cacheProvider;
     _usersService              = usersService;
     _departmentSettingsService = departmentSettingsService;
     _userProfileRepository     = userProfileRepository;
     _eventAggregator           = eventAggregator;
     _identityRepository        = identityRepository;
 }
示例#11
0
 public MappingController(IDepartmentSettingsService departmentSettingsService,
                          IGeoLocationProvider geoLocationProvider, ICallsService callsService,
                          IDepartmentsService departmentsService, IDepartmentGroupsService departmentGroupsService,
                          IActionLogsService actionLogsService, IUnitsService unitsService, IMappingService mappingService,
                          IKmlProvider kmlProvider, IPermissionsService permissionsService, IPersonnelRolesService personnelRolesService)
 {
     _departmentSettingsService = departmentSettingsService;
     _geoLocationProvider       = geoLocationProvider;
     _callsService            = callsService;
     _departmentsService      = departmentsService;
     _departmentGroupsService = departmentGroupsService;
     _actionLogsService       = actionLogsService;
     _unitsService            = unitsService;
     _mappingService          = mappingService;
     _kmlProvider             = kmlProvider;
     _permissionsService      = permissionsService;
     _personnelRolesService   = personnelRolesService;
 }
示例#12
0
 public PersonnelController(
     IUsersService usersService,
     IActionLogsService actionLogsService,
     IDepartmentsService departmentsService,
     IUserProfileService userProfileService,
     IUserStateService userStateService,
     IDepartmentGroupsService departmentGroupsService,
     IPersonnelRolesService personnelRolesService,
     IDepartmentSettingsService departmentSettingsService
     )
 {
     _usersService              = usersService;
     _actionLogsService         = actionLogsService;
     _departmentsService        = departmentsService;
     _userProfileService        = userProfileService;
     _userStateService          = userStateService;
     _departmentGroupsService   = departmentGroupsService;
     _personnelRolesService     = personnelRolesService;
     _departmentSettingsService = departmentSettingsService;
 }
示例#13
0
 public TwilioProviderController(IDepartmentSettingsService departmentSettingsService, INumbersService numbersService,
                                 ILimitsService limitsService, ICallsService callsService, IQueueService queueService, IDepartmentsService departmentsService,
                                 IUserProfileService userProfileService, ITextCommandService textCommandService, IActionLogsService actionLogsService,
                                 IUserStateService userStateService, ICommunicationService communicationService, IGeoLocationProvider geoLocationProvider,
                                 IDepartmentGroupsService departmentGroupsService, ICustomStateService customStateService, IUnitsService unitsService)
 {
     _departmentSettingsService = departmentSettingsService;
     _numbersService            = numbersService;
     _limitsService             = limitsService;
     _callsService            = callsService;
     _queueService            = queueService;
     _departmentsService      = departmentsService;
     _userProfileService      = userProfileService;
     _textCommandService      = textCommandService;
     _actionLogsService       = actionLogsService;
     _userStateService        = userStateService;
     _communicationService    = communicationService;
     _geoLocationProvider     = geoLocationProvider;
     _departmentGroupsService = departmentGroupsService;
     _customStateService      = customStateService;
     _unitsService            = unitsService;
 }
示例#14
0
        public void PopulateQueue()
        {
            if (!_isLocked)
            {
                _isLocked = true;

                _departmentsService        = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
                _notificationService       = Bootstrapper.GetKernel().Resolve <INotificationService>();
                _userProfileService        = Bootstrapper.GetKernel().Resolve <IUserProfileService>();
                _departmentSettingsService = Bootstrapper.GetKernel().Resolve <IDepartmentSettingsService>();

                var t1 = new Task(() =>
                {
                    try
                    {
                        var allNotifications = _notificationService.GetAll();
                        var items            = new List <ProcessedNotification>();

                        BrokeredMessage message = null;
                        while (message != null)
                        {
                            try
                            {
                                var item = new ProcessedNotification();

                                if (message.Properties["DepartmentId"] != null)
                                {
                                    item.DepartmentId = int.Parse(message.Properties["DepartmentId"].ToString());
                                }

                                if (message.Properties["Type"] != null)
                                {
                                    item.Type = (EventTypes)message.Properties["Type"];
                                }

                                if (message.Properties["Value"] != null)
                                {
                                    item.Value = message.Properties["Value"].ToString();
                                }

                                item.MessageId = message.MessageId;

                                try
                                {
                                    item.Data = message.GetBody <string>();
                                    items.Add(item);

                                    // Remove message from subscription
                                    message.Complete();
                                }
                                catch (InvalidOperationException)
                                {
                                    message.Complete();
                                }
                            }
                            catch (Exception ex)
                            {
                                Logging.LogException(ex);

                                // Indicate a problem, unlock message in subscription
                                message.Abandon();
                            }
                        }

                        var groupedItems = from i in items
                                           group i by i.DepartmentId
                                           into itemGroup
                                           orderby itemGroup.Key
                                           select itemGroup;

                        foreach (var group in groupedItems)
                        {
                            var queueItem                  = new NotificationQueueItem();
                            queueItem.Department           = _departmentsService.GetDepartmentById(group.Key, false);
                            queueItem.DepartmentTextNumber = _departmentSettingsService.GetTextToCallNumberForDepartment(group.Key);
                            queueItem.NotificationSettings = allNotifications.Where(x => x.DepartmentId == group.Key).ToList();
                            queueItem.Notifications        = group.ToList();
                            queueItem.Profiles             = _userProfileService.GetAllProfilesForDepartment(group.Key);

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

                        _departmentsService        = null;
                        _notificationService       = null;
                        _userProfileService        = null;
                        _departmentSettingsService = null;
                    }
                });

                t1.Start();
            }
        }
示例#15
0
 public QueueService(IGenericDataRepository <QueueItem> queueItemsRepository, IOutboundQueueProvider outboundQueueProvider, IDepartmentSettingsService departmentSettingsService,
                     IDepartmentsService departmentsService, IGeoLocationProvider geoLocationProvider)
 {
     _queueItemsRepository      = queueItemsRepository;
     _outboundQueueProvider     = outboundQueueProvider;
     _departmentSettingsService = departmentSettingsService;
     _departmentsService        = departmentsService;
     _geoLocationProvider       = geoLocationProvider;
 }
示例#16
0
        public async Task <Tuple <bool, string> > Process(CallEmailQueueItem item)
        {
            bool   success = true;
            string result  = "";

            _callEmailProvider = Bootstrapper.GetKernel().Resolve <ICallEmailProvider>();

            if (!String.IsNullOrWhiteSpace(item?.EmailSettings?.Hostname))
            {
                CallEmailsResult emailResult = _callEmailProvider.GetAllCallEmailsFromServer(item.EmailSettings);

                if (emailResult?.Emails != null && emailResult.Emails.Count > 0)
                {
                    var calls = new List <Call>();

                    _callsService              = Bootstrapper.GetKernel().Resolve <ICallsService>();
                    _queueService              = Bootstrapper.GetKernel().Resolve <IQueueService>();
                    _departmentsService        = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
                    _userProfileService        = Bootstrapper.GetKernel().Resolve <IUserProfileService>();
                    _departmentSettingsService = Bootstrapper.GetKernel().Resolve <IDepartmentSettingsService>();
                    _unitsService              = Bootstrapper.GetKernel().Resolve <IUnitsService>();

                    // Ran into an issue where the department users didn't come back. We can't put the email back in the POP
                    // email box so just added some simple retry logic here.
                    List <IdentityUser> departmentUsers = await _departmentsService.GetAllUsersForDepartmentAsync(item.EmailSettings.DepartmentId, true);

                    var profiles = await _userProfileService.GetAllProfilesForDepartmentAsync(item.EmailSettings.DepartmentId);

                    int retry = 0;
                    while (retry < 3 && departmentUsers == null)
                    {
                        Thread.Sleep(150);
                        departmentUsers = await _departmentsService.GetAllUsersForDepartmentAsync(item.EmailSettings.DepartmentId, true);

                        retry++;
                    }

                    foreach (var email in emailResult.Emails)
                    {
                        var activeCalls = await _callsService.GetActiveCallsByDepartmentAsync(item.EmailSettings.Department.DepartmentId);

                        var units = await _unitsService.GetUnitsForDepartmentAsync(item.EmailSettings.Department.DepartmentId);

                        var priorities = await _callsService.GetActiveCallPrioritiesForDepartmentAsync(item.EmailSettings.Department.DepartmentId);

                        int defaultPriority = (int)CallPriority.High;

                        if (priorities != null && priorities.Any())
                        {
                            var defaultPrio = priorities.FirstOrDefault(x => x.IsDefault && x.IsDeleted == false);

                            if (defaultPrio != null)
                            {
                                defaultPriority = defaultPrio.DepartmentCallPriorityId;
                            }
                        }

                        var call = _callsService.GenerateCallFromEmail(item.EmailSettings.FormatType, email,
                                                                       item.EmailSettings.Department.ManagingUserId, departmentUsers, item.EmailSettings.Department, activeCalls, units, defaultPriority, priorities);

                        if (call != null)
                        {
                            call.DepartmentId = item.EmailSettings.DepartmentId;

                            if (!calls.Any(x => x.Name == call.Name && x.NatureOfCall == call.NatureOfCall))
                            {
                                calls.Add(call);
                            }
                        }
                    }

                    if (calls.Any())
                    {
                        var departmentTextNumber = await _departmentSettingsService.GetTextToCallNumberForDepartmentAsync(item.EmailSettings.DepartmentId);

                        foreach (var call in calls)
                        {
                            try
                            {
                                // Adding this in here to try and fix the error below with ObjectContext issues.
                                var newCall = CreateNewCallFromCall(call);

                                if (newCall.Dispatches != null && newCall.Dispatches.Any())
                                {
                                    // We've been having this error here:
                                    //      The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects.
                                    // So I'm wrapping this in a try catch to prevent all calls form being dropped.
                                    var savedCall = await _callsService.SaveCallAsync(newCall);

                                    var cqi = new CallQueueItem();
                                    cqi.Call = savedCall;

                                    cqi.Profiles             = profiles.Values.ToList();
                                    cqi.DepartmentTextNumber = departmentTextNumber;

                                    await _queueService.EnqueueCallBroadcastAsync(cqi);
                                }
                            }
                            catch (Exception ex)
                            {
                                result = ex.ToString();
                                Logging.LogException(ex);
                            }
                        }
                    }

                    await _departmentsService.SaveDepartmentEmailSettingsAsync(emailResult.EmailSettings);

                    _callsService              = null;
                    _queueService              = null;
                    _departmentsService        = null;
                    _callEmailProvider         = null;
                    _userProfileService        = null;
                    _departmentSettingsService = null;
                }
            }

            return(new Tuple <bool, string>(success, result));
        }
示例#17
0
 public DepartmentStatusController(IDepartmentSettingsService departmentSettingsService, IDepartmentsService departmentsService)
 {
     _departmentSettingsService = departmentSettingsService;
     _departmentsService        = departmentsService;
 }
示例#18
0
 public ShiftNotifierLogic()
 {
     _shiftsService             = Bootstrapper.GetKernel().Resolve <IShiftsService>();
     _communicationService      = Bootstrapper.GetKernel().Resolve <ICommunicationService>();
     _departmentSettingsService = Bootstrapper.GetKernel().Resolve <IDepartmentSettingsService>();
 }
示例#19
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;
 }
示例#20
0
 public FeedsController(IDepartmentsService departmentsService, IDepartmentSettingsService departmentSettingsService, ICallsService callsService)
 {
     _departmentsService        = departmentsService;
     _departmentSettingsService = departmentSettingsService;
     _callsService = callsService;
 }