本文整理汇总了C#中ActionData类的典型用法代码示例。如果您正苦于以下问题:C# ActionData类的具体用法?C# ActionData怎么用?C# ActionData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionData类属于命名空间,在下文中一共展示了ActionData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 priceTag = actionData.GetAsString("PriceTag");
var departmentName = actionData.GetAsString("DepartmentName");
_departmentService.UpdatePriceTag(departmentName, priceTag);
_methodQueue.Queue("ResetCache", () => Helper.ResetCache(_triggerService, _applicationState));
}
示例3: 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;
}
示例4: IsTheSame
public static bool IsTheSame(ActionData a , ActionData b)
{
return a.gameObjectsNames == b.gameObjectsNames
&& a.gameObjects == b.gameObjects
&& a.strings == b.strings
&& a.strings == b.strings;
}
示例5: Process
public override void Process(ActionData actionData)
{
var fileName = actionData.GetAsString("FileName");
var arguments = actionData.GetAsString("Arguments");
if (!string.IsNullOrEmpty(fileName))
{
var psi = new ProcessStartInfo(fileName, arguments);
var isHidden = actionData.GetAsBoolean("IsHidden");
if (isHidden) psi.WindowStyle = ProcessWindowStyle.Hidden;
var useShellExecute = actionData.GetAsBoolean("UseShellExecute");
if (useShellExecute) psi.UseShellExecute = true;
var workingDirectory = actionData.GetAsString("WorkingDirectory");
if (!string.IsNullOrEmpty(workingDirectory))
psi.WorkingDirectory = workingDirectory;
try
{
System.Diagnostics.Process.Start(psi);
}
catch (Exception e)
{
_logService.LogError(e, string.Format("Start Process action [{0}] generated an error. See log file for details.", actionData.Action.Name));
}
}
}
示例6: Process
public override void Process(ActionData actionData)
{
var ticketId = actionData.GetAsInteger("TicketId");
var ticket = _ticketService.OpenTicket(ticketId);
actionData.DataObject.Ticket = ticket;
ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
}
示例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 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);
}
}
}
}
示例9: 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);
}
}
}
}
示例10: 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);
}
}
}
}
}
示例11: 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);
}
}
}
}
示例12: Process
public override void Process(ActionData actionData)
{
var entityTypeName = actionData.GetAsString("EntityTypeName");
var entityName = actionData.GetAsString("EntityName");
var createAccount = actionData.GetAsBoolean("CreateAccount");
var customData = actionData.GetAsString("CustomData");
if (!string.IsNullOrEmpty(entityTypeName) && !string.IsNullOrEmpty(entityName))
{
var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
var entity = _entityService.CreateEntity(entityType.Id, entityName);
if (customData.Contains(":"))
{
foreach (var parts in customData.Split('#').Select(data => data.Split('=')))
entity.SetCustomData(parts[0], parts[1]);
}
if (createAccount)
{
var accountName = entityType.GenerateAccountName(entity);
var accountId = _accountService.CreateAccount(entityType.AccountTypeId, accountName);
entity.AccountId = accountId;
actionData.DataObject.AccountName = accountName;
}
_entityService.SaveEntity(entity);
actionData.DataObject.EntityName = entity.Name;
}
}
示例13: NotifyEvent
public void NotifyEvent(string eventName, object dataParameter, int terminalId, int departmentId, int userRoleId, int ticketTypeId, Action<ActionData> dataAction)
{
var dataObject = dataParameter.ToDynamic();
_settingService.ClearSettingCache();
var rules = _cacheService.GetAppRules(eventName, terminalId, departmentId, userRoleId, ticketTypeId);
foreach (var rule in rules.Where(x => string.IsNullOrEmpty(x.EventConstraints) || SatisfiesConditions(x, dataObject)))
{
if (!CanExecuteRule(rule, dataObject)) continue;
foreach (var actionContainer in rule.Actions.OrderBy(x => x.SortOrder).Where(x => CanExecuteAction(x, dataObject)))
{
var container = actionContainer;
var action = _cacheService.GetActions().Single(x => x.Id == container.AppActionId);
var clonedAction = ObjectCloner.Clone(action);
var containerParameterValues = container.ParameterValues ?? "";
_settingService.ClearSettingCache();
clonedAction.Parameter = _settingService.ReplaceSettingValues(clonedAction.Parameter);
containerParameterValues = _settingService.ReplaceSettingValues(containerParameterValues);
containerParameterValues = ReplaceParameterValues(containerParameterValues, dataObject);
clonedAction.Parameter = _expressionService.ReplaceExpressionValues(clonedAction.Parameter, dataObject);
containerParameterValues = _expressionService.ReplaceExpressionValues(containerParameterValues, dataObject);
var data = new ActionData { Action = clonedAction, DataObject = dataObject, ParameterValues = containerParameterValues };
dataAction.Invoke(data);
}
}
}
示例14: 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();
}
}
示例15: Execute
/// <summary>
/// Execute the action.
/// </summary>
/// <param name="obj">The object executing the action.</param>
public override void Execute(GameObject obj, ActionData data = new ActionData())
{
if (moveOther) {
obj.transform.position = pos;
} else {
gameObject.transform.position = pos;
}
}