/// <summary> /// Gets the Photo in the database With a full join with all the manually specified tables in SP code /// </summary> public static Photo GetPhotoByWebPhotoIDWithJoin(string WebPhotoID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("HG_GetPhotoByWebPhotoIDWithJoin"); db.AddInParameter(dbCommand, "WebPhotoID", DbType.String, WebPhotoID); List <Photo> Photos = null; //execute the stored procedure using (IDataReader dr = db.ExecuteReader(dbCommand)) { Photos = Photo.PopulateObjectWithJoin(dr); dr.Close(); } // Create the object array from the datareader if (Photos.Count > 0) { return(Photos[0]); } else { return(null); } }
/// <summary> /// Gets all the Photo related to a PhotoCollectionID /// </summary> public static List <Photo> GetPhotoByPhotoCollectionIDWithJoinGeneric(int PhotoCollectionID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("HG_GetPhotoByPhotoCollectionIDWithJoin"); db.AddInParameter(dbCommand, "PhotoCollectionID", DbType.Int32, PhotoCollectionID); List <Photo> Photos = null; //execute the stored procedure using (IDataReader dr = db.ExecuteReader(dbCommand)) { Photos = Photo.PopulateObjectWithJoin(dr); dr.Close(); } // Create the object array from the datareader return(Photos); }