本文整理汇总了C#中ActionData.GetAsString方法的典型用法代码示例。如果您正苦于以下问题:C# ActionData.GetAsString方法的具体用法?C# ActionData.GetAsString怎么用?C# ActionData.GetAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionData
的用法示例。
在下文中一共展示了ActionData.GetAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
}
示例2: 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;
}
}
示例3: 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);
}
}
示例4: 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);
}
}
}
}
示例5: 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);
}
}
}
}
}
示例6: 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);
}
}
}
}
示例7: 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));
}
示例8: 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));
}
}
}
示例9: 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;
}
}
}
}
示例10: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
var tagName = actionData.GetAsString("TagName");
var tagValue = actionData.GetAsString("TagValue");
_ticketService.UpdateTag(ticket, tagName, tagValue);
}
}
示例11: Process
public override void Process(ActionData actionData)
{
var widgetName = actionData.GetAsString("WidgetName");
var value = actionData.GetAsString("Value");
if (!string.IsNullOrEmpty(widgetName) && !string.IsNullOrEmpty(value))
{
var data = new WidgetEventData { WidgetName = widgetName, Value = value };
data.PublishEvent(EventTopicNames.SetWidgetValue);
}
}
示例12: Process
public override void Process(ActionData actionData)
{
var settingName = actionData.GetAsString("SettingName");
var updateType = actionData.GetAsString("UpdateType");
if (!string.IsNullOrEmpty(settingName))
{
var isLocal = actionData.GetAsBoolean("IsLocal");
var setting = isLocal
? _settingService.ReadLocalSetting(settingName)
: _settingService.ReadGlobalSetting(settingName);
if (updateType == Resources.Increase)
{
var settingValue = actionData.GetAsInteger("SettingValue");
if (string.IsNullOrEmpty(setting.StringValue))
setting.IntegerValue = settingValue;
else
setting.IntegerValue = setting.IntegerValue + settingValue;
}
else if (updateType == Resources.Decrease)
{
var settingValue = actionData.GetAsInteger("SettingValue");
if (string.IsNullOrEmpty(setting.StringValue))
setting.IntegerValue = settingValue;
else
setting.IntegerValue = setting.IntegerValue - settingValue;
}
else if (updateType == Resources.Toggle)
{
var settingValue = actionData.GetAsString("SettingValue");
var parts = settingValue.Split(',');
if (string.IsNullOrEmpty(setting.StringValue))
{
setting.StringValue = parts[0];
}
else
{
for (var i = 0; i < parts.Length; i++)
{
if (parts[i] == setting.StringValue)
{
setting.StringValue = (i + 1) < parts.Length ? parts[i + 1] : parts[0];
break;
}
}
}
}
else
{
var settingValue = actionData.GetAsString("SettingValue");
setting.StringValue = settingValue;
}
if (!isLocal) _settingService.SaveProgramSettings();
}
}
示例13: Process
public override void Process(ActionData actionData)
{
var name = actionData.GetAsString("Name");
var values = actionData.GetAsString("Values");
if (!string.IsNullOrEmpty(values))
{
foreach (var value in values.Split(','))
{
_applicationState.NotifyEvent(RuleEventNames.ValueLooped, new { Name = name, Value = value });
}
}
}
示例14: Process
public override void Process(ActionData actionData)
{
if (actionData.Action.ActionType == "DisplayPopup")
{
var title = actionData.GetAsString("Title");
var message = actionData.GetAsString("Message");
var color = actionData.GetAsString("Color");
color = string.IsNullOrEmpty(color.Trim()) ? "DarkRed" : color;
if (!string.IsNullOrEmpty(message.Trim()))
_userInteraction.DisplayPopup(title, message, color);
}
}
示例15: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
if (ticket != null)
{
var category = actionData.GetAsString("Category");
var log = actionData.GetAsString("Log");
if (!string.IsNullOrEmpty(log))
{
ticket.AddLog(_applicationState.CurrentLoggedInUser.Name, category, log);
}
}
}