/// <summary>
        ///		Borra los archivos
        /// </summary>
        private void Delete()
        {
            List <MediaItemListViewModel> files = GetSelectedFiles();

            if (files.Count > 0 &&
                MediaPlayerViewModel.Instance.ControllerWindow.ShowQuestion("¿Desea quitar de la lista los elementos seleccionados?"))
            {
                // Borra físicamente los archivos
                if (MediaPlayerViewModel.Instance.ControllerWindow.ShowQuestion("¿Desea eliminar del ordenador los archivos multimedia?"))
                {
                    foreach (MediaItemListViewModel file in files)
                    {
                        if (!file.FullFileName.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) &&
                            !file.FullFileName.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
                        {
                            LibCommonHelper.Files.HelperFiles.KillFile(file.FullFileName);
                        }
                    }
                }
                // Borra los archivos de la lista de reproducción
                foreach (MediaItemListViewModel file in files)
                {
                    ReproductionList.Delete(file.File);
                    MediaFiles.Remove(file);
                }
                // Graba la lista de reproducción
                SaveReproductionList();
            }
        }
Exemple #2
0
 public void addToList(string item, string location, int type)
 {
     MediaFiles.Items.Add(item);
     MediaFileLocation.Add(location);
     MediaFileLocationType.Add(type);
     MediaFiles.Update();
 }
Exemple #3
0
        public async Task <Posts> AddNewUserPost(PostsViewModel model, List <string> fileName)
        {
            //create a new instance of the entity post

            Posts userPost = new Posts()
            {
                Id           = Guid.NewGuid(),
                Visibility   = model.VisibilityStatus,
                DatePosted   = model.DatePosted,
                Content      = model.Content,
                PostCategory = model.PostCategory,
                UserId       = model.userId
            };
            var postAdded = await postRepo.AddNewAsync(userPost);

            //add each media file to db
            foreach (var item in fileName)
            {
                MediaFiles media = new MediaFiles()
                {
                    PostId   = postAdded.Id,
                    fileName = item
                };
                _context.MediaFiles.Add(media);
            }
            if (postAdded != null)
            {
                await _context.SaveChangesAsync();

                return(postAdded);
            }
            return(null);
        }
