/// <summary> /// Get work list item from k2. /// </summary> /// <param name="fromUser">The allocated user.</param> /// <returns></returns> public List <TaskViewModel> GetWorkList(string fromUser, int retry = 0) { List <TaskViewModel> result = new List <TaskViewModel>(); Policy.Handle <Exception>() .WaitAndRetry(2, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (exception, timeSpan, retryCount, context) => { this.ReConnection(); }).Execute(() => { var processFolder = ConfigurationManager.AppSettings[ConstantValueService.K2_PROCESSFODLER]; Worklist taskList; WorklistCriteria worklistCriteria = new WorklistCriteria(); worklistCriteria.AddFilterField(0, WCCompare.NotEqual, 2); worklistCriteria.AddFilterField(WCField.ProcessFolder, WCCompare.Equal, processFolder); //For Share Worklist Items worklistCriteria.AddFilterField(WCLogical.AndBracket, WCField.WorklistItemOwner, WCWorklistItemOwner.Me.ToString(), WCCompare.Equal, 0); worklistCriteria.AddFilterField(WCLogical.Or, WCField.WorklistItemOwner, WCWorklistItemOwner.Other.ToString(), WCCompare.Equal, 0); taskList = _connection.OpenWorklist(worklistCriteria); result = this.ConvertTaskList(taskList); if (!string.IsNullOrEmpty(fromUser)) { var formUserK2Format = ConstantValueService.K2_PREFIX + fromUser; result = result.Where(m => string.Equals(m.AllocatedUser, formUserK2Format, StringComparison.OrdinalIgnoreCase)).ToList(); } }); return(result); }