public List<Multimedia> GetAll() { MultimediaDAC _multimediaComponent = new MultimediaDAC(); IDataReader reader = _multimediaComponent.GetAllMultimedia().CreateDataReader(); List<Multimedia> _multimediaList = new List<Multimedia>(); while(reader.Read()) { if(_multimediaList == null) _multimediaList = new List<Multimedia>(); Multimedia _multimedia = new Multimedia(); if(reader["MultimediaID"] != DBNull.Value) _multimedia.MultimediaID = Convert.ToInt32(reader["MultimediaID"]); if(reader["MultimediaTypeID"] != DBNull.Value) _multimedia.MultimediaTypeID = Convert.ToInt32(reader["MultimediaTypeID"]); if(reader["Url"] != DBNull.Value) _multimedia.Url = Convert.ToString(reader["Url"]); if(reader["ThumbnainUrl"] != DBNull.Value) _multimedia.ThumbnainUrl = Convert.ToString(reader["ThumbnainUrl"]); if(reader["Title"] != DBNull.Value) _multimedia.Title = Convert.ToString(reader["Title"]); if(reader["Description"] != DBNull.Value) _multimedia.Description = Convert.ToString(reader["Description"]); if(reader["PublishDate"] != DBNull.Value) _multimedia.PublishDate = Convert.ToDateTime(reader["PublishDate"]); if(reader["CreatedDate"] != DBNull.Value) _multimedia.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]); _multimedia.NewRecord = false; _multimediaList.Add(_multimedia); } reader.Close(); return _multimediaList; }
public Multimedia GetByID(int _multimediaID) { MultimediaDAC _multimediaComponent = new MultimediaDAC(); IDataReader reader = _multimediaComponent.GetByIDMultimedia(_multimediaID); Multimedia _multimedia = null; while(reader.Read()) { _multimedia = new Multimedia(); if(reader["MultimediaID"] != DBNull.Value) _multimedia.MultimediaID = Convert.ToInt32(reader["MultimediaID"]); if(reader["MultimediaTypeID"] != DBNull.Value) _multimedia.MultimediaTypeID = Convert.ToInt32(reader["MultimediaTypeID"]); if(reader["Url"] != DBNull.Value) _multimedia.Url = Convert.ToString(reader["Url"]); if(reader["ThumbnainUrl"] != DBNull.Value) _multimedia.ThumbnainUrl = Convert.ToString(reader["ThumbnainUrl"]); if(reader["Title"] != DBNull.Value) _multimedia.Title = Convert.ToString(reader["Title"]); if(reader["Description"] != DBNull.Value) _multimedia.Description = Convert.ToString(reader["Description"]); if(reader["PublishDate"] != DBNull.Value) _multimedia.PublishDate = Convert.ToDateTime(reader["PublishDate"]); if(reader["CreatedDate"] != DBNull.Value) _multimedia.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]); _multimedia.NewRecord = false; } reader.Close(); return _multimedia; }
public bool Insert(Multimedia multimedia) { int autonumber = 0; MultimediaDAC multimediaComponent = new MultimediaDAC(); bool endedSuccessfuly = multimediaComponent.InsertNewMultimedia( ref autonumber, multimedia.MultimediaTypeID, multimedia.Url, multimedia.ThumbnainUrl, multimedia.Title, multimedia.Description, multimedia.PublishDate, multimedia.CreatedDate); if(endedSuccessfuly) { multimedia.MultimediaID = autonumber; } return endedSuccessfuly; }
public bool Update(Multimedia multimedia ,int old_multimediaID) { MultimediaDAC multimediaComponent = new MultimediaDAC(); return multimediaComponent.UpdateMultimedia( multimedia.MultimediaTypeID, multimedia.Url, multimedia.ThumbnainUrl, multimedia.Title, multimedia.Description, multimedia.PublishDate, multimedia.CreatedDate, old_multimediaID); }