当前位置: 首页>>代码示例>>C#>>正文


C# Connection.OpenWorklist方法代码示例

本文整理汇总了C#中Connection.OpenWorklist方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.OpenWorklist方法的具体用法?C# Connection.OpenWorklist怎么用?C# Connection.OpenWorklist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection.OpenWorklist方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadWorkList

        public List<SA4Launcher.Models.WorklistItem> LoadWorkList()
        {
            Connection K2Conn = new Connection();
            SCConnectionStringBuilder K2ConnString = new SCConnectionStringBuilder();
            List<SA4Launcher.Models.WorklistItem> _currentWorkList = new List<SA4Launcher.Models.WorklistItem>();

            //Setup Connection String

            K2ConnString.Host = "Sa4DemoK2wAD";
            K2ConnString.Integrated = false;
            K2ConnString.UserID = "SA4Demo\\Tberry";
            K2ConnString.Password = "Sa42013!";
            K2ConnString.Port = 5252;
            K2ConnString.WindowsDomain = "Sa4Demo";
            K2ConnString.SecurityLabelName = "K2";
            K2ConnString.Authenticate = false;
            K2ConnString.IsPrimaryLogin = true;
            K2Conn.Open("Sa4DemoK2wAD", K2ConnString.ConnectionString.ToString());

            //TODO:  Need to add try loop with true false return
            Worklist K2WorkList = K2Conn.OpenWorklist();
            List<SA4Launcher.Models.Action> CurrentActions = new List<SA4Launcher.Models.Action>();

            if (K2WorkList != null)
            {
                _currentWorkList.Clear();
                foreach (SourceCode.Workflow.Client.WorklistItem K2worklistitem in K2WorkList)
                {
                    //Build Actions First
                    CurrentActions.Clear();
                    foreach (SourceCode.Workflow.Client.Action K2action in K2worklistitem.Actions)
                    {
                        CurrentActions.Add(new SA4Launcher.Models.Action
                        {
                            Name = K2action.Name,
                            Batchable = K2action.Batchable
                        });
                    }

                    //Load worklist items into model
                    _currentWorkList.Add(new SA4Launcher.Models.WorklistItem
                    {
                        ID = K2worklistitem.ID,
                        serialno = K2worklistitem.SerialNumber,
                        Name = K2worklistitem.ProcessInstance.Name,
                        UserName = K2worklistitem.AllocatedUser,
                        Folio = K2worklistitem.ProcessInstance.Folio,
                        StartDate = K2worklistitem.ProcessInstance.StartDate,
                        Status = K2worklistitem.Status.ToString(),
                        ViewFlow = K2worklistitem.ProcessInstance.ViewFlow,
                        Data = K2worklistitem.Data,
                        Priority = K2worklistitem.ProcessInstance.Priority,
                        Actions = CurrentActions.ToList()
                    });
                }
            }
            K2Conn.Close();
            return (_currentWorkList);
        }
开发者ID:jordanberry,项目名称:SA4Launcher,代码行数:59,代码来源:WorkListContext.cs

示例2: GetWorklistItems

        public Worklist GetWorklistItems(String searchTerm, Int32 skip, Int32 take, Dictionary<WCField, WCSortOrder> sorts, String impersonateUser)
        {
            using (var k2Connection = new Connection())
            {
                ConnectionSetup k2Setup = new ConnectionSetup();
                k2Setup.ConnectionString = Properties.Settings.Default.WorkflowServerConnectionString;

                k2Connection.Open(k2Setup);

                if (!String.IsNullOrEmpty(impersonateUser))
                    k2Connection.ImpersonateUser("K2:" + impersonateUser);

                var workCriteria = new WorklistCriteria { NoData = true, Platform = "ASP" };                                                
                                
                if (!string.IsNullOrEmpty(searchTerm))
                {
                    String searchTermFormat = String.Format("%{0}%", searchTerm);
                    //String searchTermFormat = String.Format("% / % / % / % / %{0}%", searchTerm);
                    workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null);           //  (
                    workCriteria.AddFilterField(WCField.ActivityName, WCCompare.Like, searchTermFormat);                //  ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.EventName, WCCompare.Like, searchTermFormat);     //  OR ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.ProcessFolio, WCCompare.Like, searchTermFormat);  //  OR ...
                    workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null);             //  )
                    //workCriteria.AddFilterField(WCField.ProcessFolio, WCCompare.Like, searchTermFormat);
                }

                //  No AND required - seems like bug - this bit gets put in a different bit of the query K2 creates.
                //  Hide allocated items like the SharePoint K2 worlist does by default.
                workCriteria.AddFilterField(WCField.WorklistItemStatus, WCCompare.NotEqual, WorklistStatus.Allocated);                 

                workCriteria.StartIndex = skip;
                workCriteria.Count = take;                
                
                foreach (KeyValuePair<WCField,WCSortOrder> sort in sorts)
                {
                    workCriteria.AddSortField(sort.Key, sort.Value);                                        
                }

                Worklist k2Worklist = k2Connection.OpenWorklist(workCriteria);      

                return k2Worklist;
            }
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:43,代码来源:WorkItemData.cs