Exemple #4
0
        private void LoadData()
        {
            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetDetailById(_idx);

            string PortalId    = dt.Rows[0]["PortalId"].ToString();
            string TypeId      = dt.Rows[0]["TypeId"].ToString();
            string Title       = dt.Rows[0]["Title"].ToString();
            string Description = dt.Rows[0]["Description"].ToString();
            string FileName    = dt.Rows[0]["FileName"].ToString();

            PopulatePortalList2DDL(PortalId);
            PopulateMediaTypeList2DDL(TypeId);

            txtTitle.Text         = Title;
            txtDescription.Text   = Description;
            Literal_FileName.Text = FileName;
            string dir_path  = System.Configuration.ConfigurationManager.AppSettings["upload_background_audio_dir"];
            string file_path = "../../../" + dir_path + "/" + FileName;

            ViewState["filename"] = FileName;


            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<object type=\"application/x-shockwave-flash\" data=\"../../../scripts/plugins/dewplayer/dewplayer-vol.swf?mp3=" + file_path + "\" width=\"240\" height=\"20\" id=\"dewplayer-vol\"><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"../../../scripts/plugins/dewplayer/dewplayer-vol.swf?mp3=" + file_path + "/></object>");
            Literal_Preview.Text = sb.ToString();
        }
        private List <MediaFiles> GetMediaFiles(Guid?gGuid = null)
        {
            List <MediaFiles> liMediaFiles = new List <MediaFiles>();
            MediaFiles        oMediaFiles  = null;

            try
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DemoVideoBurstConnection"].ConnectionString))
                {
                    conn.Open();
                    RenderTemplateElementsBL oRenderTemplateElementsBL = new RenderTemplateElementsBL();
                    SqlDataReader            reader = null;
                    SqlCommand sqlCmd = new SqlCommand();
                    sqlCmd.CommandType = CommandType.Text;
                    sqlCmd.CommandText = " Select M.urlid ,MP.description,M.width, M.height, M.mediatype, isnull(Mu.dsignedurl, '') dsignedurl from tblJobs Job INNER JOIN tblMedia M ON Job.id = M.jobid INNER JOIN tblMediaUrls MU On M.urlid = MU.id INNER JOIN tblMediaProfiles MP On M.profile = MP.profileid WHERE MP.active = 1 and M.active=1 and Job.status=100000 and Job.deleted=0 and Job.guid='" + gGuid + "' Order by MU.created desc";
                    sqlCmd.Connection  = conn;
                    reader             = sqlCmd.ExecuteReader();
                    ElementTypesBL oElementTypesBL = new ElementTypesBL();
                    while (reader.Read())
                    {
                        oMediaFiles             = new MediaFiles();
                        oMediaFiles.url         = Convert.ToString(reader["dsignedurl"]);
                        oMediaFiles.description = Convert.ToString(reader["description"]);
                        oMediaFiles.width       = Convert.ToInt32(reader["width"]);
                        oMediaFiles.height      = Convert.ToInt32(reader["height"]);
                        oMediaFiles.mediatype   = Convert.ToInt32(reader["mediatype"]);
                        liMediaFiles.Add(oMediaFiles);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(liMediaFiles);
        }
Exemple #6
0
        public async Task <Posts> UpdatePost(PostsViewModel model, List <string> fileName)
        {
            //fetch the old post
            var post = postRepo.Get(model.PostId);

            //update post properties
            post.Content      = string.IsNullOrWhiteSpace(model.Content) ? post.Content : model.Content;
            post.PostCategory = model.PostCategory;
            post.Visibility   = model.VisibilityStatus;
            post.DatePosted   = post.DatePosted;
            post.UserId       = model.userId;

            postRepo.Update(post);

            foreach (var item in fileName)
            {
                MediaFiles media = new MediaFiles()
                {
                    PostId   = post.Id,
                    fileName = item,
                };
                _context.MediaFiles.Update(media);
            }
            await _context.SaveChangesAsync();

            return(post);
        }
        private void RefreshMediaFiles(object parameters)
        {
            try
            {
                if (parameters is MediaSource)
                {
                    MediaSource      ms      = (MediaSource)parameters;
                    CStorage         storage = new CStorage();
                    List <MediaFile> mfList  = storage.GetMediaFiles(ms.Path);

                    //  TODO: also here information from DB should be insert in MediaFile object (such as description and owner)
                    //          if information is absence some fields will be empty



                    MediaFiles.Clear();
                    foreach (MediaFile mf in mfList)
                    {
                        MediaFiles.Add(mf);
                    }
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #8
0
        private int AddData()
        {
            string userid      = Session["UserId"].ToString();
            int    portalid    = Convert.ToInt32(ddlPortalList.SelectedValue);
            int    typeid      = Convert.ToInt32(ddlMediaTypeList.SelectedValue);
            string title       = txtTitle.Text;
            string description = txtDescription.Text;

            /*** UPLOAD *************************************************************************************************************/
            string         dir_path    = "~/" + System.Configuration.ConfigurationManager.AppSettings["upload_background_audio_dir"];
            HttpPostedFile posted_file = FileInput.PostedFile;
            string         filename    = "";

            if (posted_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                filename = module_obj.GetEncodeString(System.IO.Path.GetFileName(posted_file.FileName));
                string savePath = Server.MapPath(dir_path + "/" + filename);
                posted_file.SaveAs(savePath);
            }
            /************************************************************************************************************************/

            MediaFiles media_obj = new MediaFiles();
            //int i = media_obj.Insert(userid,portalid,typeid,filename, title, description);
            int i = 0;

            return(i);
        }
        private void LoadVideo()
        {
            string strHTML = string.Empty, firstItem = "", otherItems = string.Empty;

            List <Media_Files> items = MediaFiles.GetActiveListByTypeIdFixedNum(4, 5);

            if (items.Count > 0)
            {
                //items.Select((item, index) => index == 0 ? GetResultFromFirstItem(item) : GetResultFromOtherItem(items));
                foreach (var item in items)
                {
                    if (items.First() == item)
                    {
                        firstItem = GetResultFromFirstItem(item);
                    }

                    foreach (var _item in items.Skip(1))
                    {
                        otherItems += GetResultFromOtherItem(_item);
                    }
                }

                strHTML = "<div id=\"playvideoitem\">" + firstItem + "</div>"
                          + "<div class=\"others\">" + otherItems + "</div>";
            }
            else
            {
                strHTML = "Không tìm thấy dữ liệu";
            }

            lblVideoList.Text = strHTML;
        }
Exemple #10
0
        protected string LoadSelectedBackgroundMusic()
        {
            DataTable  dt        = new DataTable();
            MediaFiles media_obj = new MediaFiles();

            dt = media_obj.GetSelectedItem(1);
            string result = string.Empty;

            if (dt.Rows.Count > 0)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.AppendLine("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\"  width=\"15\" height=\"15\">");
                sb.AppendLine("<param name=\"movie\" value=\"../../scripts/plugins/audioplay_0.9.9/audioplay.swf?file=../../user_files/media/audio/background_audio/" + dt.Rows[0]["FileName"].ToString() + "&buttondir=../../scripts/plugins/audioplay_0.9.9/buttons/negative_small&mode=playpause&auto=no&listenstop=yes&sendstop=yes&repeat=0&mastervol=5&bgcolor=0xffffff\">");
                sb.AppendLine("<param name=\"quality\" value=\"high\">");
                sb.AppendLine("<param name=\"wmode\" value=\"transparent\">");
                sb.AppendLine("<param name=\"allowscriptaccess\" value=\"always\">");
                sb.AppendLine("<embed src=\"../../scripts/plugins/audioplay_0.9.9/audioplay.swf?file=../../user_files/media/audio/background_audio/" + dt.Rows[0]["FileName"].ToString() + "&buttondir=../../scripts/plugins/audioplay_0.9.9/buttons/negative_small&mode=playpause&auto=no&listenstop=yes&sendstop=yes&repeat=0&mastervol=5&bgcolor=0xffffff\" quality=\"high\" wmode=\"transparent\" width=\"15\" height=\"15\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>");
                sb.AppendLine("</object>");

                result = sb.ToString();
            }
            else
            {
                result = "";
            }
            return(result);
        }
Exemple #11
0
 public void RemoveMediaFile(int i)
 {
     if (MediaFiles.ContainsKey(i))
     {
         MediaFiles.Remove(i);
     }
 }
Exemple #12
0
        private void FillDataInGrid()
        {
            string vendorid = Session["VendorId"].ToString();
            string topicid  = ddlMediaTopicList.SelectedValue;
            string typeid   = ddlMediaTypeList.SelectedValue;
            string status   = ddlStatus.SelectedValue;

            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetListByVendorIdTopicIdTypeIdStatus(vendorid, topicid, typeid, status);

            if (dt.Rows.Count > 0)
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                GridView1.DataSource = dt;
                GridView1.DataBind();

                int TotalColumns = GridView1.Rows[0].Cells.Count;
                GridView1.Rows[0].Cells.Clear();
                GridView1.Rows[0].Cells.Add(new TableCell());
                GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                GridView1.Rows[0].Cells[0].Text       = "No Record Found";
            }
        }
        private void LoadData()
        {
            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetDetailById(_idx);

            ViewState["TopicId"] = dt.Rows[0]["TopicId"].ToString();
            string TypeId     = dt.Rows[0]["TypeId"].ToString();
            string AlbumId    = dt.Rows[0]["AlbumId"].ToString();
            string ArtistId   = dt.Rows[0]["ArtistId"].ToString();
            string ComposerId = dt.Rows[0]["ComposerId"].ToString();
            string PlayListId = dt.Rows[0]["PlayListId"].ToString();

            string Title       = dt.Rows[0]["Title"].ToString();
            string Dimension   = dt.Rows[0]["Dimension"].ToString();
            string Description = dt.Rows[0]["Description"].ToString();

            ViewState["FileName"] = dt.Rows[0]["FileName"].ToString();
            ViewState["FileUrl"]  = dt.Rows[0]["FileUrl"].ToString();
            string Source = dt.Rows[0]["Source"].ToString();

            ViewState["Photo"]     = dt.Rows[0]["Photo"].ToString();
            ViewState["Thumbnail"] = dt.Rows[0]["Thumbnail"].ToString();
            imgPhoto.ImageUrl      = upload_front_image_dir + "/" + ViewState["Thumbnail"].ToString();
            string AutoStart = dt.Rows[0]["AutoStart"].ToString();
            string MediaLoop = dt.Rows[0]["MediaLoop"].ToString();
            string Status    = dt.Rows[0]["Status"].ToString();

            PopulateMediaTypeList2DDL(TypeId);
            PopulateMediaTopicList2DDL(ViewState["TopicId"].ToString());
            PopulateMediaAlbumList2DDL(AlbumId);
            PopulateMediaArtistList2DDL(ArtistId);
            PopulateMediaComposerList2DDL(ComposerId);
            PopulateMediaPlayList2DDL(PlayListId);

            if (AutoStart == "True")
            {
                chkAutoStart.Checked = true;
            }
            if (MediaLoop == "True")
            {
                chkMedialoop.Checked = true;
            }
            if (Status == "1")
            {
                chkIsFilePublished.Checked = true;
            }
            txtDimension.Text    = Dimension;
            txtSource.Text       = Source;
            txtFileTitle.Text    = Title;
            txtDescription.Value = Description;
            //if (ViewState["FileName"].ToString() != string.Empty && ViewState["FileUrl"].ToString() == string.Empty)
            //    Literal_FileName.Text = ViewState["FileName"].ToString();
            //else if (ViewState["FileName"].ToString() == string.Empty && ViewState["FileUrl"].ToString() != string.Empty)
            //    Literal_FileName.Text = ViewState["FileUrl"].ToString();
            //else
            //    Literal_FileName.Text = "No File";
            hdFileId.Value = _idx.ToString();
        }
Exemple #14
0
        public void StoreFileReferences(MediaFiles files, int orderProductId)
        {
            var product = Ctx.OrderProducts.Find(orderProductId);

            if (product != null)
            {
                product.SetContent(files);
                SaveChanges();
            }
        }
Exemple #15
0
 private void PreviousButton_Click(object sender, EventArgs e)
 {
     if (MediaFiles.Items.Count > 0 && trackNum > 0)
     {
         LoadFile(trackNum - 1);
         MediaFiles.ClearSelected();
         MediaFiles.SelectedIndex = trackNum - 1;
         trackNum--;
     }
 }
        private void ShowPublishedFiles(object parameters)
        {
            DataBase.DataProviders.DataProvider dataProvider = new DataBase.DataProviders.DataProvider();
            List <MediaFile> mediaFiles = dataProvider.GetMediaFileList();

            MediaFiles.Clear();
            foreach (MediaFile mf in mediaFiles)
            {
                MediaFiles.Add(mf);
            }
        }
Exemple #17
0
 private void PreviousButton_Click(object sender, EventArgs e)
 {
     if (MediaFiles.Items.Count > 0 && trackNum > 0)
     {
         Thread thread = new Thread(() => LoadFile(trackNum));
         thread.Start();
         MediaFiles.ClearSelected();
         MediaFiles.SelectedIndex = trackNum - 1;
         trackNum--;
     }
 }
Exemple #18
0
        public string[] GetMediaFile(int FileId)
        {
            Uri    requestUri = Context.Request.Url;
            string baseUrl    = requestUri.Scheme + Uri.SchemeDelimiter + requestUri.Host + (requestUri.IsDefaultPort ? "" : ":" + requestUri.Port);

            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetDetailById(FileId);
            string     Title     = dt.Rows[0]["Title"].ToString();
            string     FileName  = dt.Rows[0]["FileName"].ToString();
            string     FileUrl   = dt.Rows[0]["FileUrl"].ToString();
            string     Photo     = dt.Rows[0]["Photo"].ToString();
            string     Thumbnail = dt.Rows[0]["Photo"].ToString();
            int        TypeId    = Convert.ToInt32(dt.Rows[0]["TypeId"].ToString());

            //====MediaType=================================================================
            MediaTypes media_type_obj = new MediaTypes();
            string     TypePath       = media_type_obj.GetTypePathByTypeId(TypeId);
            //==============================================================================

            //string dir_path = Server.MapPath("~/" + TypePath);

            string file_path = baseUrl + "/" + TypePath + "/" + FileName;

            string dir_image_path = System.Configuration.ConfigurationManager.AppSettings["upload_media_image_dir"];
            string image          = "";

            if (Photo != string.Empty)
            {
                image = baseUrl + "/" + dir_image_path + "/photo/" + Photo;
            }
            if (Photo == string.Empty)
            {
                image = baseUrl + "/" + dir_image_path + "/thumbnails/" + Thumbnail;
            }
            if (Photo == string.Empty && Thumbnail == string.Empty)
            {
                image = baseUrl + "/images/no_image.jpg";
            }


            string[] array_list = new string[3];
            array_list[0] = Title;
            if (FileName != string.Empty && FileUrl == string.Empty)
            {
                array_list[1] = file_path;
            }
            else
            {
                array_list[1] = FileUrl;
            }
            array_list[2] = image;
            return(array_list);
        }
Exemple #19
0
        /// <summary>
        /// Gets the type of the image by photo.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public MediaFile GetImageByPhotoType(PhotoType type)
        {
            MediaFile mediaFile = new MediaFile();

            foreach (MediaFile file in MediaFiles.Where(file => file.PhotoType == type))
            {
                mediaFile = file;
                break;
            }

            return(mediaFile);
        }
Exemple #20
0
 private int Next()
 {
     if (MediaFiles.Count() > (CurrentSongIndex + 1))
     {
         CurrentSongIndex++;
     }
     else
     {
         CurrentSongIndex = 0;
     }
     return(CurrentSongIndex);
 }
Exemple #21
0
        public string GetListMediaFile()
        {
            Uri    requestUri = Context.Request.Url;
            string baseUrl    = requestUri.Scheme + Uri.SchemeDelimiter + requestUri.Host + (requestUri.IsDefaultPort ? "" : ":" + requestUri.Port);

            MediaFiles  media_obj = new MediaFiles();
            DataTable   dt        = media_obj.GetListByTypeId(2);
            JsonMethods json_obj  = new JsonMethods();
            string      jsonarray = json_obj.makejsonoftable(dt, makejson.e_without_square_brackets);

            return(jsonarray);
        }
        private void ShowImageMediaSources(object parameters)
        {
            RefreshMediaFiles(parameters);
            IEnumerable <MediaFile> query  = MediaFiles.Where(mf => mf.Type == CommonElements.Enums.MediaType.Image).OrderBy(mf => mf.Name);
            List <MediaFile>        result = query.ToList <MediaFile>();

            MediaFiles.Clear();
            foreach (MediaFile r in result)
            {
                MediaFiles.Add(r);
            }
        }
Exemple #23
0
        private void FillDataInGrid()
        {
            string vendorid = Session["VendorId"].ToString();
            string topicid  = ddlMediaTopicList.SelectedValue;
            string typeid   = ddlMediaTypeList.SelectedValue;
            string status   = ddlStatus.SelectedValue;

            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetListByVendorIdTopicIdTypeIdStatus(vendorid, topicid, typeid, status);

            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
Exemple #24
0
 public void ScanFileLocations(BackgroundWorker worker, DoWorkEventArgs e)
 {
     if (worker.CancellationPending)
     {
         e.Cancel = true;
     }
     else
     {
         try
         {
             int highestPercentageReached = 0;
             foreach (var file in FileLocations)
             {
                 int percentComplete = (int)((float)Array.IndexOf(FileLocations, file) / (float)Array.LastIndexOf(FileLocations, file) * 100);
                 if (percentComplete > highestPercentageReached)
                 {
                     highestPercentageReached = percentComplete;
                     worker.ReportProgress(percentComplete);
                 }
                 foreach (var ext in MusicExt)
                 {
                     string[] filePaths = Directory.GetFiles(file, ext, SearchOption.AllDirectories);
                     foreach (var files in filePaths)
                     {
                         MusicFiles.Add(new Music(files));
                     }
                 }
                 foreach (var ext in VideoExt)
                 {
                     string[] filePaths = Directory.GetFiles(file, ext, SearchOption.AllDirectories);
                     foreach (var files in filePaths)
                     {
                         VideoFiles.Add(new Video(files));
                     }
                 }
                 foreach (var ext in OtherExt)
                 {
                     string[] filePaths = Directory.GetFiles(file, ext, SearchOption.AllDirectories);
                     foreach (var files in filePaths)
                     {
                         MediaFiles.Add(new MediaFiles(files));
                     }
                 }
             }
         }
         catch (Exception exc)
         {
             throw new ArgumentException(exc.ToString());
         }
     }
 }
Exemple #25
0
 private void PlayNextTrack()
 {
     if (MediaFiles.Items.Count > 0 && trackNum < MediaFiles.Items.Count - 1)
     {
         trackNum++;
         LoadFile(trackNum);
         MediaFiles.ClearSelected();
         MediaFiles.SelectedIndex = trackNum;
     }
     else
     {
         trackNum = -1;
     }
 }
Exemple #26
0
 private void PlayNextTrack()
 {
     if (MediaFiles.Items.Count > 0 && trackNum < (MediaFiles.Items.Count - 1))
     {
         trackNum++;
         Thread thread = new Thread(() => LoadFile(trackNum));
         thread.Start();
         MediaFiles.ClearSelected();
         MediaFiles.SelectedIndex = trackNum;
     }
     else
     {
         trackNum = -1;
         Stop_Function();
     }
 }
        private void GroupFileList(object parameters)
        {
            var query = MediaFiles.GroupBy(mf => mf.Type).Select(g => new { Name = g.Key, Files = g.ToList <MediaFile>() }).ToList();

            MediaFiles.Clear();
            foreach (var mf in query)
            {
                MediaFiles.Add(new MediaFile {
                    Name = mf.Name.ToString()
                });
                foreach (MediaFile f in mf.Files)
                {
                    MediaFiles.Add(f);
                }
            }
        }
Exemple #28
0
        private static void Main(string[] args)
        {
            var path = args[0];
            ISupportedFileTypes            supportedFileTypes            = new SupportedFileTypes();
            IMultiThreading                multiThreading                = new MultiThreading();
            IFileListFromPath              fileListFromPath              = new FileListFromPath(multiThreading);
            ISupportedMediaFileTypesFilter supportedMediaFileTypesFilter = new SupportedMediaFileTypesFilter(supportedFileTypes);
            IPathToScan                pathToScan                = new PathToScan(path);
            IMediaFiles                mediaFiles                = new MediaFiles(supportedMediaFileTypesFilter, fileListFromPath, pathToScan);
            IWritePlayList             writePlayList             = new WritePlayList(mediaFiles, pathToScan);
            IExecutePlayListGeneration executePlayListGeneration = new ExecutePlayListGeneration(writePlayList);

            executePlayListGeneration.Run();
            Console.WriteLine("done");
            Console.ReadLine();
        }
Exemple #29
0
        private void LoadData()
        {
            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetDetailById(_idx);

            string TopicId     = dt.Rows[0]["TopicId"].ToString();
            string TypeId      = dt.Rows[0]["TypeId"].ToString();
            string Title       = dt.Rows[0]["Title"].ToString();
            string Dimension   = dt.Rows[0]["Dimension"].ToString();
            string Description = dt.Rows[0]["Description"].ToString();
            string FileName    = dt.Rows[0]["FileName"].ToString();
            string Source      = dt.Rows[0]["Source"].ToString();

            ViewState["Photo"]     = dt.Rows[0]["Photo"].ToString();
            ViewState["Thumbnail"] = dt.Rows[0]["Thumbnail"].ToString();
            string AutoStart = dt.Rows[0]["AutoStart"].ToString();
            string MediaLoop = dt.Rows[0]["MediaLoop"].ToString();
            string Status    = dt.Rows[0]["Status"].ToString();

            PopulateMediaTopicList2DDL(TopicId);
            PopulateMediaTypeList2DDL(TypeId);

            if (AutoStart == "True")
            {
                chkAutoStart.Checked = true;
            }
            if (MediaLoop == "True")
            {
                chkMedialoop.Checked = true;
            }
            if (Status == "1")
            {
                chkIsFilePublished.Checked = true;
            }
            txtDimension.Text    = Dimension;
            txtSource.Text       = Source;
            txtFileTitle.Text    = Title;
            txtDescription.Value = Description;
            //Literal_FileName.Text = FileName;
            string dir_path  = System.Configuration.ConfigurationManager.AppSettings["upload_video_dir"];
            string file_path = "../../../" + dir_path + "/" + FileName;


            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<object type=\"application/x-shockwave-flash\" data=\"../../../scripts/plugins/dewplayer/dewplayer-vol.swf?mp3=" + file_path + "\" width=\"240\" height=\"20\" id=\"dewplayer-vol\"><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"../../../scripts/plugins/dewplayer/dewplayer-vol.swf?mp3=" + file_path + "/></object>");
            //Literal_Preview.InnerHtml = sb.ToString();
        }
Exemple #30
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int        id        = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
            string     userid    = Session["UserId"].ToString();
            MediaFiles media_obj = new MediaFiles();
            DataTable  dt        = media_obj.GetDetailById(id);

            if (dt.Rows.Count > 0)
            {
                string filename  = dt.Rows[0]["FileName"].ToString();
                string photo     = dt.Rows[0]["Photo"].ToString();
                string thumbnail = dt.Rows[0]["Thumbnail"].ToString();

                int i = media_obj.Delete(userid, id, photo, thumbnail, filename);
            }
            FillDataInGrid();
        }