/// <summary> /// Gets the top 100 Nspots /// </summary> public static List <NSpot> GetTop100NSpots(TopNspotType TabType) { string OrderByClause = string.Empty; switch (TabType) { case TopNspotType.Featured: OrderByClause = "TotalVoteScore"; break; case TopNspotType.Viewed: OrderByClause = "NumberOfViews"; break; case TopNspotType.Discussed: OrderByClause = "NumberOfComments"; break; case TopNspotType.Rated: OrderByClause = "TotalVoteScore"; break; } Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("HG_GetTop100Nspots"); db.AddInParameter(dbCommand, "OrderByClause", DbType.String, OrderByClause); List <NSpot> arr = null; //execute the stored procedure using (IDataReader dr = db.ExecuteReader(dbCommand)) { arr = PopulateObjectWithJoin(dr); dr.Close(); } // Create the object array from the datareader return(arr); }
/// <summary> /// Gets the top 100 Nspots /// </summary> public static List<NSpot> GetTop100NSpots(TopNspotType TabType) { string OrderByClause = string.Empty; switch (TabType) { case TopNspotType.Featured: OrderByClause = "TotalVoteScore"; break; case TopNspotType.Viewed: OrderByClause = "NumberOfViews"; break; case TopNspotType.Discussed: OrderByClause = "NumberOfComments"; break; case TopNspotType.Rated: OrderByClause = "TotalVoteScore"; break; } Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("HG_GetTop100Nspots"); db.AddInParameter(dbCommand, "OrderByClause", DbType.String, OrderByClause); List<NSpot> arr = null; //execute the stored procedure using (IDataReader dr = db.ExecuteReader(dbCommand)) { arr = PopulateObjectWithJoin(dr); dr.Close(); } // Create the object array from the datareader return arr; }