示例3: GetWorklist

        private void GetWorklist()
        {
            ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();
            DataTable results = base.ServiceBroker.ServicePackage.ResultTable;

            using (Connection k2Con = new Connection())
            {
                k2Con.Open(base.K2ClientConnectionSetup);

                WorklistCriteria wc = new WorklistCriteria();
                wc.Platform = base.Platform;
                AddFieldFilters(wc);
                if (base.GetBoolProperty(Constants.SOProperties.ClientWorklist.IncludeShared) == true)
                {
                    wc.AddFilterField(WCLogical.Or, WCField.WorklistItemOwner, "Me", WCCompare.Equal, WCWorklistItemOwner.Me);
                    wc.AddFilterField(WCLogical.Or, WCField.WorklistItemOwner, "Other", WCCompare.Equal, WCWorklistItemOwner.Other);
                }
                if (base.GetBoolProperty(Constants.SOProperties.ClientWorklist.ExcludeAllocated) == true)
                {
                    wc.AddFilterField(WCLogical.And, WCField.WorklistItemStatus, WCCompare.NotEqual, WorklistStatus.Allocated);
                }
                Worklist wl = k2Con.OpenWorklist(wc);

                foreach (WorklistItem wli in wl)
                {
                    AddRowToDataTable(results, wli);
                }

                k2Con.Close();
            }
        }
开发者ID:panjkov,项目名称:K2NEServiceBroker,代码行数:32,代码来源:WorklistSO.cs

