本文整理汇总了C#中Samba.Domain.Models.Tickets.Ticket.AddOrder方法的典型用法代码示例。如果您正苦于以下问题:C# Ticket.AddOrder方法的具体用法?C# Ticket.AddOrder怎么用?C# Ticket.AddOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Samba.Domain.Models.Tickets.Ticket
的用法示例。
在下文中一共展示了Ticket.AddOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOrder
public Order AddOrder(Ticket ticket, int menuItemId, decimal quantity, string portionName, OrderTagTemplate template)
{
if (ticket.IsLocked && !_userService.IsUserPermittedFor(PermissionNames.AddItemsToLockedTickets)) return null;
if (!ticket.CanSubmit) return null;
var menuItem = _cacheService.GetMenuItem(x => x.Id == menuItemId);
var portion = _cacheService.GetMenuItemPortion(menuItemId, portionName);
if (portion == null) return null;
var priceTag = _applicationState.CurrentDepartment.PriceTag;
var productTimer = _applicationState.GetProductTimer(menuItemId);
var order = ticket.AddOrder(
_applicationState.CurrentTicketType.SaleTransactionType,
_applicationState.CurrentDepartment.Model,
_applicationState.CurrentLoggedInUser.Name, menuItem,
_applicationState.GetTaxTemplates(menuItem.Id).ToList(), portion, priceTag, productTimer);
order.Quantity = quantity > 9 ? decimal.Round(quantity / portion.Multiplier, 3, MidpointRounding.AwayFromZero) : quantity;
if (template != null) template.OrderTagTemplateValues.ToList().ForEach(x => order.ToggleOrderTag(x.OrderTagGroup, x.OrderTag, 0, ""));
RecalculateTicket(ticket);
order.PublishEvent(EventTopicNames.OrderAdded);
_automationService.NotifyEvent(RuleEventNames.OrderAdded, new { Ticket = ticket, Order = order, order.MenuItemName });
return order;
}
示例2: AddOrder
public Order AddOrder(Ticket ticket, int menuItemId, decimal quantity, string portionName, string orderState)
{
if (ticket.IsLocked && !_userService.IsUserPermittedFor(PermissionNames.AddItemsToLockedTickets)) return null;
if (!ticket.CanSubmit) return null;
var menuItem = _cacheService.GetMenuItem(x => x.Id == menuItemId);
var portion = _cacheService.GetMenuItemPortion(menuItemId, portionName);
if (portion == null) return null;
var priceTag = _applicationState.CurrentDepartment.PriceTag;
var productTimer = _applicationState.GetProductTimer(menuItemId);
var order = ticket.AddOrder(
_applicationState.CurrentTicketType.SaleTransactionType,
_applicationState.CurrentDepartment.Model,
_applicationState.CurrentLoggedInUser.Name, menuItem,
_applicationState.GetTaxTemplates(menuItem.Id).ToList(), portion, priceTag, productTimer);
order.Quantity = quantity > 9 ? decimal.Round(quantity / portion.Multiplier, 3, MidpointRounding.AwayFromZero) : quantity;
order.ResetSelectedQuantity();
SetOrderState(order, orderState);
RecalculateTicket(ticket);
_applicationState.NotifyEvent(RuleEventNames.OrderAdded, new { Ticket = ticket, Order = order, MenuItemName = order.MenuItemName, MenuItemTag = menuItem.Tag, MenuItemGroupCode = menuItem.GroupCode });
return order;
}
示例3: AddOrderToTicket
private void AddOrderToTicket(Ticket ticket, IList<TaxTemplate> tax, decimal price, decimal quantity)
{
var order = ticket.AddOrder(TicketType.SaleTransactionType, Department.Default, "Emre", Product, tax, Product.Portions[0], "", null);
order.Price = price;
order.Quantity = quantity;
}