public List<WorklistItem> GetWorklistItem(string userName, int? page, int? pageSize, out int totalCount, string sn = null, string folio = null, DateTime? startDate = null, DateTime? endDate = null, string[] processNames = null, Dictionary<string, string> sorting = null)
        {
            var k2User = K2User.ApplySecurityLabel(userName);
            var worklistReader = new K2WorklistReader(ConfigurationManager.ConnectionStrings["K2DB"].ConnectionString);

            return worklistReader.GetWorklistItems(k2User, page, pageSize, out totalCount, sn, folio, startDate, endDate, processNames, sorting);
        }
        private IEnumerable<TasksItem> GetTasksItemsByPrototypeAPI(string userName, 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)
        {
            var k2User = K2User.ApplySecurityLabel(userName);
            var worklistReader = new K2WorklistReader(ConfigurationManager.ConnectionStrings["K2DB"].ConnectionString);

            var sort = new Dictionary<string, string>();

            if (sorting != null && sorting.Any())
            {
                foreach (var field in sorting.Keys)
                {
                    sort.Add(Enum.GetName(typeof(WLCField), field), Enum.GetName(typeof(WLCSortOrder), sorting[field]));
                }
            }

            return worklistReader.GetTasksItems(k2User, page, pageSize, out totalCount, procInstID, folio, startDate, endDate, processNames, sort);
        }