コード例 #1
0
ファイル: Migration_004.cs プロジェクト: GHLabs/SambaPOS-3
        public override void Up()
        {
            Create.Column("TaxFree").OnTable("OrderTagGroups").AsBoolean().WithDefaultValue(false);
            Create.Column("Added").OnTable("PeriodicConsumptionItems").AsDecimal().WithDefaultValue(0);
            Create.Column("Removed").OnTable("PeriodicConsumptionItems").AsDecimal().WithDefaultValue(0);
            Execute.Sql("Update PeriodicConsumptionItems set Added = Purchase");
            Delete.Column("Purchase").FromTable("PeriodicConsumptionItems");

            var dc = ApplicationContext as DbContext;

            if (dc != null)
            {
                var ticketPayingRule = dc.Set<AppRule>().SingleOrDefault(x => x.Name == "Ticket Paying Rule");
                if (ticketPayingRule != null)
                {
                    ticketPayingRule.Name = "Ticket Payment Check";
                    ticketPayingRule.EventName = "BeforeTicketClosing";
                    var markTicketAsClosed = new AppAction { ActionType = "MarkTicketAsClosed", Name = Resources.MarkTicketAsClosed, Parameter = "" };
                    dc.Set<AppAction>().Add(markTicketAsClosed);
                    dc.SaveChanges();
                    ticketPayingRule.Actions.Add(new ActionContainer(markTicketAsClosed));
                }
                dc.SaveChanges();
            }
        }
コード例 #2
0
 public ActionDataBuilder CreateFor(ActionContainer actionContainer)
 {
     _actionContainer = actionContainer;
     _action = ObjectCloner.Clone(_cacheService.GetActions().Single(x => x.Id == _actionContainer.AppActionId));
     _containerParameterValues = _actionContainer.ParameterValues ?? "";
     return this;
 }
コード例 #3
0
ファイル: Migration_015.cs プロジェクト: GHLabs/SambaPOS-3
        public override void Up()
        {
            var dc = ApplicationContext as DbContext;

            var closeTicketAutomation = new AutomationCommand { Name = Resources.CloseTicket, ButtonHeader = Resources.Close, SortOrder = -1, Color = "#FFFF0000",FontSize = 40};
            closeTicketAutomation.AutomationCommandMaps.Add(new AutomationCommandMap { EnabledStates = string.Format("{0},{1},{2},{3},IsClosed", Resources.New, Resources.NewOrders, Resources.Unpaid, Resources.Locked), VisibleStates = "*", DisplayUnderTicket = true });
            dc.Set<AutomationCommand>().Add(closeTicketAutomation);

            var settleAutomation = new AutomationCommand { Name = Resources.Settle, ButtonHeader = Resources.Settle, SortOrder = -2 ,FontSize = 40};
            settleAutomation.AutomationCommandMaps.Add(new AutomationCommandMap { EnabledStates = "*", VisibleStates = "*", DisplayUnderTicket = true });
            dc.Set<AutomationCommand>().Add(settleAutomation);

            dc.SaveChanges();

            var displayPaymentScreenAction = new AppAction { ActionType = ActionNames.DisplayPaymentScreen, Name = Resources.DisplayPaymentScreen, Parameter = "", SortOrder = -1 };
            dc.Set<AppAction>().Add(displayPaymentScreenAction);

            var closeTicketAction = dc.Set<AppAction>().FirstOrDefault(x => x.ActionType == ActionNames.CloseActiveTicket);

            if (closeTicketAction == null)
            {
                closeTicketAction = new AppAction { ActionType = ActionNames.CloseActiveTicket, Name = Resources.CloseTicket, Parameter = "", SortOrder = -1 };
                dc.Set<AppAction>().Add(closeTicketAction);
            }
            dc.SaveChanges();

            var closeTicketRule = new AppRule { Name = string.Format(Resources.Rule_f, Resources.CloseTicket), EventName = "AutomationCommandExecuted", EventConstraints = "AutomationCommandName;=;" + Resources.CloseTicket, SortOrder = -1 };
            closeTicketRule.Actions.Add(new ActionContainer(closeTicketAction));
            closeTicketRule.AddRuleMap();
            dc.Set<AppRule>().Add(closeTicketRule);

            var settleTicketRule = new AppRule { Name = string.Format(Resources.Rule_f, Resources.Settle), EventName = "AutomationCommandExecuted", EventConstraints = "AutomationCommandName;=;" + Resources.Settle, SortOrder = -1 };
            settleTicketRule.Actions.Add(new ActionContainer(displayPaymentScreenAction));
            settleTicketRule.AddRuleMap();
            dc.Set<AppRule>().Add(settleTicketRule);

            dc.SaveChanges();
        }
コード例 #4
0
 public ActionContainer(AppAction ruleAction)
 {
     AppActionId     = ruleAction.Id;
     Name            = ruleAction.Name;
     ParameterValues = "";
 }
コード例 #5
0
 public ActionContainer(AppAction ruleAction)
 {
     AppActionId = ruleAction.Id;
     Name = ruleAction.Name;
     ParameterValues = "";
 }