/// <summary> /// Delete a playlist. /// </summary> /// <param name="playListID">The Id of the playlist.</param> /// <param name="userKey">client mobile key.</param> /// <returns>The outcome of the opearation.</returns> public Response MobileDeletePlaylist(int playListID, long userKey) { int mobileID = -1; using (DatabaseConnectivity db = new DatabaseConnectivity()) { // Try to establish a database connection Response r = db.OpenConnection(); if (r.error) return (Response)Common.LogError(r.message, Environment.StackTrace, r, 0); // Convert the userKey to MobileID r = MobileKeyToID(userKey, out mobileID, db); if (r.error) return (Response)Common.LogError(r.message, Environment.StackTrace, r, 0); // Make sure the client isn't already logged out. r = MobileCheckStatus(mobileID, "!0", db); if (r.error) return r; r = db.MobileDeletePlaylist(playListID, mobileID); if (r.error) return (Response)Common.LogError(r.message, Environment.StackTrace, r, 0); if (r.result == 0) { r.error = true; r.message = "No playlist matched that criteria"; return r; } return r; } }
/// <summary> /// Delete a playlist. /// </summary> /// <param name="playListID">The Id of the playlist.</param> /// <param name="userKey">client mobile key.</param> /// <returns>The outcome of the opearation.</returns> public Response MobileDeletePlaylist(int playListID, long userKey) { int mobileID = -1; using (DatabaseConnectivity db = new DatabaseConnectivity()) { // Try to establish a database connection ExpResponse r = db.OpenConnection(); if (r.error) return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Mobile); // Convert the userKey to MobileID r = MobileKeyToID(userKey, out mobileID, db); if (r.error) return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Mobile); // Make sure the client isn't already logged out. bool validStatus; r = MobileCheckStatus(mobileID, "!0", db, out validStatus); if (r.error) return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Mobile); if (!validStatus) { r.setErMsg(true, Messages.ERR_STATUS_IS_NOT_IN); return r; } r = db.MobileDeletePlaylist(playListID, mobileID); if (r.error) return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Mobile); if (r.result == 0) { r.setErMsg(true, Messages.ERR_BAD_SERVER_INPUT); return r; } return r; } }