private void OnEndOfDayExecute(string obj)
 {
     _automationService.NotifyEvent(RuleEventNames.BeforeWorkPeriodEnds, new { WorkPeriod = _applicationState.CurrentWorkPeriod });
     _workPeriodService.StopWorkPeriod(EndDescription);
     Refresh();
     _applicationState.CurrentWorkPeriod.PublishEvent(EventTopicNames.WorkPeriodStatusChanged);
     _automationService.NotifyEvent(RuleEventNames.WorkPeriodEnds, new { WorkPeriod = _applicationState.CurrentWorkPeriod });
     InteractionService.UserIntraction.GiveFeedback(Resources.WorkPeriodEndsMessage);
     EventServiceFactory.EventService.PublishEvent(EventTopicNames.ActivateNavigation);
 }
Beispiel #2
0
        public User LoginUser(string pinValue)
        {
            Debug.Assert(_applicationState.CurrentLoggedInUser == User.Nobody);
            var user = CheckPinCodeStatus(pinValue) == LoginStatus.CanLogin ? GetUserByPinCode(pinValue) : User.Nobody;

            _applicationStateSetter.SetCurrentLoggedInUser(user);
            Reset();
            if (user != User.Nobody)
            {
                user.PublishEvent(EventTopicNames.UserLoggedIn);
                _automationService.NotifyEvent(RuleEventNames.UserLoggedIn, new { User = user, RoleName = user.UserRole.Name });
            }
            return(user);
        }
Beispiel #3
0
 private static void RegisterNotifiers()
 {
     EventServiceFactory.EventService.GetEvent <GenericEvent <Message> >().Subscribe(x =>
     {
         if (x.Topic == EventTopicNames.MessageReceivedEvent && x.Value.Command == "ActionMessage")
         {
             AutomationService.NotifyEvent(RuleEventNames.MessageReceived, new { Command = x.Value.Data });
         }
     });
 }
Beispiel #4
0
 private void OnCronTrigger(object sender, CronEventArgs e)
 {
     using (var workspace = WorkspaceFactory.Create())
     {
         var trigger = workspace.Single <Trigger>(x => x.Id == ((Trigger)e.CronObject.Object).Id);
         if (trigger != null)
         {
             trigger.LastTrigger = DateTime.Now;
             workspace.CommitChanges();
             if (_applicationState.ActiveAppScreen != AppScreens.Dashboard)
             {
                 _automationService.NotifyEvent(RuleEventNames.TriggerExecuted, new { TriggerName = trigger.Name });
             }
         }
         else
         {
             e.CronObject.Stop();
         }
     }
 }
        public NavigationModule(IRegionManager regionManager, NavigationView navigationView, IUserService userService,
            IAutomationService automationService)
            : base(regionManager, AppScreens.Navigation)
        {
            _regionManager = regionManager;
            _navigationView = navigationView;
            _userService = userService;
            _automationService = automationService;

            PermissionRegistry.RegisterPermission(PermissionNames.OpenNavigation, PermissionCategories.Navigation, Resources.CanOpenNavigation);

            EventServiceFactory.EventService.GetEvent<GenericEvent<User>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.UserLoggedIn)
                        ActivateNavigation();
                });

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.ActivateNavigation)
                        ActivateNavigation();
                });

            EventServiceFactory.EventService.GetEvent<GenericEvent<AppScreenChangeData>>().Subscribe(
                x =>
                {
                    if (x.Topic == EventTopicNames.Changed)
                    {
                        _automationService.NotifyEvent(RuleEventNames.ApplicationScreenChanged,
                            new
                                {
                                    PreviousScreen = Enum.GetName(typeof(AppScreens), x.Value.PreviousScreen),
                                    CurrentScreen = Enum.GetName(typeof(AppScreens), x.Value.CurrentScreen)
                                });
                    }
                });
        }
Beispiel #6
0
 private void OnExecuteAutomationCommand(AutomationCommandData obj)
 {
     _automationService.NotifyEvent(RuleEventNames.AutomationCommandExecuted, new { Ticket = SelectedTicket, AutomationCommandName = obj.AutomationCommand.Name });
 }
Beispiel #7
0
 public void UpdateAccount(Ticket ticket, Account account)
 {
     Debug.Assert(ticket != null);
     if (account == Account.Null)
     {
         var template = Dao.Single <AccountTransactionType>(
             x => x.Id == _applicationState.CurrentDepartment.TicketTemplate.SaleTransactionType.Id);
         account = _cacheService.GetAccountById(template.DefaultTargetAccountId);
     }
     ticket.UpdateAccount(account, GetExchangeRate(account));
     _automationService.NotifyEvent(RuleEventNames.AccountSelectedForTicket,
                                    new
     {
         Ticket      = ticket,
         AccountName = account.Name,
     });
 }
Beispiel #8
0
 private void OnExecuteAutomationCommand(CommandContainerButton obj)
 {
     obj.NextValue();
     _automationService.NotifyEvent(RuleEventNames.AutomationCommandExecuted, new { Ticket = SelectedTicket, AutomationCommandName = obj.Name, Value = obj.SelectedValue });
 }
Beispiel #9
0
 private void OnItemClicked(AutomationButtonWidgetViewModel obj)
 {
     _automationService.NotifyEvent(RuleEventNames.AutomationCommandExecuted, new { AutomationCommandName = obj.Settings.CommandName });
 }