本文整理汇总了C#中Samba.Domain.Models.Tickets.Ticket.UpdateResource方法的典型用法代码示例。如果您正苦于以下问题:C# Ticket.UpdateResource方法的具体用法?C# Ticket.UpdateResource怎么用?C# Ticket.UpdateResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Samba.Domain.Models.Tickets.Ticket
的用法示例。
在下文中一共展示了Ticket.UpdateResource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateResource
public void UpdateResource(Ticket ticket, int resourceTypeId, int resourceId, string resourceName, int accountId, string resourceCustomData)
{
var currentResource = ticket.TicketResources.SingleOrDefault(x => x.ResourceTypeId == resourceTypeId);
var currentResourceId = currentResource != null ? currentResource.ResourceId : 0;
var newResourceName = resourceName;
var oldResourceName = currentResource != null ? currentResource.ResourceName : "";
if (currentResource != null && currentResource.ResourceId != resourceId)
{
var resourceType = _cacheService.GetResourceTypeById(currentResource.ResourceTypeId);
_automationService.NotifyEvent(RuleEventNames.ResourceUpdated, new
{
currentResource.ResourceTypeId,
currentResource.ResourceId,
ResourceTypeName = resourceType.Name,
OpenTicketCount = GetOpenTicketIds(currentResource.ResourceId).Count() - (ticket.Id > 0 ? 1 : 0)
});
}
ticket.UpdateResource(resourceTypeId, resourceId, resourceName, accountId, resourceCustomData);
if (currentResourceId != resourceId)
{
var resourceType = _cacheService.GetResourceTypeById(resourceTypeId);
_automationService.NotifyEvent(RuleEventNames.TicketResourceChanged,
new
{
Ticket = ticket,
ResourceTypeId = resourceTypeId,
ResourceId = resourceId,
ResourceTypeName = resourceType.Name,
OldResourceName = oldResourceName,
NewResourceName = newResourceName,
OrderCount = ticket.Orders.Count
});
}
}