示例4: GetWorklistItems

        public DataTable GetWorklistItems(Dictionary<string, object> properties, Dictionary<string, object> parameters)
        {
            bool impersonate = false;
            string impersonateUser = "";
            ConnectionSetup connectSetup = new ConnectionSetup();
            connectSetup.ConnectionString = _connectionString;

            if (properties.ContainsKey("UserName"))
            {
                if (!(string.IsNullOrEmpty(properties["UserName"].ToString())))
                {
                    connectSetup.ConnectionString = _connectionstringImpersonate;
                    impersonateUser = properties["UserName"].ToString();
                    impersonate = true;
                }
                else
                    connectSetup.ConnectionString = _connectionString;
            }

            WorklistCriteria criteria = null;
            if (properties.Count > 0)
                criteria = GetWorklistCriteria(properties);

            Connection cnn = new Connection();
            try
            {
                cnn.Open(connectSetup);
                if (impersonate)
                    cnn.ImpersonateUser(impersonateUser);

                DataTable dt = GetResultTable();

                Worklist worklist;
                if ((criteria != null) && (criteria.Filters.GetLength(0) > 0))
                    worklist = cnn.OpenWorklist(criteria);
                else
                    worklist = cnn.OpenWorklist();
                foreach (WorklistItem item in worklist)
                {
                    DataRow row = dt.NewRow();
                    row["AllocatedUser"] = item.AllocatedUser;
                    row["Data"] = item.Data;
                    row["ID"] = item.ID;
                    row["Link"] = "<hyperlink><link>" + HttpUtility.HtmlEncode(item.Data) + "</link><display>Open</display></hyperlink>";
                    row["SerialNumber"] = item.SerialNumber;
                    row["Status"] = item.Status;
                    row["ActivityID"] = item.ActivityInstanceDestination.ActID;
                    row["ActivityInstanceID"] = item.ActivityInstanceDestination.ActInstID;
                    row["ActivityName"] = item.ActivityInstanceDestination.Name;
                    row["Priority"] = item.ActivityInstanceDestination.Priority;
                    row["StartDate"] = item.EventInstance.StartDate;
                    row["ActivityInstanceDestinationID"] = item.ActivityInstanceDestination.ID;
                    row["ProcessInstanceID"] = item.ProcessInstance.ID;
                    row["ProcessFullName"] = item.ProcessInstance.FullName;
                    row["ProcessName"] = item.ProcessInstance.Name;
                    row["Folio"] = item.ProcessInstance.Folio;
                    row["EventInstanceName"] = item.EventInstance.Name;
                    dt.Rows.Add(row);
                }
                if (impersonate)
                    cnn.RevertUser();
                cnn.Close();
                cnn.Dispose();
                return dt;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:hoshyK2,项目名称:K2-Worklist-Service-Broker,代码行数:71,代码来源:BasicWorklistItem.cs

示例5: GetWorkflowItems


//.........这里部分代码省略.........
            Int32? yearExtraFilter = null;
            if (Int32.TryParse(yearEF == null ? String.Empty : yearEF.Item3, out yearParse))
                yearExtraFilter = yearParse;

            String descExtraFilter = descEF == null ? String.Empty : descEF.Item3;
            String insdExtraFilter = insdEF == null ? String.Empty : insdEF.Item3;
            String bkrExtraFilter = bkrEF == null ? String.Empty : bkrEF.Item3;
            String uwrExtraFilter = uwrEF == null ? String.Empty : uwrEF.Item3;
            String actExtraFilter = actEF == null ? String.Empty : actEF.Item3;

            List<WorkflowItem> retArray = new List<WorkflowItem>();
            using (var k2Connection = new Connection())
            {
                ConnectionSetup k2Setup = new ConnectionSetup();
                k2Setup.ConnectionString = Properties.Settings.Default.WorkflowServerConnectionString;

                k2Connection.Open(k2Setup);

                if (!String.IsNullOrEmpty(impersonateUser))
                    k2Connection.ImpersonateUser(impersonateUser);

                var workCriteria = new WorklistCriteria { NoData = true, Platform = "ASP" };
                
                //String propertyFilter = String.Format("% / {0} / {1} / % / %{2}%", uwrExtraFilter, searchTerm);
                String propertyFilter = String.Format("% / {0} / {1}%{2} / % / {3}",
                    String.IsNullOrEmpty(uwrExtraFilter) ? "%" : uwrExtraFilter,
                    cobExtraFilter,
                    yearExtraFilter == null ? String.Empty : yearExtraFilter.ToString().Substring(2),
                    String.IsNullOrEmpty(insdExtraFilter) ? "%" : "%" + insdExtraFilter + "%");
                if (!string.IsNullOrEmpty(searchTerm))
                {
                    String searchTermFormat = String.Format("%{0}%", searchTerm);

                    //if (extraFilters.Count > 0)
                    workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null);           //  (

                    workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null);           //      (
                    workCriteria.AddFilterField(WCField.ActivityName, WCCompare.Like, searchTermFormat);                //          ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.ProcessData, "BPC", WCCompare.Equal, searchTerm); //          OR ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.EventName, WCCompare.Like, searchTermFormat);     //          OR ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.ProcessFolio, WCCompare.Like, searchTermFormat);  //          OR ...
                    workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null);             //      )     

                    if (extraFilters.Count > 0)
                    {
                        workCriteria.AddFilterField(WCLogical.And, WCField.None, WCCompare.Equal, null);                //      AND
                        workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null);       //      (
                        workCriteria.AddFilterField(WCField.ProcessFolio, WCCompare.Like, propertyFilter);              //          ...
                        workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null);         //      )                        
                    }

                    if (!String.IsNullOrEmpty(actExtraFilter))
                        //  TODO: OR event name?
                        //workCriteria.AddFilterField(WCField.EventName, WCCompare.Equal, actExtraFilter);                     //     ...
                        workCriteria.AddFilterField(WCLogical.And, WCField.ActivityName, WCCompare.Equal, actExtraFilter);                     //     ...

                    //if (extraFilters.Count > 0)
                    workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null);             //  )
                    //workCriteria.AddFilterField(WCField., WCField.None, WCCompare.Equal, null);
                }
                else
                {
                    if (extraFilters.Count > 0)
                    {
                        workCriteria.AddFilterField(WCField.ProcessFolio, WCCompare.Like, propertyFilter);
                        
                    }
                    
                    if (!String.IsNullOrEmpty(actExtraFilter))
                        workCriteria.AddFilterField(WCLogical.And, WCField.ActivityName, WCCompare.Equal , actExtraFilter);                     //     ...
                }

                //  No AND required - seems like bug - this bit gets put in a different bit of the query K2 creates.
                //  Hide allocated items like the SharePoint K2 worlist does by default.
                //  workCriteria.AddFilterField(WCField.WorklistItemStatus, WCCompare.NotEqual, WorklistStatus.Allocated);

                //workCriteria.AddSortField(WCField.ActivityStartDate, WCSortOrder.Descending);

                workCriteria.StartIndex = skip;
                workCriteria.Count = take;

                foreach (KeyValuePair<WCField, WCSortOrder> sort in sorts)
                {
                    workCriteria.AddSortField(sort.Key, sort.Value);
                }

                Worklist k2Worklist = k2Connection.OpenWorklist(workCriteria);

                foreach (WorklistItem item in k2Worklist)
                {
                    retArray.Add(new WorkflowItem(item));
                }

                count = k2Worklist.TotalCount;
                //  Total records before filter
                totalCount = k2Worklist.TotalCount; 

                return retArray;
            }
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:101,代码来源:WorkItemData.cs

