Пример #1
0
        public UserInteraction()
        {
            _popupDataViewModel = new PopupDataViewModel();

            RuleActionTypeRegistry.RegisterActionType("ShowMessage", Resources.ShowMessage, new { Message = "" });
            RuleActionTypeRegistry.RegisterActionType("DisplayPopup", Resources.DisplayPopup, new { Title = "", Message = "", Color = "" });

            EventServiceFactory.EventService.GetEvent <GenericEvent <ActionData> >().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "ShowMessage")
                {
                    var param = x.Value.GetAsString("Message");
                    if (!string.IsNullOrEmpty(param))
                    {
                        GiveFeedback(param);
                    }
                }

                if (x.Value.Action.ActionType == "DisplayPopup")
                {
                    var title   = x.Value.GetAsString("Title");
                    var message = x.Value.GetAsString("Message");
                    var color   = x.Value.GetAsString("Color");
                    color       = string.IsNullOrEmpty(color.Trim()) ? "DarkRed" : color;
                    if (!string.IsNullOrEmpty(message.Trim()))
                    {
                        DisplayPopup(title, message, null, "", color);
                    }
                }
            });
        }
Пример #2
0
 public AutomationService(IAutomationDao automationDao, IApplicationState applicationState, ISettingService settingService, IExpressionService expressionService)
 {
     _automationDao = automationDao;
     _applicationState = applicationState;
     _ruleActionTypeRegistry = new RuleActionTypeRegistry();
     _settingService = settingService;
     _expressionService = expressionService;
 }
Пример #3
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView)
        {
            _regionManager          = regionManager;
            _basicReportView        = basicReportView;
            _navigateReportsCommand = new CategoryCommand <string>(Resources.Reports, Resources.Common, "Images/Ppt.png", OnNavigateReportModule, CanNavigateReportModule)
            {
                Order = 80
            };

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            RuleActionTypeRegistry.RegisterActionType("SaveReportToFile", Resources.SaveReportToFile, new { ReportName = "", FileName = "" });
            RuleActionTypeRegistry.RegisterParameterSoruce("ReportName", () => ReportContext.Reports.Select(x => x.Header));

            EventServiceFactory.EventService.GetEvent <GenericEvent <ActionData> >().Subscribe(x =>
            {
                if (x.Value.Action.ActionType == "SaveReportToFile")
                {
                    var reportName = x.Value.GetAsString("ReportName");
                    var fileName   = x.Value.GetAsString("FileName");
                    if (!string.IsNullOrEmpty(reportName))
                    {
                        var report = ReportContext.Reports.Where(y => y.Header == reportName).FirstOrDefault();
                        if (report != null)
                        {
                            ReportContext.CurrentWorkPeriod = AppServices.MainDataContext.CurrentWorkPeriod;
                            var document = report.GetReportDocument();
                            try
                            {
                                ReportViewModelBase.SaveAsXps(fileName, document);
                            }
                            catch (Exception e)
                            {
                                AppServices.LogError(e);
                            }
                        }
                    }
                }
            });
        }
