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


C# Connection.OpenWorklistItem方法代码示例

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


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

示例1: ProcessBase

        public ProcessBase(Connection conn, string sn)
        {
            //Get the WorklistItem object
            WorklistItem wi = conn.OpenWorklistItem(sn);

            //get the processing instance object
            ProcessInstance pi = wi.ProcessInstance;

            InitializeDataFields(pi.DataFields);

            this._conn = conn;
            this._sn = sn;
            this.Actions = wi.Actions;
            this.Folio = pi.Folio;
        }
开发者ID:porter1130,项目名称:K2-GAP,代码行数:15,代码来源:ProcessBase.cs

示例2: ApprovalProcess

        /// <summary>
        /// 审批流程
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="sn"></param>
        /// <param name="actionString"></param>
        /// <param name="memo"></param>
        /// <param name="dataFields"></param>
        public WorklistItem ApprovalProcess(string userName, string sn, string actionString, string memo, Dictionary<string, string> dataFields)
        {
            Connection k2Connection = new Connection();

            try
            {
                k2Connection.Open(ConfigurationBase.Web.K2Server, ConfigurationBase.Web.K2LoginString);
                k2Connection.ImpersonateUser(userName);

                //根据SN打开工作项
                WorklistItem workList = k2Connection.OpenWorklistItem(sn);

                if (workList != null)
                {
                    #region 更新Datafield
                    if (dataFields != null && dataFields.Count > 0)
                    {
                        ProcessInstance currentProcessInst = k2Connection.OpenProcessInstance(workList.ProcessInstance.ID);
                        //更新Datafields
                        foreach (string key in dataFields.Keys)
                        {
                            if (currentProcessInst.DataFields[key] != null)
                            {
                                if (currentProcessInst.DataFields[key].Value!= dataFields[key])
                                {
                                    currentProcessInst.DataFields[key].Value = dataFields[key];
                                }
                            }
                        }
                        currentProcessInst.Update();
                    }
                    #endregion

                    #region 审批任务
                    //批量审批没有actionString,默认第一个操作
                    if (string.IsNullOrEmpty(actionString))
                    {
                        if (workList.Actions[0].Name == REJECTACTION)
                        {
                            workList.GotoActivity("流程未通过");
                        }
                        else if (workList.Actions[0].Name == UNDOACTION)
                        {
                            workList.GotoActivity("流程撤销");
                        }
                        else
                        {
                            workList.Actions[0].Execute();
                        }
                    }
                    else
                    {
                        //执行匹配的操作
                        if (actionString == UNDOACTION)
                        {
                            workList.GotoActivity("流程撤销");
                        }
                        else if (actionString == REJECTACTION)
                        {
                            workList.GotoActivity("流程未通过");
                        }
                        else
                        {
                            bool isExcuted = false;
                            for (int i = 0; i < workList.Actions.Count; i++)
                            {
                                if (workList.Actions[i].Name == actionString)
                                {
                                    workList.Actions[i].Execute();
                                    isExcuted = true;
                                    break;
                                }
                            }
                        }
                    }
                    #endregion
                }

                return workList;
            }
            catch (Exception)
            {
                return null;
            }
            finally
            {
                if (k2Connection != null)
                {
                    k2Connection.Close();
                }
            }
        }
开发者ID:nanin,项目名称:k2-workflowapi,代码行数:100,代码来源:K2Helper.cs

