本文整理汇总了C#中ActionData.GetDataValue方法的典型用法代码示例。如果您正苦于以下问题:C# ActionData.GetDataValue方法的具体用法?C# ActionData.GetDataValue怎么用?C# ActionData.GetDataValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionData
的用法示例。
在下文中一共展示了ActionData.GetDataValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrders
public static IList<Order> GetOrders(ActionData x, Ticket ticket)
{
IList<Order> orders = new List<Order>();
var selectedOrder = x.GetDataValue<Order>("Order");
if (selectedOrder != null && ticket != null && selectedOrder.SelectedQuantity > 0 &&
selectedOrder.SelectedQuantity != selectedOrder.Quantity)
{
selectedOrder = ticket.ExtractSelectedOrder(selectedOrder);
x.DataObject.Order = selectedOrder;
}
if (selectedOrder == null)
{
if (ticket != null)
{
orders = ticket.Orders.Any(y => y.IsSelected)
? ticket.ExtractSelectedOrders().ToList()
: ticket.Orders;
x.DataObject.Order = null;
}
}
else orders.Add(selectedOrder);
return orders;
}
示例2: Process
public override void Process(ActionData actionData)
{
var entityId = actionData.GetDataValueAsInt("EntityId");
var entityTypeId = actionData.GetDataValueAsInt("EntityTypeId");
var stateName = actionData.GetAsString("EntityStateName");
var state = actionData.GetAsString("EntityState");
var quantityExp = actionData.GetAsString("QuantityExp");
if (state != null)
{
if (entityId > 0 && entityTypeId > 0)
{
_entityServiceClient.UpdateEntityState(entityId, entityTypeId, stateName, state, quantityExp);
}
else
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
var entityTypeName = actionData.GetAsString("EntityTypeName");
foreach (var ticketEntity in ticket.TicketEntities)
{
var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
_entityServiceClient.UpdateEntityState(ticketEntity.EntityId, ticketEntity.EntityTypeId, stateName, state, quantityExp);
}
}
}
}
}
示例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 entityId = actionData.GetDataValueAsInt("EntityId");
var entityName = actionData.GetAsString("EntityName");
var fieldName = actionData.GetAsString("FieldName");
var value = actionData.GetAsString("FieldValue");
if (entityId > 0)
{
_entityServiceClient.UpdateEntityData(entityId, fieldName, value);
}
else if (!string.IsNullOrEmpty(entityName))
{
var entityTypeName = actionData.GetAsString("EntityTypeName");
var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
if (entityType != null)
{
_entityServiceClient.UpdateEntityData(entityType, entityName, fieldName, value);
}
}
else
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
var entityTypeName = actionData.GetAsString("EntityTypeName");
foreach (var ticketEntity in ticket.TicketEntities)
{
var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
_entityServiceClient.UpdateEntityData(ticketEntity.EntityId, fieldName, value);
}
}
}
}
示例5: 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);
}
}
}
}
示例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 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);
}
}
示例7: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
var orderTagName = actionData.GetAsString("OrderTagName");
if (ticket != null && !string.IsNullOrEmpty(orderTagName))
{
var orderTagValue = actionData.GetAsString("OrderTagValue");
if (ticket.Orders.Any(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)))
{
var tid = ticket.Id;
EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested, true);
ticket = _ticketService.OpenTicket(tid);
var orders = ticket.Orders.Where(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)).ToArray();
var commitResult = _ticketService.MoveOrders(ticket, orders, 0);
if (string.IsNullOrEmpty(commitResult.ErrorMessage) && commitResult.TicketId > 0)
{
ExtensionMethods.PublishIdEvent(commitResult.TicketId, EventTopicNames.DisplayTicket);
}
else
{
ExtensionMethods.PublishIdEvent(tid, EventTopicNames.DisplayTicket);
}
}
}
}
示例8: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null && ticket != Ticket.Empty && CanCloseTicket(ticket))
{
EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested, true);
}
}
示例9: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null && ticket != Ticket.Empty && _ticketService.CanSettleTicket(ticket))
{
ticket.PublishEvent(EventTopicNames.MakePayment);
}
}
示例10: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
ticket.RequestLock();
}
}
示例11: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null && ticket.Orders.Count > 0)
{
actionData.DataObject.Order = ticket.Orders.Last();
}
}
示例12: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
CommonEventPublisher.EnqueueTicketEvent(EventTopicNames.SelectAutomationCommand);
}
}
示例13: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
ticket.StopActiveTimers();
}
}
示例14: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
ticket.PublishEvent(EventTopicNames.DisplayTicketLog);
}
}
示例15: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if ((ticket == null || ticket == Ticket.Empty) && actionData.GetAsBoolean("CanCreateTicket") && !_applicationState.IsLocked)
{
ticket = _ticketService.OpenTicket(0);
actionData.DataObject.Ticket = ticket;
ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
}
if (ticket != null)
{
var entityTypeName = actionData.GetAsString("EntityTypeName");
var entityName = actionData.GetAsString("EntityName");
var customDataSearchValue = actionData.GetAsString("EntitySearchValue");
var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
if (entityType != null)
{
if (string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
{
CommonEventPublisher.PublishEntityOperation(Entity.GetNullEntity(entityType.Id), EventTopicNames.SelectEntity, EventTopicNames.EntitySelected);
return;
}
Entity entity = null;
if (!string.IsNullOrEmpty(customDataSearchValue))
{
var entities = _entityService.SearchEntities(entityType,
customDataSearchValue,
null);
if (entities.Count == 1)
{
entity = entities.First();
}
}
if (entity == null)
{
entity = _cacheService.GetEntityByName(entityTypeName, entityName);
}
if (entity == null && string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
{
entity = Entity.GetNullEntity(entityType.Id);
}
if (entity != null)
{
_ticketService.UpdateEntity(ticket, entity);
actionData.DataObject.EntityName = entity.Name;
actionData.DataObject.EntityId = entity.Id;
actionData.DataObject.CustomData = entity.CustomData;
}
}
}
}