Exemplo n.º 1
0
        public ActionResult Contest(string key)
        {
            contest = new Contest();

            contest.GetContestByKey(key);

            ContestVideos convids = new ContestVideos();

            convids.GetContestVideosForContest(contest.ContestID);

            ViewBag.ContestName = contest.Name;

            SongRecords sngrcs = new SongRecords();
            SongRecord sngrcd = null;
            BootBaronLib.AppSpec.DasKlub.BOL.Video vidCon = null;

            foreach (BootBaronLib.AppSpec.DasKlub.BOL.VideoContest.ContestVideo vi in convids)
            {
                vidCon = new BootBaronLib.AppSpec.DasKlub.BOL.Video(vi.VideoID);

                sngrcd = new SongRecord(vidCon);

                sngrcs.Add(sngrcd);
            }

            sngrcs.Sort(delegate(BootBaronLib.AppSpec.DasKlub.BOL.ArtistContent.SongRecord p1,
            BootBaronLib.AppSpec.DasKlub.BOL.ArtistContent.SongRecord p2)
            {
                return p2.VideoID.CompareTo(p1.VideoID);
            });

            return View(sngrcs);
        }
Exemplo n.º 2
0
        public ActionResult Contest(string key)
        {
            _contest = new Contest();
            _contest.GetContestByKey(key);
            var convids = new ContestVideos();
            convids.GetContestVideosForContest(_contest.ContestID);
            ViewBag.ContestName = _contest.Name;
            var sngrcs = new SongRecords();
            sngrcs.AddRange(convids.Select(vi => new Video(vi.VideoID)).Select(vidCon => new SongRecord(vidCon)));
            sngrcs.Sort((p1, p2) => p2.VideoID.CompareTo(p1.VideoID));

            return View(sngrcs);
        }
Exemplo n.º 3
0
        private static void VideoCount()
        {
            var vids = new Videos();
            var conts = new Contests();
            conts.GetAll();

            int count = 0;
            int totalVids = 0;

            foreach (Contest c1 in conts)
            {
                var cv = new ContestVideo();
                var cvs = new ContestVideos();
                cvs.GetContestVideosForContest(c1.ContestID);
                totalVids += cvs.Count;
                count += (from cv2 in cvs
                    select new Video(cv2.VideoID)
                    into v1
                    let doc = new XmlDocument()
                    select
                        Utilities.GETRequest(
                            new Uri("http://gdata.youtube.com/feeds/api/videos/" + v1.ProviderKey +
                                    @"?v=2&alt=json"))
                    into s
                    where !string.IsNullOrWhiteSpace(s)
                    select (JObject) JsonConvert.DeserializeObject(s)
                    into JObj
                    select JObj["entry"]
                    into entry
                    from thumbnail in entry["yt$statistics"]
                    where !thumbnail.ToString().Contains("fav")
                    select
                        Convert.ToInt32(thumbnail.ToString()
                            .Replace(@"""viewCount"": """, string.Empty)
                            .Replace(@"""", string.Empty))).Sum();
            }
        }
Exemplo n.º 4
0
        public ActionResult VideoVote()
        {
            Contest contest = Contest.GetLastContest();

            ViewBag.Contest = contest;

            mu = Membership.GetUser();

            if (ContestVideo.IsUserContestVoted(Convert.ToInt32(mu.ProviderUserKey), contest.ContestID)  && contest.DeadLine.AddHours(72) > DateTime.UtcNow)
            {
                LoadContestResults();

                return View();
            }

            ContestVideos cvids = new ContestVideos();

            cvids.GetContestVideosForContest(contest.ContestID);

            Videos vidsInContest = new Videos();
            Video vid2 = null;

            foreach (ContestVideo cv1 in cvids)
            {
                vid2 = new Video(cv1.VideoID);
                vidsInContest.Add(vid2);

            }

            vidsInContest.Sort(delegate(Video p1, Video p2)
                            {
                                return p1.PublishDate.CompareTo(p2.PublishDate);
                            });

            ViewBag.ContestVideos = vidsInContest;

            //SongRecords sngrcds3 = new SongRecords();
            //SongRecord sng3 = new SongRecord();

            //foreach (Video v1 in vidsInContest)
            //{
            //    sng3 = new SongRecord(v1);

            //    sngrcds3.Add(sng3);
            //}

            //ViewBag.ContestVideoList = sngrcds3.VideosList();

            return View();
        }
Exemplo n.º 5
0
        public ActionResult VideoVote()
        {
            Contest contest = Contest.GetLastContest();

            ViewBag.Contest = contest;

            if (_mu != null &&
                (ContestVideo.IsUserContestVoted(Convert.ToInt32(_mu.ProviderUserKey), contest.ContestID) &&
                 contest.DeadLine.AddHours(72) > DateTime.UtcNow))
            {
                LoadContestResults();

                return View();
            }

            var cvids = new ContestVideos();

            cvids.GetContestVideosForContest(contest.ContestID);

            var vidsInContest = new Videos();
            vidsInContest.AddRange(cvids.Select(cv1 => new Video(cv1.VideoID)));

            vidsInContest.Sort((p1, p2) => p1.PublishDate.CompareTo(p2.PublishDate));

            ViewBag.ContestVideos = vidsInContest;

            return View();
        }