本文整理汇总了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);
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
}
}