Пример #4
0
 private static void RegisterParameterSources()
 {
     RuleActionTypeRegistry.RegisterParameterSoruce("UserName", () => AppServices.MainDataContext.Users.Select(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("DepartmentName", () => AppServices.MainDataContext.Departments.Select(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("TerminalName", () => AppServices.Terminals.Select(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("TriggerName", () => Dao.Select <Trigger, string>(yz => yz.Name, y => !string.IsNullOrEmpty(y.Expression)));
     RuleActionTypeRegistry.RegisterParameterSoruce("MenuItemName", () => Dao.Select <MenuItem, string>(yz => yz.Name, y => y.Id > 0));
     RuleActionTypeRegistry.RegisterParameterSoruce("PriceTag", () => Dao.Select <MenuItemPriceDefinition, string>(x => x.PriceTag, x => x.Id > 0));
     RuleActionTypeRegistry.RegisterParameterSoruce("Color", () => typeof(Colors).GetProperties(BindingFlags.Public | BindingFlags.Static).Select(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("VatTemplate", () => Dao.Select <VatTemplate, string>(x => x.Name, x => x.Id > 0));
     RuleActionTypeRegistry.RegisterParameterSoruce("TaxServiceTemplate", () => Dao.Select <TaxServiceTemplate, string>(x => x.Name, x => x.Id > 0));
     RuleActionTypeRegistry.RegisterParameterSoruce("TagName", () => Dao.Select <TicketTagGroup, string>(x => x.Name, x => x.Id > 0));
     RuleActionTypeRegistry.RegisterParameterSoruce("PaymentType", () => new[] { Resources.Cash, Resources.CreditCard, Resources.Ticket });
     RuleActionTypeRegistry.RegisterParameterSoruce("PrintJobName", () => Dao.Distinct <PrintJob>(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("CustomerGroupCode", () => Dao.Distinct <Customer>(x => x.GroupCode));
     RuleActionTypeRegistry.RegisterParameterSoruce("MenuItemGroupCode", () => Dao.Distinct <MenuItem>(x => x.GroupCode));
     RuleActionTypeRegistry.RegisterParameterSoruce("UpdateType", () => new[] { Resources.Update, Resources.Increase, Resources.Decrease, "Toggle", "Multiply" });
     RuleActionTypeRegistry.RegisterParameterSoruce("GiftReason", () => Dao.Select <Reason, string>(x => x.Name, x => x.ReasonType == 1).Distinct());
     RuleActionTypeRegistry.RegisterParameterSoruce("PortionName", () => Dao.Distinct <MenuItemPortion>(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("ModifierGroupName", () => Dao.Distinct <MenuItemPropertyGroup>(x => x.Name));
     RuleActionTypeRegistry.RegisterParameterSoruce("TicketOperationType", () => new[] { Resources.Refresh, Resources.Close });
 }
Пример #5
0
 private static void RegisterRules()
 {
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.UserLoggedIn, Resources.UserLogin, new { UserName = "", RoleName = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.UserLoggedOut, Resources.UserLogout, new { UserName = "", RoleName = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.WorkPeriodStarts, Resources.WorkPeriodStarted, new { UserName = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.WorkPeriodEnds, Resources.WorkPeriodEnded, new { UserName = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TriggerExecuted, Resources.TriggerExecuted, new { TriggerName = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketCreated, Resources.TicketCreated);
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketLocationChanged, Resources.TicketLocationChanged, new { OldLocation = "", NewLocation = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketTagSelected, Resources.TicketTagSelected, new { TagName = "", TagValue = "", NumericValue = 0, TicketTag = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.CustomerSelectedForTicket, Resources.CustomerSelectedForTicket, new { CustomerId = 0, CustomerName = "", CustomerGroupCode = "", PhoneNumber = "", CustomerNote = "", LastOrderTotal = 0m, LastOrderDayCount = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketTotalChanged, Resources.TicketTotalChanged, new { TicketTotal = 0m, PreviousTotal = 0m, DiscountTotal = 0m, GiftTotal = 0m, DiscountAmount = 0m, TipAmount = 0m, CustomerName = "", CustomerGroupCode = "", CustomerId = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.MessageReceived, Resources.MessageReceived, new { Command = "" });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.PaymentReceived, Resources.PaymentReceived, new { PaymentType = "", Amount = 0, TicketTag = "", CustomerId = 0, CustomerName = "", CustomerGroupCode = "", SelectedLinesCount = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketLineAdded, Resources.LineAddedToTicket, new { TicketId = 0m, TicketTag = "", MenuItemName = "", Quantity = 0m, MenuItemGroupCode = "", CustomerName = "", CustomerGroupCode = "", CustomerId = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketLineCancelled, Resources.TicketLineCancelled, new { TicketTag = "", MenuItemName = "", Quantity = 0m, MenuItemGroupCode = "", CustomerName = "", CustomerGroupCode = "", CustomerId = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.PortionSelected, Resources.PortionSelected, new { TicketTag = "", MenuItemName = "", PortionName = "", PortionPrice = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.ModifierSelected, Resources.ModifierSelected, new { TicketTag = "", MenuItemName = "", ModifierGroupName = "", ModifierName = "", ModifierPrice = 0, ModifierQuantity = 0, IsRemoved = false, IsPriceAddedToParentPrice = false, TotalPropertyCount = 0, TotalModifierQuantity = 0m, TotalModifierPrice = 0m });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.ChangeAmountChanged, Resources.ChangeAmountUpdated, new { TicketAmount = 0, ChangeAmount = 0, TenderedAmount = 0 });
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketClosed, Resources.TicketClosed);
     RuleActionTypeRegistry.RegisterEvent(RuleEventNames.ApplicationStarted, Resources.ApplicationStarted, new { CommandLineArguments = "" });
 }
Пример #6
0
 private static void RegisterActions()
 {
     RuleActionTypeRegistry.RegisterActionType("SendEmail", Resources.SendEmail, new { SMTPServer = "", SMTPUser = "", SMTPPassword = "", SMTPPort = 0, ToEMailAddress = "", Subject = "", FromEMailAddress = "", EMailMessage = "", FileName = "", DeleteFile = false, BypassSslErrors = false });
     RuleActionTypeRegistry.RegisterActionType("AddTicketDiscount", Resources.AddTicketDiscount, new { DiscountPercentage = 0m });
     RuleActionTypeRegistry.RegisterActionType("AddTicketItem", Resources.AddTicketItem, new { MenuItemName = "", PortionName = "", Quantity = 0, Gift = false, GiftReason = "", Tag = "" });
     RuleActionTypeRegistry.RegisterActionType("GiftLastTicketItem", Resources.GiftLastTicketItem, new { GiftReason = "", Quantity = 0 });
     RuleActionTypeRegistry.RegisterActionType("UpdateLastTicketItemPriceTag", Resources.UpdateLastTicketItemPriceTag, new { PriceTag = "" });
     RuleActionTypeRegistry.RegisterActionType("UpdateTicketItemPriceTag", Resources.UpdateTicketItemPriceTag, new { PriceTag = "" });
     RuleActionTypeRegistry.RegisterActionType("UpdateTicketItemTag", Resources.UpdateTicketItemTag, new { Tag = "" });
     RuleActionTypeRegistry.RegisterActionType("VoidTicketItems", Resources.VoidTicketItems, new { MenuItemName = "", Tag = "" });
     RuleActionTypeRegistry.RegisterActionType("RemoveLastModifier", Resources.RemoveLastModifier);
     RuleActionTypeRegistry.RegisterActionType("UpdateTicketTag", Resources.UpdateTicketTag, new { TagName = "", TagValue = "" });
     RuleActionTypeRegistry.RegisterActionType("UpdatePriceTag", Resources.UpdatePriceTag, new { DepartmentName = "", PriceTag = "" });
     RuleActionTypeRegistry.RegisterActionType("RefreshCache", Resources.RefreshCache);
     RuleActionTypeRegistry.RegisterActionType("SendMessage", Resources.BroadcastMessage, new { Command = "" });
     RuleActionTypeRegistry.RegisterActionType("UpdateProgramSetting", Resources.UpdateProgramSetting, new { SettingName = "", SettingValue = "", UpdateType = Resources.Update, IsLocal = true });
     RuleActionTypeRegistry.RegisterActionType("ExecuteTicketEvent", Resources.ExecuteTicketOperation, new { TicketOperationType = "" });
     RuleActionTypeRegistry.RegisterActionType("UpdateTicketVat", Resources.UpdateTicketVat, new { VatTemplate = "" });
     RuleActionTypeRegistry.RegisterActionType("RegenerateTicketVat", Resources.RegenerateTicketVat);
     RuleActionTypeRegistry.RegisterActionType("UpdateTicketTaxService", Resources.UpdateTicketTaxService, new { TaxServiceTemplate = "", Amount = 0m });
     RuleActionTypeRegistry.RegisterActionType("UpdateTicketAccount", Resources.UpdateTicketAccount, new { AccountPhone = "", AccountName = "", Note = "" });
     RuleActionTypeRegistry.RegisterActionType("ExecutePrintJob", Resources.ExecutePrintJob, new { PrintJobName = "", TicketItemTag = "" });
     RuleActionTypeRegistry.RegisterActionType("UpdateApplicationSubTitle", "Update Application Subtitle", new { Title = "", Color = "White", FontSize = 12 });
 }
Пример #7
0
 public AutomationService()
 {
     _ruleActionTypeRegistry = new RuleActionTypeRegistry();
 }
Пример #8
0
 public AutomationService(IDeviceService deviceService, RuleActionTypeRegistry ruleActionTypeRegistry)
 {
     _deviceService = deviceService;
     _ruleActionTypeRegistry = ruleActionTypeRegistry;
 }
 public AutomationService(IDeviceService deviceService, RuleActionTypeRegistry ruleActionTypeRegistry)
 {
     _deviceService          = deviceService;
     _ruleActionTypeRegistry = ruleActionTypeRegistry;
 }
Пример #10
0
 public AutomationService(IApplicationState applicationState, ISettingService settingService)
 {
     _applicationState = applicationState;
     _ruleActionTypeRegistry = new RuleActionTypeRegistry();
     _settingService = settingService;
 }
Пример #11
0
        private ObservableCollection <ActionParameterValue> GetParameterValues()
        {
            IEnumerable <ActionParameterValue> result;

            if (!string.IsNullOrEmpty(_ruleViewModel.EventName))
            {
                if (string.IsNullOrEmpty(Model.ParameterValues))
                {
                    result = Regex.Matches(Action.Parameter, "\\[([^\\]]+)\\]")
                             .Cast <Match>()
                             .Select(match => new ActionParameterValue(this, match.Groups[1].Value, "", RuleActionTypeRegistry.GetParameterNames(_ruleViewModel.EventName)));
                }
                else
                {
                    result = Model.ParameterValues.Split('#').Select(
                        x => new ActionParameterValue(this, x.Split('=')[0], x.Split('=')[1], RuleActionTypeRegistry.GetParameterNames(_ruleViewModel.EventName)));
                }
            }
            else
            {
                result = new List <ActionParameterValue>();
            }

            return(new ObservableCollection <ActionParameterValue>(result));
        }