private void InsertQueueToSQL() { int song_id = -1; int artist_id = -1; int performer_id = -1; string firstname = ""; string lastname = ""; //if (this.is_SongDeleted == 1) CheckSongDeletion(); try { for (int i = 0; i < this.songSyncList.Rows.Count; i++) { // Get songList.Rows[i] ID, Artist ID, Performer ID for Insert songList.Rows[i]_queue KaraoqDataAccess.KaraoqWebServiceSoapClient objClient = new KaraoqDataAccess.KaraoqWebServiceSoapClient(); song_id = objClient.getSongIdInSyncTrack(this.songSyncList.Rows[i]["Title"].ToString(), "0", "", this.songSyncList.Rows[i]["Artist"].ToString()); artist_id = objClient.getArtistIdInSyncTrack(this.songSyncList.Rows[i]["Artist"].ToString()); string[] performerName = this.songSyncList.Rows[i]["Singer"].ToString().Split(','); for (int j = 0; j < performerName.Length; j++) { if (j == 0 && performerName[0] != null) firstname = performerName[0]; if (j == 1 && performerName[1] != null) lastname = performerName[1]; } performer_id = objClient.getPerformerIdInSyncTrack(VenueId, firstname, lastname); System.Diagnostics.Debug.WriteLine("\nXXXXXXXXXXXXXXXXX" + this.songSyncList.Rows[i]["Title"].ToString() + " and IDs are : " + song_id + "***" + artist_id + "***" + performer_id + "\n"); //System.Diagnostics.Debug.WriteLine(songList.Rows[i]["Singer"].ToString() + "////" + songList.Rows[i]["Position"].ToString() + "////" + songList.Rows[i]["Title"].ToString() + "////" + songList.Rows[i]["Artist"].ToString()); //KaraoqDataAccess.KaraoqWebServiceSoapClient objClient3 = new KaraoqDataAccess.KaraoqWebServiceSoapClient(); objClient.InsertSongQueue(General.DJId, VenueId, artist_id, performer_id, this.songSyncList.Rows[i]["Singer"].ToString(), song_id, int.Parse(this.songSyncList.Rows[i]["Position"].ToString()), this.songSyncList.Rows[i]["Title"].ToString(), this.songSyncList.Rows[i]["Artist"].ToString(), "", this.songSyncList.Rows[i]["FileName"].ToString()); //Thread.Sleep(1000); } } catch (Exception exception1) { //ProjectData.SetProjectError(exception1); // ProjectData.ClearProjectError(); } finally { this.previousSongSyncList = new DataTable(); this.previousSongSyncList = this.songSyncList; this.songSyncList = new DataTable(); } }
private void combineTwoQueueList() { tempSongTable = new DataTable(); for (int i = 0; i < this.previousSongSyncList.Rows.Count; i++) { int checkSame = 0; for (int j = 0; j < this.songSyncList.Rows.Count; j++) { if (this.previousSongSyncList.Rows[i]["Singer"] == this.songSyncList.Rows[j]["Singer"] && this.previousSongSyncList.Rows[i]["Artist"] == this.songSyncList.Rows[j]["Artist"] && this.previousSongSyncList.Rows[i]["Title"] == this.songSyncList.Rows[j]["Title"]) { checkSame = 1; //this.combinedsongSyncList.Rows.Add(this.songSyncList.Rows[i]); } else if (j == this.songSyncList.Rows.Count - 1 && checkSame != 1) { tempSongTable.Rows.Add(this.songSyncList.Rows[i]); } } } for (int k = 0; k < tempSongTable.Rows.Count; k++) { int song_id = -1; int artist_id = -1; int performer_id = -1; string firstname = ""; string lastname = ""; KaraoqDataAccess.KaraoqWebServiceSoapClient objClient = new KaraoqDataAccess.KaraoqWebServiceSoapClient(); song_id = objClient.getSongIdInSyncTrack(tempSongTable.Rows[k]["Title"].ToString(), "0", "", tempSongTable.Rows[k]["Artist"].ToString()); artist_id = objClient.getArtistIdInSyncTrack(tempSongTable.Rows[k]["Artist"].ToString()); string[] performerName = tempSongTable.Rows[k]["Singer"].ToString().Split(','); for (int j = 0; j < performerName.Length; j++) { if (j == 0 && performerName[0] != null) firstname = performerName[0]; if (j == 1 && performerName[1] != null) lastname = performerName[1]; } performer_id = objClient.getPerformerIdInSyncTrack(VenueId, firstname, lastname); objClient.UpdateSongQueueIsDeleted(General.DJId, VenueId, 1, performer_id, song_id, artist_id, ""); Thread.Sleep(1000); } InsertQueueToSQL(); }