internal static Album GetAlbum(int albumId) { Album m = new Album(albumId); if (albumId > 0) { SafeProcedure.ExecuteAndMapRecords( Database.GetDatabase(D4DDefine.DBInstanceName), "dbo.Album_Get", delegate(IRecord record) { m.Title = record.GetStringOrEmpty(1); m.BandId = record.GetInt32OrDefault(2,0); m.PublishDate = record.GetDateTime(3); m.PublishYear = record.GetInt32OrDefault(4,0); m.PublishMonth = record.GetInt32OrDefault(5, 0); m.AddUserID= record.GetInt32OrDefault(6,0); m.AddDate = record.GetDateTime(7); m.Status = (PublishStatus)(record.GetInt32OrDefault(8, 0)); m.TotalCount = record.GetInt32OrDefault(9,0); m.SImage = record.GetStringOrEmpty(10); m.LImage = record.GetStringOrEmpty(11); }, albumId); } return m; }
public int SetAlbum(Album album) { if (album == null) return -1; if (album.PublishDate != null) { if (album.PublishYear <= 1900) album.PublishYear = album.PublishDate.Year; if (album.PublishMonth <= 0 || album.PublishMonth > 12) album.PublishMonth = album.PublishDate.Month; } if (album.PublishMonth <= 0) album.PublishMonth = 1; return AlbumDao.SetAlbum(album); }
internal static int SetAlbum(Album album) { if (album == null) return -1; SafeProcedure.ExecuteNonQuery( Database.GetDatabase(D4DDefine.DBInstanceName), "dbo.Album_Set", delegate(IParameterSet parameters) { parameters.AddWithValue("@AlbumId", album.AlbumId); parameters.AddWithValue("@Title", album.Title); parameters.AddWithValue("@SImage", album.SImage); parameters.AddWithValue("@LImage", album.LImage); parameters.AddWithValue("@BandId", album.BandId); parameters.AddWithValue("@PublishDate", album.PublishDate); parameters.AddWithValue("@PublishYear", album.PublishYear); parameters.AddWithValue("@PublishMonth", album.PublishMonth); parameters.AddWithValue("@AddUserId", album.AddUserID); parameters.AddWithValue("@Status", (int)(album.Status)); parameters.AddWithValue("@TotalCount", album.TotalCount); parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue); }, delegate(IParameterSet outputParameters) { album.AlbumId = Convert.ToInt32(outputParameters.GetValue("@RetVal")); }); return album.AlbumId; }
internal static void MapAlbumList(IRecord record, List<Album> list) { Album m = new Album(); m.AlbumId = record.GetInt32OrDefault(0, 0); m.Title = record.GetStringOrEmpty(1); m.BandId = record.GetInt32OrDefault(2, 0); m.PublishDate = record.GetDateTime(3); m.PublishYear = record.GetInt32OrDefault(4, 0); m.PublishMonth = record.GetInt32OrDefault(5, 0); m.AddUserID = record.GetInt32OrDefault(6, 0); m.AddDate = record.GetDateTime(7); m.Status = (PublishStatus)(record.GetInt32OrDefault(8, 0)); m.TotalCount = record.GetInt32OrDefault(9, 0); m.SImage = record.GetStringOrEmpty(10); m.LImage = record.GetStringOrEmpty(11); list.Add(m); }