Пример #1
0
        public static DBgl_UserInfoCollection GetAllItem()
        {
            string key  = SETTINGS_ALL_KEY;
            object obj2 = dtpCache.Get(key);

            if ((obj2 != null))
            {
                return((DBgl_UserInfoCollection)obj2);
            }
            DBgl_UserInfoCollection ItemCollection = new DBgl_UserInfoCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_GetAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_UserInfo item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }

            dtpCache.Max(key, ItemCollection);

            return(ItemCollection);
        }
Пример #2
0
        public static DBgl_UserInfoCollection GetItemPagging(int page, int rec, string strSearch, out int TotalRecords)
        {
            TotalRecords = 0;
            DBgl_UserInfoCollection ItemCollection = new DBgl_UserInfoCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_Paging");

            db.AddInParameter(dbCommand, "Page", DbType.Int32, page);
            db.AddInParameter(dbCommand, "RecsPerPage", DbType.Int32, rec);
            db.AddInParameter(dbCommand, "SearchValue", DbType.String, strSearch);
            db.AddOutParameter(dbCommand, "TotalRecords", DbType.Int32, 0);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_UserInfo item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }
            TotalRecords = Convert.ToInt32(db.GetParameterValue(dbCommand, "@TotalRecords"));
            return(ItemCollection);
        }