Exemplo n.º 1
0
        public GridModel qryNewsDataForGrid(int page, int pageSize, string title, bool isRenge = false)
        {
            CommonService     commonService = new CommonService();
            List <TbNewsData> list          = new List <TbNewsData>();
            GridModel         gridModel     = new GridModel();
            int totalCount = 0;

            using (SqlConnection dbConn = new SqlConnection(DbConnection.connString)){
                dbConn.Open();
                dao.dbConn = dbConn;
                try
                {
                    int[] rowIndex = commonService.getRowRange(page, pageSize);
                    list       = dao.qryNewsDataForGrid(rowIndex[0], rowIndex[1], title, isRenge);
                    totalCount = dao.qryNewsDataForGridCount(title, isRenge);
                    gridModel  = commonService.setGridModel(page, pageSize, totalCount, list);
                }
                catch (Exception e)
                {
                    logger.Error(e, e.Message);
                }
            }
            return(gridModel);
        }