예제 #1
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);
        }
예제 #2
0
        public ActionResult ProfileDetail(string userName)
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            _ua = new UserAccount(userName);

            var uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(_ua.UserAccountID);

            uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false);
            uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false);

            var model = new ProfileModel();

            model.ProfilePhotoMainRaw = uad.RawProfilePicUrl;

            if (_ua.UserAccountID > 0)
            {
                model.UserAccountID = _ua.UserAccountID;
                model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(_ua.UserAccountID);
                model.CreateDate = _ua.CreateDate;
            }

            if (_mu != null)
            {
                ViewBag.IsBlocked = BlockedUser.IsBlockedUser(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey));
                ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID);

                if (_ua.UserAccountID == Convert.ToInt32(_mu.ProviderUserKey))
                {
                    model.IsViewingSelf = true;
                }
                else
                {
                    var ucon = new UserConnection();

                    ucon.GetUserToUserConnection(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID);

                    model.UserConnectionID = ucon.UserConnectionID;

                    if (BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID))
                    {
                        return RedirectToAction("index", "home");
                    }
                }
            }
            else
            {
                if (uad.MembersOnlyProfile)
                {
                    return RedirectToAction("LogOn", "Account");
                }
            }

            ViewBag.ThumbIcon = uad.FullProfilePicURL;

            SetModelForUserAccount(model, uad);

            //
            var su = new StatusUpdate();
            su.GetMostRecentUserStatus(_ua.UserAccountID);

            if (su.StatusUpdateID > 0)
            {
                model.LastStatusUpdate = su.CreateDate;
                model.MostRecentStatusUpdate = su.Message;
            }

            model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(_ua.UserAccountID);

            GetUserPhotos(model);

            GetUserNews(model);

            model.MetaDescription = _ua.UserName + " " + Messages.Profile + " " +
                                    FromDate.DateToYYYY_MM_DD(_ua.LastActivityDate);

            GetUserPlaylist();

            ForumThreads(_ua.UserAccountID, model);

            if (uad.UserAccountID > 0)
            {
                model.Birthday = uad.BirthDate;

                if (uad.ShowOnMapLegal)
                {
                    // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added
                    string currentLang = Utilities.GetCurrentLanguageCode();

                    Thread.CurrentThread.CurrentUICulture =
                        CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());
                    Thread.CurrentThread.CurrentCulture =
                        CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());

                    model.DisplayOnMap = uad.ShowOnMapLegal;

                    var rnd = new Random();
                    int offset = rnd.Next(10, 100);

                    SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);

                    if (latlong.latitude != 0 && latlong.longitude != 0)
                    {
                        model.Latitude =
                            Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset))
                                .ToString(CultureInfo.InvariantCulture);
                        model.Longitude =
                            Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset))
                                .ToString(CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        model.DisplayOnMap = false;
                    }

                    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang);
                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang);
                }

                ViewBag.ThumbIcon = uad.FullProfilePicThumbURL;

                LoadCurrentImagesViewBag(uad.UserAccountID);
            }

            ViewBag.UserAccountDetail = uad;
            ViewBag.UserAccount = _ua;

            GetUserContacts(model);

            UserAccountDetail uadLooker = null;

            if (_mu != null)
            {
                uadLooker = new UserAccountDetail();
                uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey));
            }

            if (uadLooker != null &&
                (_mu != null && _ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging))
            {
                var pl = new ProfileLog
                {
                    LookedAtUserAccountID = _ua.UserAccountID,
                    LookingUserAccountID = Convert.ToInt32(_mu.ProviderUserKey)
                };

                if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create();

                ArrayList al = ProfileLog.GetRecentProfileViews(_ua.UserAccountID);

                if (al != null && al.Count > 0)
                {
                    var uas = new UserAccounts();

                    foreach (UserAccount viewwer in al.Cast<int>().Select(id =>
                        new UserAccount(id))
                        .Where(viewwer => !viewwer.IsLockedOut && viewwer.IsApproved)
                        .TakeWhile(viewwer => uas.Count < Maxcountusers))
                    {
                        uas.Add(viewwer);
                    }
                }
            }

            GetUserAccountVideos();

            // this is either a youtube user or this is a band
            var art = new Artist();
            art.GetArtistByAltname(userName);

            if (art.ArtistID > 0)
            {
                // try this way for dashers
                model.UserName = art.Name;
            }

            var vids = new Videos();
            var sngrs = new SongRecords();

            if (art.ArtistID == 0)
            {
                vids.GetAllVideosByUser(userName);

                var uavs = new UserAccountVideos();
                uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'U');

                foreach (Video f2 in uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f2 => !vids.Contains(f2)))
                {
                    vids.Add(f2);
                }

                vids.Sort((x, y) => (y.PublishDate.CompareTo(x.PublishDate)));

                model.UserName = _ua != null ? _ua.UserName : userName;
            }
            else
            {
                GetArtistProfile(art, vids);
            }

            vids.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate));
            sngrs.AddRange(vids.Select(v1 => new SongRecord(v1)));

            if (_mu != null && _ua.UserAccountID != Convert.ToInt32(_mu.ProviderUserKey))
            {
                var uc1 = new UserConnection();

                uc1.GetUserToUserConnection(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey));

                if (uc1.UserConnectionID > 0)
                {
                    switch (uc1.StatusType)
                    {
                        case 'C':
                            if (uc1.IsConfirmed)
                            {
                                model.IsCyberFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeCyberFriend = true;
                            }
                            break;
                        case 'R':
                            if (uc1.IsConfirmed)
                            {
                                model.IsRealFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeRealFriend = true;
                            }
                            break;
                        default:
                            model.IsDeniedCyberFriend = true;
                            model.IsDeniedRealFriend = true;
                            break;
                    }
                }
            }

            if (sngrs.Count == 0 && art.ArtistID == 0 && _ua.UserAccountID == 0)
            {
                // no longer exists
                Response.RedirectPermanent("/");
                return new EmptyResult();
            }

            var sngDisplay = new SongRecords();
            sngDisplay.AddRange(from sr1 in sngrs
                let vidToShow = new Video(sr1.VideoID)
                where vidToShow.IsEnabled
                select sr1);

            model.SongRecords = sngDisplay.VideosList();

            return View(model);
        }
