Esempio n. 1
0
        /// <summary>
        /// 查詢 UserData 列表。
        /// </summary>
        /// <returns>The user list.</returns>
        public GridModel qryUserDataForGrid(int page, int pageSize, TbUserData condition = null)
        {
            CommonService     commonService = new CommonService();
            List <TbUserData> userList      = new List <TbUserData>();
            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);

                    if (condition == null)
                    {
                        userList = dao.qryUserDataForGrid(rowIndex[0], rowIndex[1]);
                    }
                    else   //有帶查詢資料
                    {
                        if (object.ReferenceEquals(condition.COUNTY_ID, null))
                        {
                            condition.COUNTY_ID = "0";
                        }

                        if (object.ReferenceEquals(condition.SCHOOL_SYSTEM_SNO, null))
                        {
                            condition.SCHOOL_SYSTEM_SNO = 0;
                        }

                        userList = dao.qryUserDataForGrid(rowIndex[0], rowIndex[1], condition);
                    }
                    totalCount = dao.qryUserDataForGridCount(condition);
                    gridModel  = commonService.setGridModel(page, pageSize, totalCount, userList);
                }
                catch (Exception e)
                {
                    logger.Error(e, e.Message);
                }
            }
            return(gridModel);
        }
Esempio n. 2
0
        public GridModel getDynamicReportByGrid(int page, int pageSize, TbDrugsNoticeUtils tbDrugsNoticeUtils, string loginType, string userId)
        {
            List <TbDrugsNoticeUtils> list = new List <TbDrugsNoticeUtils>();
            GridModel gridModel            = new GridModel();
            int       totalCount           = 0;

            using (SqlConnection dbConn = new SqlConnection(DbConnection.connString)){
                try{
                    dbConn.Open();
                    dao.dbConn = dbConn;
                    int[] rowIndex = commonService.getRowRange(page, pageSize);
                    list       = dao.qryDynamicReportByGrid(rowIndex[0], rowIndex[1], tbDrugsNoticeUtils, loginType, userId);
                    totalCount = dao.qryDynamicReportCount(tbDrugsNoticeUtils, loginType, userId);
                    gridModel  = commonService.setGridModel(page, pageSize, totalCount, list);
                }catch (Exception e) {
                    logger.Error(e, e.Message);
                }
            }
            return(gridModel);
        }
Esempio n. 3
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);
        }