/// <summary>
        /// 加载流程运行时的信息
        /// </summary>
        /// <param name="processIDs"></param>
        /// <returns></returns>
        public WfProcessCurrentInfoCollection Load(bool fillAssignees, params string[] processIDs)
        {
            processIDs.NullCheck("processIDs");

            WfProcessCurrentInfoCollection result = new WfProcessCurrentInfoCollection();

            InSqlClauseBuilder builder = new InSqlClauseBuilder();

            builder.AppendItem(processIDs);

            if (builder.Count > 0)
            {
                string fieldNames = ORMapping.GetSelectFieldsNameSql <WfProcessInstanceData>("Data");

                string sql = string.Format("SELECT {0} FROM WF.PROCESS_INSTANCES WHERE INSTANCE_ID {1}",
                                           fieldNames,
                                           builder.ToSqlStringWithInOperator(TSqlBuilder.Instance));

                DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

                result.LoadFromDataView(table.DefaultView);

                if (fillAssignees)
                {
                    FillAssignees(result);
                }
            }

            return(result);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="fillAssignees"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public WfProcessCurrentInfoCollection Load(bool fillAssignees, Action <WhereSqlClauseBuilder> action)
        {
            action.NullCheck("action");

            WfProcessCurrentInfoCollection result = new WfProcessCurrentInfoCollection();

            WhereSqlClauseBuilder whereBuilder = new WhereSqlClauseBuilder();

            action(whereBuilder);

            string fieldNames = ORMapping.GetSelectFieldsNameSql <WfProcessInstanceData>("Data");

            string sql = string.Format("SELECT {0} FROM WF.PROCESS_INSTANCES WHERE {1}",
                                       fieldNames,
                                       whereBuilder.ToSqlString(TSqlBuilder.Instance));

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            result.LoadFromDataView(table.DefaultView);

            if (fillAssignees)
            {
                FillAssignees(result);
            }

            return(result);
        }
        /// <summary>
        /// 加载分支流程信息
        /// </summary>
        /// <param name="fillAssignees"></param>
        /// <param name="activityID"></param>
        /// <param name="templateKey"></param>
        /// <param name="includeAborted">是否包含已经作废的流程</param>
        /// <returns></returns>
        public WfProcessCurrentInfoCollection LoadByOwnerActivityID(bool fillAssignees, string activityID, string templateKey, bool includeAborted)
        {
            activityID.NullCheck("activityID");

            WfProcessCurrentInfoCollection result = new WfProcessCurrentInfoCollection();

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem("OWNER_ACTIVITY_ID", activityID);

            if (templateKey.IsNotEmpty())
            {
                builder.AppendItem("OWNER_TEMPLATE_KEY", templateKey);
            }

            if (includeAborted == false)
            {
                builder.AppendItem("Status", WfProcessStatus.Aborted.ToString(), "<>");
            }

            string fieldNames = ORMapping.GetSelectFieldsNameSql <WfProcessCurrentInfo>();

            string sql = string.Format("SELECT {0} FROM WF.PROCESS_INSTANCES WHERE {1}",
                                       fieldNames,
                                       builder.ToSqlString(TSqlBuilder.Instance));

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            result.LoadFromDataView(table.DefaultView);

            if (fillAssignees)
            {
                FillAssignees(result);
            }

            return(result);
        }