예제 #1
0
        // This method get all the cases (and all songs) in the Kraoki Library
        private void getCaseAndExportTSV(String tsvLocation)
        {
            Thread.Sleep(2000);
            //System.Diagnostics.Debug.WriteLine(tsvLocation);
            using (StreamReader reader = new StreamReader(tsvLocation))
            {
                String line;
                bool lineOne = true;

                while ((line = reader.ReadLine()) != null)
                {
                    if (!lineOne)
                    {
                        // Reading each line from the TSV file, and split with TAB
                        string[] a = line.Split('\n');
                        foreach (var eachSong in a)
                        {
                            //System.Diagnostics.Debug.WriteLine(eachSong);
                            String[] fields = eachSong.Split('\t');

                            KaraoqDataAccess.KaraoqWebServiceSoapClient objClient = new KaraoqDataAccess.KaraoqWebServiceSoapClient();
                            int trackId = objClient.getSongIdInSyncTrack(fields[2] != null ? fields[2] : "", fields[4] != null ? fields[4] : "", "", fields[1] != null ? fields[1] : "");
                            // saving in SQL database, do not have existing method to get song_id, dj_id, artist_id. There are still confusion about the fields.
                            System.Diagnostics.Debug.WriteLine(fields[0] + "**" + fields[1] + "**" + fields[2] + "**" + fields[3] + "**" + fields[4] + "**" + fields[5] + "**" + fields[6]);
                            objClient.InsertSynqTracks(VenueId, General.DJId, Convert.ToInt32(Properties.Settings.Default.DJPlaybackTool), trackId, fields[1] != null ? fields[1] : "", fields[2] != null ? fields[2] : "", fields[1] != null ? fields[1] : "", fields[4] != null ? fields[4] : "", fields[2] != null ? fields[2] : "", fields[5] != null ? fields[5] : "", fields[3] != null ? fields[3] : "", fields[6] != null ? fields[6] : "", fields[0] != null ? fields[0] : "");
                            //Thread.Sleep(1000);
                        }
                    }
                    lineOne = false;
                }
            }
            syncQueueBetweenSocketAndSQLServer();
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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();
        }