当前位置: 首页>>代码示例>>C#>>正文


C# ActionData.GetAsDecimal方法代码示例

本文整理汇总了C#中ActionData.GetAsDecimal方法的典型用法代码示例。如果您正苦于以下问题:C# ActionData.GetAsDecimal方法的具体用法?C# ActionData.GetAsDecimal怎么用?C# ActionData.GetAsDecimal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActionData的用法示例。


在下文中一共展示了ActionData.GetAsDecimal方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName = actionData.GetAsString("PortionName");
                var quantity = actionData.GetAsDecimal("Quantity");
                var tag = actionData.GetAsString("Tag");
                var orderStateName = actionData.GetAsString("OrderStateName");
                var orderState = actionData.GetAsString("OrderState");

                var osv = orderState.Contains("=") ? orderState : orderStateName + "=" + orderState;
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName, osv);

                if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                    order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                    order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                    order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                    order.Locked = actionData.GetAsBoolean("Locked");
                if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                    order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");

                if (order != null) order.Tag = tag;
                actionData.DataObject.Order = order;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
开发者ID:savasl,项目名称:SambaPOS-3,代码行数:33,代码来源:AddOrder.cs

示例2: Process

        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);
            if (orders.Any())
            {
                foreach (var order in orders)
                {
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Quantity")))
                        order.Quantity = actionData.GetAsDecimal("Quantity");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                        order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                        order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                        order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                        order.Locked = actionData.GetAsBoolean("Locked");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                        order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("AccountTransactionType")))
                        _ticketService.ChangeOrdersAccountTransactionTypeId(ticket, new List<Order> { order },
                                                                           _cacheService.GetAccountTransactionTypeIdByName
                                                                               (actionData.GetAsString("AccountTransactionType")));

                    if (!string.IsNullOrEmpty(actionData.GetAsString("PortionName")) || !string.IsNullOrEmpty(actionData.GetAsString("PriceTag")))
                    {
                        var portionName = actionData.GetAsString("PortionName");
                        var priceTag = actionData.GetAsString("PriceTag");
                        _ticketService.UpdateOrderPrice(order, portionName, priceTag);
                    }
                }
            }
        }
开发者ID:khriza,项目名称:SambaPOS-3,代码行数:34,代码来源:UpdateOrder.cs

示例3: Process

        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);
            if (orders.Any())
            {
                var tagName = actionData.GetAsString("OrderTagName");
                var orderTag = _cacheService.GetOrderTagGroupByName(tagName);

                if (orderTag != null)
                {
                    var tagValue = actionData.GetAsString("OrderTagValue");
                    var oldTagValue = actionData.GetAsString("OldOrderTagValue");
                    var tagNote = actionData.GetAsString("OrderTagNote");
                    var orderTagValue = orderTag.OrderTags.SingleOrDefault(y => y.Name == tagValue);

                    if (orderTagValue != null)
                    {
                        if (!string.IsNullOrEmpty(actionData.GetAsString("OrderTagPrice")))
                        {
                            var price = actionData.GetAsDecimal("OrderTagPrice");
                            orderTagValue.Price = price;
                        }

                        if (!string.IsNullOrEmpty(oldTagValue))
                            orders = orders.Where(o => o.OrderTagExists(y => y.OrderTagGroupId == orderTag.Id && y.TagValue == oldTagValue)).ToList();
                        if (actionData.Action.ActionType == ActionNames.TagOrder)
                            _ticketService.TagOrders(ticket, orders, orderTag, orderTagValue, tagNote);
                        if (actionData.Action.ActionType == ActionNames.UntagOrder)
                            _ticketService.UntagOrders(ticket, orders, orderTag, orderTagValue);
                    }
                }
            }
        }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:34,代码来源:OrderTagOperation.cs

示例4: Process

 public override void Process(ActionData actionData)
 {
     var documentName = actionData.GetAsString("AccountTransactionDocumentName");
     var documentType = _cacheService.GetAccountTransactionDocumentTypeByName(documentName);
     var accountName = actionData.GetAsString("AccountName");
     var description = actionData.GetAsString("Description");
     var amount = actionData.GetAsDecimal("Amount");
     if (amount > 0)
     {
         var account = _accountService.GetAccountByName(accountName);
         var document = _accountService.CreateTransactionDocument(account, documentType, description, amount, null);
         actionData.DataObject.DocumentId = document.Id;
     }
 }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:14,代码来源:CreateAccountTransactionDocument.cs

示例5: Process

 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         var calculationTypeName = actionData.GetAsString("CalculationType");
         var calculationType = _cacheService.GetCalculationTypeByName(calculationTypeName);
         if (calculationType != null)
         {
             var amount = actionData.GetAsDecimal("Amount");
             ticket.AddCalculation(calculationType, amount);
             _ticketService.RecalculateTicket(ticket);
             EventServiceFactory.EventService.PublishEvent(EventTopicNames.RegenerateSelectedTicket);
         }
     }
 }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:16,代码来源:UpdateTicketCalculation.cs

示例6: Process

        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName = actionData.GetAsString("PortionName");
                var quantity = actionData.GetAsDecimal("Quantity");
                var tag = actionData.GetAsString("Tag");
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName);
                if (order != null) order.Tag = tag;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
开发者ID:khriza,项目名称:SambaPOS-3,代码行数:16,代码来源:AddOrder.cs

示例7: Process

 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         var amount = actionData.GetAsDecimal("Amount");
         var transactionName = actionData.GetAsString("AccountTransactionTypeName");
         if (!string.IsNullOrEmpty(transactionName))
         {
             var accountTransactionType = _cacheService.GetAccountTransactionTypeByName(transactionName);
             if (accountTransactionType != null)
             {
                 var ts = ticket.TicketEntities.FirstOrDefault(x => _ticketService.CanMakeAccountTransaction(x, accountTransactionType, 0));
                 if (ts != null)
                 {
                     ticket.TransactionDocument.AddNewTransaction(accountTransactionType, ticket.GetTicketAccounts(), amount, 1);
                 }
             }
         }
     }
 }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:21,代码来源:CreateAccountTransaction.cs


注:本文中的ActionData.GetAsDecimal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。