Exemple #1
0
        public override PropLogCollection GetPropLogs(int userID, PropLogType type, int pageNumber, int pageSize)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.Pager.TableName   = "bx_PropLogs";
                query.Pager.SortField   = "PropLogID";
                query.Pager.PageNumber  = pageNumber;
                query.Pager.PageSize    = pageSize;
                query.Pager.SelectCount = true;

                query.Pager.Condition = "UserID = @UserID";
                query.CreateParameter <int>("@UserID", userID, SqlDbType.Int);

                if (type != PropLogType.All)
                {
                    query.CreateParameter <PropLogType>("@Type", type, SqlDbType.TinyInt);
                    query.Pager.Condition += " AND Type = @Type";
                }

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    PropLogCollection result = new PropLogCollection(reader);

                    if (reader.NextResult() && reader.Read())
                    {
                        result.TotalRecords = reader.Get <int>(0);
                    }

                    return(result);
                }
            }
        }
Exemple #2
0
        public override PropLogCollection GetPropLogs(int userID, PropLogType type, int pageNumber, int pageSize)
        {
            using(SqlQuery query = new SqlQuery())
            {
                query.Pager.TableName = "bx_PropLogs";
                query.Pager.SortField = "PropLogID";
                query.Pager.PageNumber = pageNumber;
                query.Pager.PageSize = pageSize;
                query.Pager.SelectCount = true;

                query.Pager.Condition = "UserID = @UserID";
                query.CreateParameter<int>("@UserID", userID, SqlDbType.Int);
                
                if(type != PropLogType.All)
                {
                    query.CreateParameter<PropLogType>("@Type", type, SqlDbType.TinyInt);
                    query.Pager.Condition += " AND Type = @Type";
                }

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    PropLogCollection result = new PropLogCollection(reader);

                    if(reader.NextResult() && reader.Read())
                        result.TotalRecords = reader.Get<int>(0);

                    return result;
                }
            }
        }