示例3: RedirectWorklistItem

        private void RedirectWorklistItem()
        {
            string sn = base.GetStringProperty(Constants.SOProperties.ClientWorklist.SerialNumber, true);
            string fqn = base.GetStringProperty(Constants.SOProperties.ClientWorklist.FQN, true);

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

                WorklistItem wli = k2Con.OpenWorklistItem(sn);
                wli.Redirect(fqn);

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

示例4: ReleaseWorklistItem

        private void ReleaseWorklistItem()
        {
            string sn = base.GetStringProperty(Constants.SOProperties.ClientWorklist.SerialNumber, true);
            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);

                WorklistItem wli = k2Con.OpenWorklistItem(sn);
                wli.Release();

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

示例5: ApproveK2Process

        public ResultModel ApproveK2Process(string sn, int loginId, string actionString, string memo, Dictionary<string, string> dataFields, out string activityName, out string processCode, out int procInstID)
        {
            Connection k2Connect = null;
            WorklistItem workList = null;
            ResultModel jr = new ResultModel() { Code = ResultCode.Fail };
            activityName = string.Empty;
            processCode = string.Empty;
            procInstID = 0;
             try
            {
                k2Connect = new Connection();
                k2Connect.Open(ConfigurationManager.AppSettings["K2Server"], ConfigurationManager.AppSettings["K2LoginString"]);
                k2Connect.ImpersonateUser(SecurityLable(loginId.ToString()));

                workList = k2Connect.OpenWorklistItem(sn);
                if (workList != null)
                {
                    #region 更新Datafield
                    if (dataFields != null && dataFields.Count > 0)
                    {
                        ProcessInstance CurrentProcessInst = workList.ProcessInstance;
                        //更新Datafields
                        foreach (string key in dataFields.Keys)
                        {
                            if (CurrentProcessInst.DataFields[key] != null)
                            {
                                if (CurrentProcessInst.DataFields[key].Value.ToString() != dataFields[key])
                                {
                                    CurrentProcessInst.DataFields[key].Value = dataFields[key];
                                }
                            }
                        }
                    }
                    #endregion

                    #region 审批任务
                    //批量审批没有actionString,默认第一个操作
                    if (string.IsNullOrEmpty(actionString))
                    {
                        if (workList.Actions[0].Name == REJECTACTION)
                        {
                            workList.GotoActivity("流程未通过");
                        }
                        else if (workList.Actions[0].Name == UNDOACTION)
                        {
                            workList.GotoActivity("流程撤销");
                        }
                        else
                        {
                            workList.Actions[0].Execute();
                        }
                    }
                    else
                    {
                        //执行匹配的操作
                        if (actionString == UNDOACTION)
                        {
                            workList.GotoActivity("流程撤销");
                        }
                        else if (actionString == REJECTACTION)
                        {
                            workList.GotoActivity("流程未通过");
                        }
                        else
                        {
                            bool isExcute = false;
                            for (int i = 0; i < workList.Actions.Count; i++)
                            {
                                if (workList.Actions[i].Name == actionString)
                                {
                                    workList.Actions[i].Execute();
                                    isExcute = true;
                                    break;
                                }
                            }
                            if (!isExcute)
                            {
                                jr.Code = ResultCode.Fail;
                                jr.Msg = string.Format("Action:{0}错误", actionString);
                                return jr;
                            }
                        }
                    }
                    #endregion

                    jr.Code = ResultCode.Sucess;
                    jr.Msg = "";
                    activityName = workList.ActivityInstanceDestination.Name;
                    processCode = workList.ProcessInstance.DataFields["ProcessCode"].Value.ToString();
                    procInstID = workList.ProcessInstance.ID;
                }
            }
             catch (Exception ex)
             {
                 jr.Msg = ex.Message;
             }
             finally
             {
                 if (workList != null)
                 {
//.........这里部分代码省略.........
开发者ID:nanin,项目名称:k2-workflowapi,代码行数:101,代码来源:K2ServiceProvider.cs

示例6: WorkItemAction

        public Boolean WorkItemAction(string serialno, string action)
        {
            //TODO - Move into K2 Helpers
            Connection K2Conn = new Connection();
            SCConnectionStringBuilder K2ConnString = new SCConnectionStringBuilder();

            //Setup Connection String
            K2ConnString.Host = "Win2012-K2";
            K2ConnString.Integrated = false;
            K2ConnString.UserID = "Sa4Demo\\Tberry";
            K2ConnString.Password = "Sa42013!";
            K2ConnString.Port = 5252;
            K2ConnString.WindowsDomain = "Sa4Demo";
            K2ConnString.SecurityLabelName = "K2";
            K2ConnString.Authenticate = true;
            K2ConnString.IsPrimaryLogin = true;
            K2Conn.Open("Win2012-K2", K2ConnString.ConnectionString);

            SourceCode.Workflow.Client.WorklistItem worklistItem = K2Conn.OpenWorklistItem(serialno);
            // action the workflow by executing the action
            if (worklistItem.Actions.Count > 0)
            {
                worklistItem.Actions[action].Execute();
                return (true);
            }
            else { return (false); }
        }
开发者ID:jordanberry,项目名称:SA4Launcher,代码行数:27,代码来源:WorkListContext.cs

示例7: ReAssign

        public ResultModel ReAssign(string sn, int assignFrom, int assignTo, out string activityName, out string processCode, out int procInstID)
        {
            Connection k2Connect = null;
            WorklistItem workList = null;
            ResultModel jr = new ResultModel() { Code = ResultCode.Fail };
            activityName = string.Empty;
            processCode = string.Empty;
            procInstID = 0;
            try
            {
                k2Connect = new Connection();
                k2Connect.Open(ConfigurationManager.AppSettings["K2Server"], ConfigurationManager.AppSettings["K2LoginString"]);
                k2Connect.ImpersonateUser(SecurityLable(assignFrom.ToString()));
                workList = k2Connect.OpenWorklistItem(sn);
                if (workList != null )
                {
                    workList.Redirect(SecurityLable(assignTo.ToString()));
                    jr.Code = ResultCode.Sucess;
                    jr.Msg = "";
                    activityName = workList.ActivityInstanceDestination.Name;
                    processCode = workList.ProcessInstance.DataFields["ProcessCode"].Value.ToString();
                    procInstID = workList.ProcessInstance.ID;

                }

            }
            catch (Exception ex)
            {
                jr.Msg = ex.Message;
            }
            finally
            {
                if (workList != null)
                {
                    if (workList.Status == WorklistStatus.Open)
                    {
                        try
                        {
                            k2Connect.RevertUser();
                            workList.Release();
                        }
                        catch { }
                    }
                }
                if (k2Connect != null)
                    k2Connect.Close();
            }
            return jr;
        }
开发者ID:nanin,项目名称:k2-workflowapi,代码行数:49,代码来源:K2ServiceProvider.cs

示例8: LoadWorklistItem

        internal DataTable LoadWorklistItem(string serialNumber)
        {
            ConnectionSetup connectSetup = new ConnectionSetup();
            connectSetup.ConnectionString = _connectionString;
            Connection cnn = new Connection();

            DataTable dt = GetResultTable();

            try
            {
                cnn.Open(connectSetup);
                WorklistItem item = cnn.OpenWorklistItem(serialNumber);

                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);
                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cnn.Close();
                cnn.Dispose();
            }
        }
开发者ID:hoshyK2,项目名称:K2-Worklist-Service-Broker,代码行数:44,代码来源:BasicWorklistItem.cs

示例9: GetWorklistItemBySN

        public WorklistItem GetWorklistItemBySN(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);

                return k2Connection.OpenWorklistItem(serialNumber);
            }           
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:15,代码来源:WorkItemData.cs

示例10: LoadWorklistItem

        internal DataTable LoadWorklistItem(string serialNumber)
        {
            if (string.IsNullOrEmpty(serialNumber))
                throw new ArgumentException("Value must not be null or empty.", "serialNumer");

            try
            {
                DataTable dt = GetResultTable();
                DataRow row = dt.NewRow();

                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);

                    WorklistItem item = cnn.OpenWorklistItem(serialNumber);

                    if (item != null)
                    {
                        PopulateDataRow(item, row);
                        dt.Rows.Add(row);
                    }

                    cnn.Close();
                }
                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:jonnoking,项目名称:K2PowershellLibaries,代码行数:37,代码来源:BasicWorklistItem.cs

示例11: GetWorklistItemBySN

        public WorklistItem GetWorklistItemBySN(string serialNumber, String impersonateUser)
        {
            // if the serial number is null or empty we do not want to do any of this
            if (!string.IsNullOrEmpty(serialNumber))
            {
                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);

                    return k2Connection.OpenWorklistItem(serialNumber);
                }
            }
            return null;
        }
开发者ID:Eugene-Murray,项目名称:EM.Contract.Validus,代码行数:20,代码来源:WorkItemData.cs


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