Пример #1
0
        private List <SelectListItem> BuildVideoList(int currentvideoid)
        {
            // Get the account id
            int accountid = 0;

            if (Session["UserAccountID"] != null)
            {
                accountid = Convert.ToInt32(Session["UserAccountID"]);
            }

            // Get the active videos
            IVideoRepository    vidrep = new EntityVideoRepository();
            IEnumerable <Video> vids   = vidrep.GetAllVideos(accountid);

            List <SelectListItem> items = new List <SelectListItem>();

            if (currentvideoid > 0)
            {
                Video currentvideo = vidrep.GetVideo(currentvideoid);

                SelectListItem item = new SelectListItem();
                item.Text  = currentvideo.VideoName;
                item.Value = currentvideo.VideoID.ToString();

                items.Add(item);
            }
            foreach (Video vid in vids)
            {
                SelectListItem item = new SelectListItem();
                item.Text  = vid.VideoName;
                item.Value = vid.VideoID.ToString();

                items.Add(item);
            }

            return(items);
        }
Пример #2
0
        private List <SelectListItem> BuildVideoList()
        {
            // Get the account id
            int accountid = 0;

            if (Session["UserAccountID"] != null)
            {
                accountid = Convert.ToInt32(Session["UserAccountID"]);
            }

            // Get the active videos
            IVideoRepository    vidrep = new EntityVideoRepository();
            IEnumerable <Video> vids   = vidrep.GetAllVideos(accountid);

            string videofolder = ConfigurationManager.AppSettings["MediaRootFolder"] + Convert.ToString(Session["UserAccountID"]) + @"/Videos/";

            List <SelectListItem> items = new List <SelectListItem>();
            bool first = true;

            foreach (Video vid in vids)
            {
                if (first)
                {
                    first     = false;
                    firstfile = videofolder + vid.StoredFilename;
                }

                SelectListItem item = new SelectListItem();
                item.Text  = vid.VideoName;
                item.Value = vid.StoredFilename;

                items.Add(item);
            }

            return(items);
        }
Пример #3
0
        public void CreateExampleData(int accountid)
        {
            try
            {
                List<Image> newimages = new List<Image>();
                bool createimages = true;
                bool createvideos = true;
                bool createmusics = true;

                IImageRepository imagerep = new EntityImageRepository();
                IEnumerable<Image> images = imagerep.GetAllImages(accountid);
                foreach (Image image in images)
                {
                    if (
                            image.StoredFilename.ToLower() == "60255096-6a72-409e-b905-4d98ee717bb0.jpg".ToLower() ||
                            image.StoredFilename.ToLower() == "612bb76c-e16e-4fe8-87f2-bddc7eb59300.jpg".ToLower() ||
                            image.StoredFilename.ToLower() == "626c6a35-4523-46aa-9d0a-c2687b581e27.jpg".ToLower() ||
                            image.StoredFilename.ToLower() == "69f99c47-d1b0-4123-b62b-8f18bdc5702f.jpg".ToLower() 
                        )
                    {
                        newimages.Add(image);
                        createimages = false;
                    }
                }

                IVideoRepository videorep = new EntityVideoRepository();
                IEnumerable<Video> videos = videorep.GetAllVideos(accountid);
                foreach (Video video in videos)
                {
                    if (video.StoredFilename.ToLower() == "0EBC6160-CA2C-4497-960C-0A2C2DE7B380.mp4".ToLower())
                        createvideos = false;
                }

                IMusicRepository musicrep = new EntityMusicRepository();
                IEnumerable<Music> musics = musicrep.GetAllMusics(accountid);
                foreach (Music music in musics)
                {
                    if (music.StoredFilename.ToLower() == "1B36982F-4101-4D38-AF20-FAD88A0FA9B5.mp3".ToLower())
                        createmusics = false;
                }

                // Initialize the example data for a new account so there is data available
                if (createimages) 
                    newimages = CreateExampleImageAndSlideShowData(accountid); // Also creates screen, default playergroup, and schedule
                if (createvideos) 
                    CreateExampleVideoAndPlayListData(accountid);
                if (createmusics) 
                    CreateExampleMusicAndTimelineData(accountid, newimages);
            }
            catch { }
        }
Пример #4
0
        public string Player_GetMediaToDownload(int accountid)
        {
            try
            {
                IImageRepository imagerep = new EntityImageRepository();
                IVideoRepository videorep = new EntityVideoRepository();
                IMusicRepository musicrep = new EntityMusicRepository();

                // Returns all the media files for the account
                List <Image> images = new List <Image>();
                List <Video> videos = new List <Video>();
                List <Music> musics = new List <Music>();

                StringBuilder sb = new StringBuilder();

                sb.Append("<xml>");

                // Images ---------------------------------------------------------------------------------
                images = imagerep.GetAllImages(accountid).ToList();
                sb.Append("<Images>");
                foreach (Image image in images)
                {
                    sb.Append("<Image ");
                    sb.Append("ImageID=\"" + image.ImageID.ToString() + "\" ");
                    sb.Append("StoredFilename=\"" + image.StoredFilename + "\" ");
                    sb.Append("ImageName=\"" + Utility.EncodeXMLString(image.ImageName) + "\" ");
                    sb.Append(" />");
                }
                sb.Append("</Images>");

                // Videos ---------------------------------------------------------------------------------
                videos = videorep.GetAllVideos(accountid).ToList();
                sb.Append("<Videos>");
                foreach (Video video in videos)
                {
                    sb.Append("<Video ");
                    sb.Append("VideoID=\"" + video.VideoID.ToString() + "\" ");
                    sb.Append("StoredFilename=\"" + video.StoredFilename + "\" ");
                    sb.Append("VideoName=\"" + video.VideoName + "\" ");
                    sb.Append(" />");
                }
                sb.Append("</Videos>");

                // Music ---------------------------------------------------------------------------------
                musics = musicrep.GetAllMusics(accountid).ToList();
                sb.Append("<Musics>");
                foreach (Music music in musics)
                {
                    sb.Append("<Music ");
                    sb.Append("MusicID=\"" + music.MusicID.ToString() + "\" ");
                    sb.Append("StoredFilename=\"" + music.StoredFilename + "\" ");
                    sb.Append("MusicName=\"" + music.MusicName + "\" ");
                    sb.Append(" />");
                }
                sb.Append("</Musics>");

                // Close the XML and return
                sb.Append("</xml>");

                return(sb.ToString());
            }
            catch (Exception ex)
            {
                return("<xml><Error>" + ex.Message + "</Error></xml>");
            }
        }