示例#1
0
        public void QueryProcessDescriptorInfoTest()
        {
            //建立流程
            int totalIndex = -1;
            int pageSize   = 1;
            Dictionary <string, WfClientProcessDescriptor> dic = new Dictionary <string, WfClientProcessDescriptor>();
            WfClientProcessDescriptor descriptor = OperationHelper.PrepareSimpleProcess();
            string key = descriptor.Key;

            dic.Add(key, descriptor);



            WfClientProcessDescriptor descriptor1 = OperationHelper.PrepareSimpleProcess();
            string key1 = descriptor1.Key;

            dic.Add(key1, descriptor1);
            string orderby = "CREATE_TIME";

            string where = string.Format(" {0}='{1}' or {0}='{2}' ", "PROCESS_KEY", key, key1);

            //获取子流程
            WfClientProcessDescriptorInfoPageQueryResult result = WfClientProcessDescriptorServiceProxy.Instance.QueryProcessDescriptorInfo(
                0, pageSize, where, orderby, totalIndex);

            totalIndex = result.TotalCount;

            //检查
            Assert.AreEqual(totalIndex, dic.Count);

            //分页是否正确,分支流程个数是否正确
            Assert.AreEqual(pageSize, result.QueryResult.Count);

            //检查排序
            Assert.AreEqual(descriptor.Key, result.QueryResult[0].ProcessKey);

            //分页数据
            result = WfClientProcessDescriptorServiceProxy.Instance.QueryProcessDescriptorInfo(
                1, pageSize, where, orderby, totalIndex);
            Assert.AreEqual(descriptor1.Key, result.QueryResult[0].ProcessKey);//第一条加入的信息在第二页

            //清理数据
            foreach (var item in dic)
            {
                OperationHelper.ClearProcessDescriptorSqlServerData(item.Key);
            }
        }
        public WfClientProcessDescriptorInfoPageQueryResult QueryProcessDescriptorInfo(int startRowIndex, int maximumRows, string where, string orderBy, int totalCount)
        {
            OperationContext.Current.FillContextToOguServiceContext();

            if (orderBy.IsNullOrEmpty())
            {
                orderBy = "MODIFY_TIME DESC";
            }

            string selectFields = "PROCESS_KEY, APPLICATION_NAME, PROGRAM_NAME, PROCESS_NAME, ENABLED, CREATE_TIME, CREATOR_ID, CREATOR_NAME, MODIFY_TIME, MODIFIER_ID, MODIFIER_NAME, IMPORT_TIME, IMPORT_USER_ID, IMPORT_USER_NAME";

            QueryCondition qc = new QueryCondition(
                startRowIndex,
                maximumRows,
                selectFields,
                ORMapping.GetMappingInfo(typeof(WfProcessDescriptorInfo)).TableName,
                orderBy);

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendTenantCode();

            if (where.IsNotEmpty())
            {
                where += " AND ";
            }

            where += builder.ToSqlString(TSqlBuilder.Instance);

            qc.WhereClause = where;

            CommonAdapter adapter = new CommonAdapter(WfProcessDescriptorInfoAdapter.Instance.ConnectionName);

            WfProcessDescriptorInfoCollection processInfo = adapter.SplitPageQuery <WfProcessDescriptorInfo, WfProcessDescriptorInfoCollection>(qc, ref totalCount);

            WfClientProcessDescriptorInfoCollection clientInfo = new WfClientProcessDescriptorInfoCollection();

            WfClientProcessDescriptorInfoConverter.Instance.ServerToClient(processInfo, clientInfo);

            WfClientProcessDescriptorInfoPageQueryResult result = new WfClientProcessDescriptorInfoPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientInfo);

            return(result);
        }
        public WfClientProcessDescriptorInfoPageQueryResult QueryProcessDescriptorInfo(int startRowIndex, int maximumRows, string where, string orderBy, int totalCount)
        {
            OperationContext.Current.FillContextToOguServiceContext();

            if (orderBy.IsNullOrEmpty())
                orderBy = "MODIFY_TIME DESC";

            string selectFields = "PROCESS_KEY, APPLICATION_NAME, PROGRAM_NAME, PROCESS_NAME, ENABLED, CREATE_TIME, CREATOR_ID, CREATOR_NAME, MODIFY_TIME, MODIFIER_ID, MODIFIER_NAME, IMPORT_TIME, IMPORT_USER_ID, IMPORT_USER_NAME";

            QueryCondition qc = new QueryCondition(
                startRowIndex,
                maximumRows,
                selectFields,
                ORMapping.GetMappingInfo(typeof(WfProcessDescriptorInfo)).TableName,
                orderBy);

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendTenantCode();

            if (where.IsNotEmpty())
                where += " AND ";

            where += builder.ToSqlString(TSqlBuilder.Instance);

            qc.WhereClause = where;

            CommonAdapter adapter = new CommonAdapter(WfProcessDescriptorInfoAdapter.Instance.ConnectionName);

            WfProcessDescriptorInfoCollection processInfo = adapter.SplitPageQuery<WfProcessDescriptorInfo, WfProcessDescriptorInfoCollection>(qc, ref totalCount);

            WfClientProcessDescriptorInfoCollection clientInfo = new WfClientProcessDescriptorInfoCollection();

            WfClientProcessDescriptorInfoConverter.Instance.ServerToClient(processInfo, clientInfo);

            WfClientProcessDescriptorInfoPageQueryResult result = new WfClientProcessDescriptorInfoPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientInfo);

            return result;
        }