Exemplo n.º 1
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.GetActiveVideos(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;
        }
Exemplo n.º 2
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.GetActiveVideos(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;
        }