本文整理汇总了C#中Actions.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Actions.Add方法的具体用法?C# Actions.Add怎么用?C# Actions.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actions
的用法示例。
在下文中一共展示了Actions.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTasksItems
public List<TasksItem> GetTasksItems(string k2User, int? page, int? pageSize, out int totalCount, string procInstID = null, string folio = null, DateTime? startDate = null, DateTime? endDate = null, string[] processNames = null, Dictionary<string, string> sorting = null)
{
k2User = K2User.ApplySecurityLabel(k2User);
totalCount = 0;
Client.WorklistCriteria filter = new Client.WorklistCriteria();
filter.Platform = "ASP";
filter.Count = (pageSize == null || pageSize <= 0) ? -1 : pageSize.Value;
filter.StartIndex = (page == null || page <= 0) ? 0 : (page.Value - 1) * filter.Count;
filter.AddFilterField(Client.WCField.WorklistItemStatus, Client.WCCompare.Equal, Client.WorklistStatus.Available);
filter.AddFilterField(Client.WCLogical.Or, Client.WCField.WorklistItemStatus, Client.WCCompare.Equal, Client.WorklistStatus.Open);
filter.AddFilterField(Client.WCLogical.And, Client.WCField.WorklistItemOwner, "Me", Client.WCCompare.Equal, Client.WCWorklistItemOwner.Me); //This will return all the user’s items
filter.AddFilterField(Client.WCLogical.Or, Client.WCField.WorklistItemOwner, "Other", Client.WCCompare.Equal, Client.WCWorklistItemOwner.Other); //This will return all the user’s shared items
if (startDate != null)
filter.AddFilterField(Client.WCLogical.And, Client.WCField.ProcessStartDate, Client.WCCompare.GreaterOrEqual, startDate);
if (endDate != null)
filter.AddFilterField(Client.WCLogical.And, Client.WCField.ProcessStartDate, Client.WCCompare.LessOrEqual, endDate);
if (!string.IsNullOrEmpty(folio))
filter.AddFilterField(Client.WCLogical.And, Client.WCField.ProcessFolio, Client.WCCompare.Like, string.Format("%{0}%", folio));
if (!string.IsNullOrEmpty(procInstID))
filter.AddFilterField(Client.WCLogical.And, Client.WCField.ProcessID, Client.WCCompare.Equal, procInstID);
if (processNames != null && processNames.Any())
{
int index = 0;
foreach (var processName in processNames)
{
index++;
if (index == 1)
filter.AddFilterField(Client.WCLogical.And, Client.WCField.ProcessFullName, Client.WCCompare.Equal, processName);
else
filter.AddFilterField(Client.WCLogical.Or, Client.WCField.ProcessFullName, Client.WCCompare.Equal, processName);
}
}
if (sorting == null || !sorting.Any())
filter.AddSortField(Client.WCField.EventStartDate, Client.WCSortOrder.Descending);
else
{
foreach (var field in sorting.Keys)
{
filter.AddSortField((Client.WCField)Enum.Parse(typeof(Client.WCField), field), (Client.WCSortOrder)Enum.Parse(typeof(Client.WCSortOrder), sorting[field]));
}
}
var worklit = Runtime.Worklist.OpenWorklist(_k2ConnectionString, k2User, new ArrayList(), filter, false, false, 0, null);
List<TasksItem> tasks = new List<TasksItem>();
foreach (Client.WorklistItem item in worklit)
{
Actions actions = new Actions();
foreach (Client.Action act in item.Actions)
{
var action = new ApproveAction();
action.Name = act.Name;
action.MetaData = act.MetaData;
actions.Add(action);
}
TasksItem task = new TasksItem()
{
ProcInstID = item.ProcessInstance.ID,
ActivityName = item.ActivityInstanceDestination.Name,
Destination = K2User.DelApplySecurityLabel(k2User),
Folio = item.ProcessInstance.Folio,
Originator = item.ProcessInstance.Originator.FQN,
//OriginatorDisName = item.ProcessInstance.Originator.DisplayName,
SN = item.SerialNumber,
StartDate = item.ProcessInstance.StartDate.ToString("yyyy-MM-dd HH:mm"),
SharedUser = item.AllocatedUser.Equals(k2User, StringComparison.OrdinalIgnoreCase) ? null : K2User.DelApplySecurityLabel(item.AllocatedUser), //判断是否SharedUser
Actions = actions
};
tasks.Add(task);
}
return tasks;
}