public DataSet Query(int startRowIndex, int maximumRows, string connection, string tableName, string selectFields, string where, string orderBy, ref int totalCount) { QueryCondition qc = new QueryCondition(startRowIndex, maximumRows, selectFields, tableName, orderBy, where); //OnBuildQueryCondition(qc); CommonAdapter adapter = new CommonAdapter(connection); DataSet result = adapter.SplitPageQuery(qc, totalCount <= 0); if (result.Tables.Count > 1) { totalCount = (int)result.Tables[1].Rows[0][0]; } var contextCacheKey = connection + "." + tableName + ".Query"; ObjectContextCache.Instance[contextCacheKey] = totalCount; //当页码超出索引的,返回最大页 if (result.Tables[0].Rows.Count == 0 && totalCount > 0) { int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows; totalCount = -1; result = Query(newStartRowIndex, maximumRows, connection, tableName, selectFields, where, orderBy, ref totalCount); } return(result); }
private DataView InnerQuery(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount) { QueryCondition qc = new QueryCondition(startRowIndex, maximumRows, "*", this._DefaultTableName, orderBy, where); OnBuildQueryCondition(qc); CommonAdapter adapter = new CommonAdapter(GetConnectionName()); DataView result = adapter.SplitPageQuery(qc, ref totalCount); ObjectContextCache.Instance[ContextCacheKey] = totalCount; return result; }
private static WfClientUserOperationLogPageQueryResult QueryUserOperationLog(QueryCondition qc, int totalCount) { CommonAdapter adapter = new CommonAdapter(UserOperationLogAdapter.Instance.ConnectionName); UserOperationLogCollection serverLogs = adapter.SplitPageQuery <UserOperationLog, UserOperationLogCollection>(qc, ref totalCount); WfClientUserOperationLogCollection clientLogs = WfClientUserOperationLogConverter.Instance.ServerToClient(serverLogs); WfClientUserOperationLogPageQueryResult result = new WfClientUserOperationLogPageQueryResult(); result.TotalCount = totalCount; result.QueryResult.CopyFrom(clientLogs); 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); }
private static WfClientProcessCurrentInfoPageQueryResult QueryProcessInfo(QueryCondition qc, int totalCount) { CommonAdapter adapter = new CommonAdapter(WfProcessCurrentInfoAdapter.Instance.ConnectionName); WfProcessCurrentInfoCollection processInfo = adapter.SplitPageQuery <WfProcessCurrentInfo, WfProcessCurrentInfoCollection>(qc, ref totalCount); WfClientProcessCurrentInfoCollection clientInfo = new WfClientProcessCurrentInfoCollection(); WfClientProcessCurrentInfoConverter.Instance.ServerToClient(processInfo, clientInfo); WfClientProcessCurrentInfoPageQueryResult result = new WfClientProcessCurrentInfoPageQueryResult(); result.TotalCount = totalCount; result.QueryResult.CopyFrom(clientInfo); return(result); }
public DataSet Query(int startRowIndex, int maximumRows, string connection, string tableName, string selectFields, string where, string orderBy, ref int totalCount) { QueryCondition qc = new QueryCondition(startRowIndex, maximumRows, selectFields, tableName, orderBy, where); //OnBuildQueryCondition(qc); CommonAdapter adapter = new CommonAdapter(connection); DataSet result = adapter.SplitPageQuery(qc, totalCount <= 0); if (result.Tables.Count > 1) totalCount = (int)result.Tables[1].Rows[0][0]; var contextCacheKey = connection + "." + tableName + ".Query"; ObjectContextCache.Instance[contextCacheKey] = totalCount; //当页码超出索引的,返回最大页 if (result.Tables[0].Rows.Count == 0 && totalCount > 0) { int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows; totalCount = -1; result = Query(newStartRowIndex, maximumRows, connection, tableName, selectFields, where, orderBy, ref totalCount); } return result; }
/// <summary> /// 表单分页查询 /// </summary> /// <param name="startRowIndex"></param> /// <param name="maximumRows"></param> /// <param name="where"></param> /// <param name="orderBy"></param> /// <param name="totalCount"></param> /// <returns></returns> public AppCommonInfoCollection GetFormQueryWithCount(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount) { if (string.IsNullOrEmpty(where)) where = "1 = 1"; if (string.IsNullOrEmpty(orderBy)) orderBy = "CREATE_TIME DESC"; if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin") == false) { ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(string.Empty); string resourceIDList = string.Format("SELECT RESOURCE_ID FROM WF.ACL WHERE {0}", cscc.ToSqlString(TSqlBuilder.Instance)); where = string.Format("{0} AND ACI.RESOURCE_ID IN ({1})", where, resourceIDList); } //LDM 加上ACI.PROGRAM_NAME as [PROGRAM_NAME1], //兼容远洋地产的查询(表单工作程序里没有对 APPLICATIONFORM_INFO 表插入数据行) string strSelect = @" ACI.APPLICATION_NAME,ACI.[PROGRAM_NAME] as [PROGRAM_NAME_MCS],ACI.RESOURCE_ID,ACI.[SUBJECT],ACI.[EMERGENCY]," + " ACI.URL,ACI.CREATOR_ID, ACI.CREATOR_NAME,ACI.CREATE_TIME,ACI.DRAFT_DEPARTMENT_NAME"; string strfrom = @" WF.APPLICATIONS_COMMON_INFO as ACI (nolock)"; QueryCondition qc = new QueryCondition( startRowIndex, maximumRows, strSelect, strfrom, orderBy, where ); CommonAdapter commonAdapter = new CommonAdapter(ConnectionDefine.SearchConnectionName); DataSet ds = commonAdapter.SplitPageQuery(qc, totalCount < 0); AppCommonInfoCollection FormQueryEntitys = new AppCommonInfoCollection(); foreach (DataRow row in ds.Tables[0].Rows) { AppCommonInfo entity = new AppCommonInfo(); ORMapping.DataRowToObject(row, entity); FormQueryEntitys.Add(entity); } if (ds.Tables.Count > 1) totalCount = (int)ds.Tables[1].Rows[0][0]; HttpContext.Current.Items["UserFormQueryEntityCount"] = totalCount; //当页码超出索引的,返回最大页 if (FormQueryEntitys.Count == 0 && totalCount > 0) { int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows; totalCount = -1; FormQueryEntitys = GetFormQueryWithCount(newStartRowIndex, maximumRows, where, orderBy, ref totalCount); } return FormQueryEntitys; }
private static WfClientUserOperationLogPageQueryResult QueryUserOperationLog(QueryCondition qc, int totalCount) { CommonAdapter adapter = new CommonAdapter(UserOperationLogAdapter.Instance.ConnectionName); UserOperationLogCollection serverLogs = adapter.SplitPageQuery<UserOperationLog, UserOperationLogCollection>(qc, ref totalCount); WfClientUserOperationLogCollection clientLogs = WfClientUserOperationLogConverter.Instance.ServerToClient(serverLogs); WfClientUserOperationLogPageQueryResult result = new WfClientUserOperationLogPageQueryResult(); result.TotalCount = totalCount; result.QueryResult.CopyFrom(clientLogs); return result; }
/// <summary> /// 表单分页查询 /// </summary> /// <param name="startRowIndex"></param> /// <param name="maximumRows"></param> /// <param name="where"></param> /// <param name="orderBy"></param> /// <param name="totalCount"></param> /// <returns></returns> public AppCommonInfoCollection GetFormQueryWithCount(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount) { if (string.IsNullOrEmpty(where)) { where = "1 = 1"; } if (string.IsNullOrEmpty(orderBy)) { orderBy = "CREATE_TIME DESC"; } if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin") == false) { ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(string.Empty); string resourceIDList = string.Format("SELECT RESOURCE_ID FROM WF.ACL WHERE {0}", cscc.ToSqlString(TSqlBuilder.Instance)); where = string.Format("{0} AND ACI.RESOURCE_ID IN ({1})", where, resourceIDList); } //LDM 加上ACI.PROGRAM_NAME as [PROGRAM_NAME1], //兼容远洋地产的查询(表单工作程序里没有对 APPLICATIONFORM_INFO 表插入数据行) string strSelect = @" ACI.APPLICATION_NAME,ACI.[PROGRAM_NAME] as [PROGRAM_NAME_MCS],ACI.RESOURCE_ID,ACI.[SUBJECT],ACI.[EMERGENCY]," + " ACI.URL,ACI.CREATOR_ID, ACI.CREATOR_NAME,ACI.CREATE_TIME,ACI.DRAFT_DEPARTMENT_NAME"; string strfrom = @" WF.APPLICATIONS_COMMON_INFO as ACI (nolock)"; QueryCondition qc = new QueryCondition( startRowIndex, maximumRows, strSelect, strfrom, orderBy, where ); CommonAdapter commonAdapter = new CommonAdapter(ConnectionDefine.SearchConnectionName); DataSet ds = commonAdapter.SplitPageQuery(qc, totalCount < 0); AppCommonInfoCollection FormQueryEntitys = new AppCommonInfoCollection(); foreach (DataRow row in ds.Tables[0].Rows) { AppCommonInfo entity = new AppCommonInfo(); ORMapping.DataRowToObject(row, entity); FormQueryEntitys.Add(entity); } if (ds.Tables.Count > 1) { totalCount = (int)ds.Tables[1].Rows[0][0]; } HttpContext.Current.Items["UserFormQueryEntityCount"] = totalCount; //当页码超出索引的,返回最大页 if (FormQueryEntitys.Count == 0 && totalCount > 0) { int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows; totalCount = -1; FormQueryEntitys = GetFormQueryWithCount(newStartRowIndex, maximumRows, where, orderBy, ref totalCount); } return(FormQueryEntitys); }
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; }
private static WfClientProcessCurrentInfoPageQueryResult QueryProcessInfo(QueryCondition qc, int totalCount) { CommonAdapter adapter = new CommonAdapter(WfProcessCurrentInfoAdapter.Instance.ConnectionName); WfProcessCurrentInfoCollection processInfo = adapter.SplitPageQuery<WfProcessCurrentInfo, WfProcessCurrentInfoCollection>(qc, ref totalCount); WfClientProcessCurrentInfoCollection clientInfo = new WfClientProcessCurrentInfoCollection(); WfClientProcessCurrentInfoConverter.Instance.ServerToClient(processInfo, clientInfo); WfClientProcessCurrentInfoPageQueryResult result = new WfClientProcessCurrentInfoPageQueryResult(); result.TotalCount = totalCount; result.QueryResult.CopyFrom(clientInfo); return result; }