Beispiel #1
0
        public CRBITBL_HistoryControlResult LoadDataByType(CRBITBL_HistoryControlQuery query)
        {
            var pagingInfo = new PagingInfoEntity();

            pagingInfo.SortField     = query.PageInfo.SortFields;
            pagingInfo.StartRowIndex = 1 + query.PageInfo.PageIndex * query.PageInfo.PageSize;
            pagingInfo.MaximumRows   = query.PageInfo.PageSize - 1;
            if (pagingInfo.MaximumRows < 0)
            {
                pagingInfo.MaximumRows = 0;
            }
            if (pagingInfo.StartRowIndex < 0)
            {
                pagingInfo.StartRowIndex = 0;
            }
            var dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("loadSamplePolitInfoByType");

            using (var builder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, pagingInfo, "n_ID asc"))
            {
                builder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, string.Format("n_Type={0}", query.iType));
                dataCommand.CommandText = builder.BuildQuerySql();
            }
            var result     = dataCommand.ExecuteEntityList <CRBITBL_HistoryControlTable>();
            var totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));
            CRBITBL_HistoryControlResult response = new CRBITBL_HistoryControlResult();

            response.DataList   = result;
            response.TotalCount = totalCount;
            return(response);
        }
Beispiel #2
0
        public CRBITBL_HistoryControlResult LoadEnterpriseDataByType(int iType)
        {
            var dataCommand = DataCommandManager.GetDataCommand("loadEnterpriseDataByType");

            dataCommand.SetParameterValue("@iType", iType);
            var result = dataCommand.ExecuteEntityList <CRBITBL_HistoryControlTable>();
            CRBITBL_HistoryControlResult response = new CRBITBL_HistoryControlResult();

            response.DataList   = result;
            response.TotalCount = result.Count;
            return(response);
        }