コード例 #1
0
ファイル: DJ.svc.cs プロジェクト: jakub77/KServer
        /// <summary>
        /// Remove given songs from list of songs belonging to the given DJ.
        /// DJ must be logged in, without a session running to successfully call this method.
        /// </summary>
        /// <param name="songs">The list of songs to Remove.</param>
        /// <param name="DJKey">The Unique DJKey describing the DJ</param>
        /// <returns>The outcome of the operation.</returns>
        public Response DJRemoveSongs(List<Song> songs, long DJKey)
        {
            int DJID = -1;
            using (DatabaseConnectivity db = new DatabaseConnectivity())
            {
                // Try to establish a database connection
                Response r = db.OpenConnection();
                if (r.error)
                    return r;

                // Attempt to convert DJKey to DJID
                r = DJKeyToID(DJKey, out DJID, db);
                if (r.error)
                    return r;

                // Make sure the DJ is logged in, without a session running.
                r = DJValidateStatus(DJID, "1", db);
                if (r.error)
                    return r;

                // Information seems to be valid, remove songs.
                r = db.DJRemoveSongs(songs, DJID);
                return r;
            }
        }