예제 #3
0
        private void GetUserAccountVideos()
        {
            if (_ua.UserAccountID <= 0) return;

            var uavs = new UserAccountVideos();

            uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'F');

            if (uavs.Count <= 0) return;

            var favvids = new Videos();
            favvids.AddRange(uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f1 => f1.IsEnabled));

            var sngrcds2 = new SongRecords();
            sngrcds2.AddRange(favvids.Select(v1 => new SongRecord(v1)));

            sngrcds2.IsUserSelected = true;

            ViewBag.UserFavorites = sngrcds2.VideosList();
        }
예제 #4
0
        public ActionResult Playlist()
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            if (_mu != null) _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey));

            ViewBag.UserName = _ua.UserName;

            var plyst = new Playlist();

            plyst.GetUserPlaylist(_ua.UserAccountID);

            ViewBag.AutoPlay = plyst.AutoPlay;

            ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0;

            ViewBag.UserPlaylistID = plyst.PlaylistID;

            var plyvids = new PlaylistVideos();

            plyvids.GetPlaylistVideosForPlaylist(plyst.PlaylistID);

            var vids = new Videos();
            vids.AddRange(plyvids.Select(plv => new Video(plv.VideoID)));

            var sngrcs = new SongRecords();
            sngrcs.AddRange(vids.Select(vi => new SongRecord(vi)));

            ViewBag.PlaylistVideos = sngrcs.VideoPlaylist();

            return View();
        }
예제 #5
0
        public ActionResult ManageVideos()
        {
            var uavs = new UserAccountVideos();
            if (_mu != null) uavs.GetVideosForUserAccount(Convert.ToInt32(_mu.ProviderUserKey), 'U');

            if (uavs.Count > 0)
            {
                var favvids = new Videos();
                favvids.AddRange(uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f1 => f1.IsEnabled));

                var sngrcds2 = new SongRecords();
                sngrcds2.AddRange(favvids.Select(v1 => new SongRecord(v1)));

                sngrcds2.IsUserSelected = true;
                sngrcds2.EnableChangeOrder = false;

                ViewBag.UserUploaded = sngrcds2.VideoPlaylist();
            }

            return View(uavs);
        }
예제 #6
0
        private bool GetFilteredVideos(bool isAjax, out int? personType, out int? footageType, out int? videoType)
        {
            personType = null;
            footageType = null;
            videoType = null;

            if (!string.IsNullOrEmpty(
                Request.QueryString[SiteEnums.QueryStringNames.videoType.ToString()]))
            {
                videoType = Convert.ToInt32(
                    Request.QueryString[SiteEnums.QueryStringNames.videoType.ToString()]);
            }

            if (!string.IsNullOrEmpty(
                Request.QueryString[SiteEnums.QueryStringNames.personType.ToString()]))
            {
                personType = Convert.ToInt32(
                    Request.QueryString[SiteEnums.QueryStringNames.personType.ToString()]);
            }

            if (!string.IsNullOrEmpty(
                Request.QueryString[SiteEnums.QueryStringNames.footageType.ToString()]))
            {
                footageType = Convert.ToInt32(
                    Request.QueryString[SiteEnums.QueryStringNames.footageType.ToString()]);
            }

            _toShow.GetListFilter(_videoPageNumber, PageSize, personType, footageType, videoType);

            if (isAjax) return true;

            if (_videoPageNumber != 1) return false;

            var sngrcs = new SongRecords();

            sngrcs.AddRange(_toShow.Select(vi => new SongRecord(vi)));

            ViewBag.VideosFiltered = sngrcs.VideosPageList();
            return false;
        }
예제 #7
0
        public JsonResult Items(int pageNumber)
        {
            _videoPageNumber = pageNumber;
            _toShow = new Videos();

            LoadFilteredVideos(true);

            var sngrcs = new SongRecords();
            sngrcs.AddRange(_toShow.Select(vi => new SongRecord(vi)));

            sngrcs.IncludeStateAndEndTag = false;

            return Json(new
            {
                ListItems = sngrcs.VideosPageList()
            });
        }
예제 #8
0
        public ActionResult Index()
        {
            int randomVideo = Video.RandomVideoIDVideo();

            if (randomVideo > 0)
            {
                var randomVid = new Video(randomVideo);
                ViewBag.NewestVideo = randomVid.ProviderKey;
            }

            LoadUserBandViewBag();

            LoadFilteredVideos(false);

            Contest cndss = Lib.BOL.VideoContest.Contest.GetCurrentContest();
            var cvids = new ContestVideos();
            var vidsInContest = new Videos();
            vidsInContest.AddRange(cvids.Select(cv1 => new Video(cv1.VideoID)));
            vidsInContest.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate));
            var sngrcds3 = new SongRecords();
            sngrcds3.AddRange(vidsInContest.Select(v1 => new SongRecord(v1)));

            ViewBag.ContestVideoList = sngrcds3.VideosList();
            ViewBag.CurrentContest = cndss;
            ViewBag.VideoTypes = GetVideoTypes();
            ViewBag.PersonTypes = GetPersonTypes();
            ViewBag.FootageTypes = GetFootageTypes();

            return View();
        }