Пример #1
0
 public PageInfo <ViewTableFiled> GetPageList(PageInfo <ViewTableFiled> pageInfo, ViewTableFiled oSearchEntity = null, string sOperator = null, int iOrderGroup = 0, string sSortName = null, string sSortOrder = null)
 {
     if (!string.IsNullOrWhiteSpace(oSearchEntity.StableName))
     {
         DataTable entityDataTable = _dataTableService.Select(new DataTable()
         {
             StableName = oSearchEntity.StableName
         });
         if (entityDataTable != null)
         {
             oSearchEntity.IdataTableId = entityDataTable.Id;
         }
     }
     if (!string.IsNullOrWhiteSpace(oSearchEntity.StypeName))
     {
         DataType entityDataType = _dataTypeService.Select(new DataType()
         {
             StypeName = oSearchEntity.StypeName
         });
         if (entityDataType != null)
         {
             oSearchEntity.IdataTypeId = entityDataType.Id;
         }
     }
     pageInfo = _mapper.Map <PageInfo <ViewTableFiled> >(_tableFiledRepository.GetPageList(_mapper.Map <PageInfo <TableFiled> >(pageInfo), _mapper.Map <TableFiled>(oSearchEntity), sOperator, iOrderGroup, sSortName, sSortOrder));
     if (pageInfo.data.Any())
     {
         foreach (ViewTableFiled entityViewTableFiled in pageInfo.data)
         {
             DataType  entityDataType  = _dataTypeService.Select(entityViewTableFiled.IdataTypeId);
             DataTable entityDataTable = _dataTableService.Select(entityViewTableFiled.IdataTableId);
             if (entityDataType != null)
             {
                 entityViewTableFiled.StypeName = entityDataType.StypeName;
             }
             if (entityDataTable != null)
             {
                 entityViewTableFiled.StableName = entityDataTable.StableName;
             }
         }
     }
     return(pageInfo);
 }