本文整理汇总了C#中ActionData.GetAsBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# ActionData.GetAsBoolean方法的具体用法?C# ActionData.GetAsBoolean怎么用?C# ActionData.GetAsBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionData
的用法示例。
在下文中一共展示了ActionData.GetAsBoolean方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
}
示例2: 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);
}
}
示例3: 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));
}
}
}
示例4: Process
public override void Process(ActionData actionData)
{
_emailService.SendEMailAsync(actionData.GetAsString("SMTPServer"),
actionData.GetAsString("SMTPUser"),
actionData.GetAsString("SMTPPassword"),
actionData.GetAsInteger("SMTPPort"),
actionData.GetAsString("ToEMailAddress"),
actionData.GetAsString("CCEmailAddresses"),
actionData.GetAsString("FromEMailAddress"),
actionData.GetAsString("Subject"),
actionData.GetAsString("EMailMessage"),
actionData.GetAsString("FileName"),
actionData.GetAsBoolean("DeleteFile"),
actionData.GetAsBoolean("BypassSslErrors"));
}
示例5: 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;
}
}
示例6: 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;
}
}
}
}
示例7: 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();
}
}
示例8: Process
public override void Process(ActionData actionData)
{
var ticket = actionData.GetDataValue<Ticket>("Ticket");
var pjName = actionData.GetAsString("PrintJobName");
if (!string.IsNullOrEmpty(pjName))
{
var j = _cacheService.GetPrintJobByName(pjName);
if (j != null)
{
var copies = actionData.GetAsInteger("Copies");
var printTicket = actionData.GetAsBoolean("PrintTicket", true);
var priority = actionData.GetAsBoolean("HighPriority");
if (ticket != null && printTicket)
{
var orderTagName = actionData.GetAsString("OrderTagName");
var orderTagValue = actionData.GetAsString("OrderTagValue");
var orderStateName = actionData.GetAsString("OrderStateName");
var orderState = actionData.GetAsString("OrderState");
var orderStateValue = actionData.GetAsString("OrderStateValue");
Expression<Func<Order, bool>> expression = ex => true;
if (!string.IsNullOrWhiteSpace(orderTagName))
{
expression =
ex => ex.OrderTagExists(y => y.TagName == orderTagName && y.TagValue == orderTagValue);
}
if (!string.IsNullOrWhiteSpace(orderStateName))
{
expression = expression.And(ex => ex.IsInState(orderStateName, orderState));
if (!string.IsNullOrWhiteSpace(orderStateValue))
expression = expression.And(ex => ex.IsAnyStateValue(orderStateValue));
}
_ticketService.UpdateTicketNumber(ticket, _applicationState.CurrentTicketType.TicketNumerator);
ExecuteByCopies(copies, () => _printerService.PrintTicket(ticket, j, expression.Compile(), priority));
}
else
{
ExecuteByCopies(copies, () => _printerService.ExecutePrintJob(j, priority));
}
}
}
}