示例6: GetWorkflowItemBySN

        public WorkflowItem GetWorkflowItemBySN(string serialNumber, String impersonateUser)
        {
            using (var k2Connection = new Connection())
            {
                ConnectionSetup k2Setup = new ConnectionSetup();
                k2Setup.ConnectionString = Properties.Settings.Default.WorkflowServerConnectionString;

                k2Connection.Open(k2Setup);

                if (!String.IsNullOrEmpty(impersonateUser))
                    k2Connection.ImpersonateUser(impersonateUser);

                var workCriteria = new WorklistCriteria { NoData = true, Platform = "ASP" };

                if (!string.IsNullOrEmpty(serialNumber))
                {
                    workCriteria.AddFilterField(WCField.SerialNumber, WCCompare.Equal, serialNumber);        
                }
                
                Worklist k2Worklist = k2Connection.OpenWorklist(workCriteria);

                WorkflowItem retItem = null;

                foreach (WorklistItem item in k2Worklist)
                {
                    retItem = new WorkflowItem(item);
                }

                // now that we have the workflow item get the count of the related documents
                if ((retItem!=null)&&(!string.IsNullOrEmpty(retItem.PolicyID)))
                {
                    using (DocumentService.DocumentServiceClient client = new DocumentService.DocumentServiceClient())
                    {
                        retItem.RelatedDocumentCount = client.GetDocumentsCountForPolicy(retItem.PolicyID);
                    }
                }

                return retItem;

            }
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:41,代码来源:WorkItemData.cs

示例7: GetWorklistItems

        internal DataTable GetWorklistItems(Dictionary<string, object> properties, Dictionary<string, object> parameters)
        {
            try
            {
                DataTable dt = GetResultTable();
                WorklistCriteria criteria = GetWorklistCriteria(properties);

                ConnectionSetup cnnSetup = new ConnectionSetup();
                cnnSetup.ConnectionString = this._execSettings.ConnectionString;

                using (Connection cnn = new Connection())
                {
                    cnn.Open(cnnSetup);

                    if (this._execSettings.UseImpersonation)
                        cnn.ImpersonateUser(this._execSettings.ImpersonateUser);

                    Worklist worklist;
                    if ((criteria != null) && (criteria.Filters.GetLength(0) > 0))
                        worklist = cnn.OpenWorklist(criteria);
                    else
                        worklist = cnn.OpenWorklist();

                    foreach (WorklistItem item in worklist)
                    {
                        DataRow row = dt.NewRow();
                        PopulateDataRow(item, row);
                        dt.Rows.Add(row);
                    }
                    cnn.Close();
                }
                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:jonnoking,项目名称:K2PowershellLibaries,代码行数:38,代码来源:BasicWorklistItem.cs

示例8: GetWorkflowItemsAsync


//.........这里部分代码省略.........

                var workCriteria = new WorklistCriteria { NoData = true, Platform = "ASP" };

                String propertyFilter = String.Format("% / {0} / {1}%{2} / % / {3}",
                                                      String.IsNullOrEmpty(uwrExtraFilter) ? "%" : uwrExtraFilter,
                                                      cobExtraFilter,
                                                      yearExtraFilter == null
                                                          ? String.Empty
                                                          : yearExtraFilter.ToString().Substring(2),
                                                      String.IsNullOrEmpty(insdExtraFilter)
                                                          ? "%"
                                                          : "%" + insdExtraFilter + "%");
                if (!string.IsNullOrEmpty(searchTerm))
                {
                    String searchTermFormat = String.Format("%{0}%", searchTerm);

                    //if (extraFilters.Count > 0)
                    workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null); //  (

                    workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null); //      (
                    workCriteria.AddFilterField(WCField.ActivityName, WCCompare.Like, searchTermFormat); //          ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.ProcessData, "BPC", WCCompare.Equal, searchTerm);
                    //          OR ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.EventName, WCCompare.Like, searchTermFormat);
                    //          OR ...
                    workCriteria.AddFilterField(WCLogical.Or, WCField.ProcessFolio, WCCompare.Like, searchTermFormat);
                    //          OR ...
                    workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null);
                    //      )     

                    if (extraFilters != null && extraFilters.Count > 0)
                    {
                        workCriteria.AddFilterField(WCLogical.And, WCField.None, WCCompare.Equal, null); //      AND
                        workCriteria.AddFilterField(WCLogical.StartBracket, WCField.None, WCCompare.Equal, null);
                        //      (
                        workCriteria.AddFilterField(WCField.ProcessFolio, WCCompare.Like, propertyFilter);
                        //          ...
                        workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null);
                        //      )                        
                    }

                    if (!String.IsNullOrEmpty(actExtraFilter))
                        //  TODO: OR event name?
                        //workCriteria.AddFilterField(WCField.EventName, WCCompare.Equal, actExtraFilter);                     //     ...
                        workCriteria.AddFilterField(WCLogical.And, WCField.ActivityName, WCCompare.Equal, actExtraFilter);
                    //     ...

                    workCriteria.AddFilterField(WCLogical.EndBracket, WCField.None, WCCompare.Equal, null); //  )
                }
                else
                {
                    if (extraFilters != null && extraFilters.Count > 0)
                    {
                        workCriteria.AddFilterField(WCField.ProcessFolio, WCCompare.Like, propertyFilter);

                    }

                    if (!String.IsNullOrEmpty(actExtraFilter))
                        workCriteria.AddFilterField(WCLogical.And, WCField.ActivityName, WCCompare.Equal, actExtraFilter);
                    //     ...
                }

                //  No AND required - seems like bug - this bit gets put in a different bit of the query K2 creates.
                //  Hide allocated items like the SharePoint K2 worlist does by default.
                //  workCriteria.AddFilterField(WCField.WorklistItemStatus, WCCompare.NotEqual, WorklistStatus.Allocated);
                
                workCriteria.StartIndex = skip;
                workCriteria.Count = take;

                foreach (KeyValuePair<WCField, WCSortOrder> sort in sorts)
                {
                    workCriteria.AddSortField(sort.Key, sort.Value);
                }

                var dto = new GetUserWorkflowItemsDto();
                var task = new Task<GetUserWorkflowItemsDto>
                    (
                    () =>
                    {
                        var k2Worklist = k2Connection.OpenWorklist(workCriteria);

                        retArray.AddRange(from WorklistItem item in k2Worklist select new WorkflowItem(item));

                        dto.WorkflowItemsArray = retArray.ToArray();
                        dto.TotalDisplayRecords = k2Worklist.TotalCount;
                        dto.TotalRecords = k2Worklist.TotalCount;

                        return dto;
                    }
                    );

                // Start the task
                task.Start();

                // Get the result from the task - analogous to 
                // calling task.Result (without the thread blocking)
                var result = await task;
                return result;
            }
        }
开发者ID:Eugene-Murray,项目名称:EM.Contract.Validus,代码行数:101,代码来源:WorkItemData.cs


注:本文中的Connection.OpenWorklist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。