當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。