Пример #1
0
        /// <summary>
        /// Constructor -- copy
        /// </summary>
        /// <param name="rsIn">The resultset to copy</param>
        public MusicMediaResultSet(MusicMediaResultSet rsIn)
        {
            ID         = rsIn.ID;
            FilePath   = rsIn.FilePath;
            FileName   = rsIn.FileName;
            Title      = rsIn.Title;
            Artist     = rsIn.Artist;
            Album      = rsIn.Album;
            FilePathID = rsIn.FilePathID;

            TableName = "MusicMediaTable";
        }
Пример #2
0
        /// <summary>
        /// Public interface to insert the contents of the resultset into
        /// the database.  This method needs to be overridden from ResultSetDao.
        /// </summary>
        /// <param name="rs">The resultset ot type T</param>
        /// <returns>Whether or not the operation succeeded</returns>
        public override bool InsertResultSet(T rs)
        {
            // Assume the type and cast.  If it doesn't work, return false
            // otherwise return the outcome of the base class' invoke and
            // insert operation.
            bool retVal             = false;
            MusicMediaResultSet mrs = rs as MusicMediaResultSet;

            if (mrs != null)
            {
                retVal = InvokeAndInsert(typeof(MusicMediaResultSet), new Object[] { mrs.ID, mrs.FilePath, mrs.FileName, mrs.Title, mrs.Artist, mrs.Album, mrs.FilePathID });
            }
            return(retVal);
        }
Пример #3
0
        /// <summary>
        /// Create a resultset of type T, fill it and return it to the caller.  It
        /// is assumed the given DataRow type is associated with the type T.  This
        /// method needs to be overridden from ResultSetDao.
        /// </summary>
        /// <param name="data">The row of data</param>
        /// <returns>The resultset of type T</returns>
        public override T GetResultSetFromDataRow(DataRow data)
        {
            // Create the resultset which matches the type T
            MusicMediaResultSet rs = new MusicMediaResultSet();

            try
            {
                // Fill the resultset
                rs.ID         = data.ItemArray[0].ToString();
                rs.FilePath   = data.ItemArray[1].ToString();
                rs.FileName   = data.ItemArray[2].ToString();
                rs.Title      = data.ItemArray[3].ToString();
                rs.Artist     = data.ItemArray[4].ToString();
                rs.Album      = data.ItemArray[5].ToString();
                rs.FilePathID = data.ItemArray[6].ToString();
            }
            catch (InvalidCastException)
            {
            }
            // Return it as T
            return(rs as T);
        }