Exemple #1
0
        public void InsertUser(string user)
        {
            SongDA songDA            = new SongDA();
            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@UserID", user));
            songDA.UpdateData("INSERT_USER", list);
        }
Exemple #2
0
        public List <SongDTO> SelectTopWorldSong()
        {
            SongDA    songDA = new SongDA();
            DataTable dt     = null;

            dt = songDA.GetData("SELECT_TOP_WORLD_SONG");

            return(EntityHelper <SongDTO> .GetListObject(dt));
        }
Exemple #3
0
        //public SongDTO GetSongByID(string songID)
        //{
        //    SongDTO songDTO = new SongDTO();
        //    SongDA songDA = new SongDA();
        //    List<SqlParameter> list = new List<SqlParameter>();
        //    list.Add(new SqlParameter("@SongID", songID));


        //    return songDTO;

        //}


        public List <SongDTO> GetDefaultList(string user)
        {
            SongDA              songDA = new SongDA();
            DataTable           dt     = null;
            List <SqlParameter> list   = new List <SqlParameter>();

            list.Add(new SqlParameter("@UserID", user));

            dt = songDA.GetData("SELECT_DEFAULT_LIST", list);

            return(EntityHelper <SongDTO> .GetListObject(dt));
        }
Exemple #4
0
        public bool InsertSong(IEnumerable <HttpPostedFileBase> files)
        {
            SongDA songDA = new SongDA();

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("SONG_NAME", typeof(string));
            dataTable.Columns.Add("ARTIST", typeof(string));
            dataTable.Columns.Add("ALBUM", typeof(string));
            dataTable.Columns.Add("DURATION", typeof(Int16));
            dataTable.Columns.Add("UPLOAD_USER", typeof(string));
            dataTable.Columns.Add("DIRECTORY_PATH", typeof(string));

            foreach (var file in files)
            {
                if (file.ContentLength > 0)
                {
                    // Get file name
                    string fileName = Path.GetFileName(file.FileName);

                    // Get file name with path
                    string path = Resource1.UploadPath + fileName;

                    // Save file to server
                    file.SaveAs(path);

                    // Load info from .mp3 file
                    TagLib.File tagFile = TagLib.File.Create(path);

                    // Create data for datatable
                    dataTable.Rows.Add(
                        tagFile.Tag.Title,
                        tagFile.Tag.Performers[0],
                        tagFile.Tag.Album,
                        tagFile.Properties.Duration.TotalSeconds,
                        this.GetUserAccount(HttpContext.Current.Request.LogonUserIdentity.Name),
                        path);
                }
            }

            // Insert info to database
            List <SqlParameter> listParam = new List <SqlParameter>();

            listParam.Add(new SqlParameter("@SongDataTable", dataTable));

            bool result = songDA.UpdateData("INSERT_SONG", listParam);


            return(result);
        }
Exemple #5
0
        public void AddToDefaultList(string songID)
        {
            SongDA songDA = new SongDA();

            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@UserID", GetUserAccount(HttpContext.Current.Request.LogonUserIdentity.Name)));
            list.Add(new SqlParameter("@SongID", songID));

            System.Diagnostics.Debug.WriteLine(GetUserAccount(HttpContext.Current.Request.LogonUserIdentity.Name));
            System.Diagnostics.Debug.WriteLine(songID);

            songDA.UpdateData("INSERT_SONG_TO_DEFAULT_LIST", list);
        }
Exemple #6
0
        public bool CheckUser(string user)
        {
            SongDA              songDA = new SongDA();
            DataTable           dt     = null;
            List <SqlParameter> list   = new List <SqlParameter>();

            list.Add(new SqlParameter("@UserID", user));

            dt = songDA.GetData("CHECK_USER_EXIST", list);

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #7
0
        public string GetSongUrlByID(string songID)
        {
            string path              = String.Empty;
            SongDA songDA            = new SongDA();
            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@SongID", songID));

            DataTable dt = songDA.GetData("SELECT_DIRECTORY_PATH_BY_ID", list);

            path = dt.Rows[0][0].ToString();
            if (String.IsNullOrEmpty(path))
            {
                System.Diagnostics.Debug.WriteLine("FUCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(path + "*********************");
            }

            return(path);
        }