public void SetControl()
        {
            try
            {
                //Global_Log.pID = playlists.PID;
                //Global_Log.playlistName = playlists.Name;

                int count = 0;
                if (HeaderText.Text == "Create Playlist")
                {
                    string get = "GETDATE()";
                    query = "insert into playlists(name, createdDate, TotalSong) values('" + txtPlaylist.Text + "'," + get + "," + count + ")";
                    Global_Log.connectionClass.insertData(query);
                    MessageBox.Show(this, "Playlist Created..!", "Playlist");
                }
                else if (HeaderText.Text == "Update Playlist:")
                {
                    //query = "update playlists set totalsong =" + count + " where pid =" + 2;
                    query = "update playlists set name='" + txtPlaylist.Text + "'where PID=" + Global_Log.pID;
                    Global_Log.connectionClass.insertData(query);
                    MessageBox.Show(this, "Playlist Updated..!", "Playlist");
                }
            }
            catch (Exception ex)
            {
                Global_Log.EXC_WriteIn_LOGfile(ex.StackTrace);
            }

            this.Close();
        }
Exemplo n.º 2
0
        public void LoadAllSong()
        {
            if (Global_Log.playBack == null)
            {
                Global_Log.playBack = new PlayBack();
            }
            List <Audio> audioList = new List <Audio>();

            try
            {
                DataTable dt = Global_Log.playBack.getAllSong();
                if (dt != null)
                {
                    int count = dt.Rows.Count;
                    if (count != 0)
                    {
                        Audio info = new Audio();
                        for (int i = 0; i < count; i++)
                        {
                            DataRow dr = dt.Rows[i];
                            try
                            {
                                audioList.Add(new Audio()
                                {
                                    ID = Convert.ToInt32(dr.ItemArray[0]),

                                    UID        = dr.ItemArray[1].ToString(),
                                    Title      = dr.ItemArray[2].ToString(),
                                    FileName   = dr.ItemArray[3].ToString(),
                                    Filesize   = Convert.ToInt32(dr.ItemArray[4]),
                                    Filetype   = dr.ItemArray[5].ToString(),
                                    Filepath   = dr.ItemArray[6].ToString(),
                                    Duration   = (TimeSpan)dr.ItemArray[7],
                                    Chain      = dr.ItemArray[8].ToString(),
                                    Track      = dr.ItemArray[9].ToString(),
                                    Trim_Start = (TimeSpan)dr.ItemArray[10],
                                    Trim_End   = (TimeSpan)dr.ItemArray[11],
                                    Intro      = (TimeSpan)dr.ItemArray[12],
                                    EOM        = (TimeSpan)dr.ItemArray[13]
                                });
                            }
                            catch (Exception ex)
                            {
                                Global_Log.EXC_WriteIn_LOGfile(ex.StackTrace);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            { }

            //playlistnames.ItemsSource = audioList;
            datagrid.ItemsSource = audioList;
        }