Exemplo n.º 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            UserAccount ua = new UserAccount();
            ua.GetUserAccountByEmail(txtEmail.Text.Trim());
            if (ua.UserAccountID == 0)
            {
                litResult.Text = @"<span style=""color:red"">Email not found!</span>";
                return;
            }

            UserAccountDetail uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);
            uad.EmailMessages = false;

            if (uad.Update())
            {
                litResult.Text = @"<span style=""color:green"">Unsubscribed!</span>";
            }
            else
            {
                litResult.Text = @"<span style=""color:red"">error!</span>";
            }
        }
Exemplo n.º 2
0
        public ActionResult Register(RegisterModel model)
        {
            if (Utilities.IsSpamIP(Request.UserHostAddress))
            {
                // they are a duplicate IP and are no being referred by an existing user
                ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + Messages.Account);
                return View(model);
            }

            // ignore old browsers and duplicate IPs
            if
                (
                Request.Browser.Type == "IE3" ||
                Request.Browser.Type == "IE4" ||
                Request.Browser.Type == "IE5" ||
                Request.Browser.Type == "IE6" ||
                Request.Browser.Type == "IE7" ||
                BlackIPs.IsIPBlocked(Request.UserHostAddress)

                )
            {
                Response.Redirect("http://browsehappy.com/");
                return View();
            }
            else if (!BootBaronLib.Configs.GeneralConfigs.EnableSameIP &&
                UserAccount.IsAccountIPTaken(Request.UserHostAddress) &&
                string.IsNullOrEmpty(model.RefUser))
            {
                // they are a duplicate IP and are no being referred by an existing user
                ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + Messages.Account);
                return View(model);
            }

            TryUpdateModel(model);

            if (ModelState.IsValid)
            {
                if (!Utilities.IsEmail(model.Email))
                {
                    ModelState.AddModelError("", BootBaronLib.Resources.Messages.IncorrectFormat + ": " + BootBaronLib.Resources.Messages.EMail);
                    return View();
                }
                else if (
                    model.UserName.Trim().Contains(" ") ||
                    model.UserName.Trim().Contains("?") ||
                    model.UserName.Trim().Contains("*") ||
                    model.UserName.Trim().Contains(":") ||
                    model.UserName.Trim().Contains("/") ||
                    model.UserName.Trim().Contains(@"\"))
                {
                    ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.UserName);
                    return View();
                }
                else if (model.YouAreID == null)
                {
                    ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.YouAre);
                    return View();
                }

                DateTime dt = new DateTime();

                if (!DateTime.TryParse(model.Year
                                + "-" + model.Month + "-" + model.Day, out dt))
                {
                    ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.BirthDate);
                    return View();
                }
                else if (DateTime.TryParse(model.Year
                    + "-" + model.Month + "-" + model.Day, out dt))
                {
                    if (Utilities.CalculateAge(dt) < BootBaronLib.Configs.GeneralConfigs.MinimumAge)
                    {
                        ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.BirthDate);
                        return View();
                    }
                }

                model.UserName = model.UserName.Replace(" ", string.Empty).Replace(":", string.Empty) /* still annoying errors */;

                // Attempt to register the user
                MembershipCreateStatus createStatus;

                Membership.CreateUser(model.UserName, model.NewPassword, model.Email, "Q", "A", true, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.RedirectFromLoginPage(model.UserName, true);

                    UserAccount ua = new UserAccount(model.UserName);
                    uad = new UserAccountDetail();
                    uad.UserAccountID = ua.UserAccountID;

                    uad.BirthDate = dt;
                    uad.YouAreID = model.YouAreID;
                    uad.DisplayAge = true;
                    uad.DefaultLanguage = Utilities.GetCurrentLanguageCode();

                    if (!string.IsNullOrEmpty(model.RefUser))
                    {
                        UserAccount refUser = new UserAccount(model.RefUser);
                        uad.ReferringUserID = refUser.UserAccountID;
                    }

                    uad.Set();

                    StringBuilder sb = new StringBuilder(100);

                    sb.Append(Messages.Hello);
                    sb.Append(Environment.NewLine);
                    sb.Append(Messages.YourNewAccountIsReadyForUse);
                    sb.Append(Environment.NewLine);
                    sb.Append(Environment.NewLine);
                    sb.Append(Messages.UserName + ": ");
                    sb.Append(ua.UserName);
                    sb.Append(Environment.NewLine);
                    sb.Append(Messages.Password + ": ");
                    sb.Append(model.NewPassword);
                    sb.Append(Environment.NewLine);
                    sb.Append(BootBaronLib.Configs.GeneralConfigs.SiteDomain);

                    Utilities.SendMail(ua.EMail, Messages.YourNewAccountIsReadyForUse, sb.ToString());

                    // see if this is the 1st user
                    UserAccounts recentUsers = new UserAccounts();
                    recentUsers.GetNewestUsers();

                    if (recentUsers.Count == 1)
                    {
                        Role adminRole = new Role(SiteEnums.RoleTypes.admin.ToString());

                        UserAccountRole.AddUserToRole(ua.UserAccountID, adminRole.RoleID);
                    }

                    return RedirectToAction("editprofile", "Account");
                }
                else
                {
                    ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
                }
            }

            return View(model);
        }
Exemplo n.º 3
0
        public ActionResult MyUsers()
        {
            mu = Membership.GetUser();

            ViewBag.CurrentUserName = mu.UserName;

            if (mu != null)
            {
                uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

                ViewBag.EnableProfileLogging = uad.EnableProfileLogging;

            }

            UserConnections unconfirmedUsers = new UserConnections();
            UserConnections allusrcons = new UserConnections();

            allusrcons.GetUserConnections(Convert.ToInt32(mu.ProviderUserKey));

            foreach (UserConnection uc1 in allusrcons)
            {
                if (!uc1.IsConfirmed && Convert.ToInt32(mu.ProviderUserKey) != uc1.FromUserAccountID)
                {
                    unconfirmedUsers.Add(uc1);
                }
            }

            ViewBag.ApprovalList = unconfirmedUsers.ToUnorderdList;

            ViewBag.BlockedUsers = BootBaronLib.AppSpec.DasKlub.BOL.BlockedUsers.HasBlockedUsers(Convert.ToInt32(mu.ProviderUserKey));

            return View();
        }
Exemplo n.º 4
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                bool remember = Convert.ToBoolean(model.RememberMe);

                if (string.IsNullOrWhiteSpace(model.UserName) ||
                    string.IsNullOrWhiteSpace(model.Password))
                {
                    return View(model);
                }

                ua = new UserAccount(model.UserName);

                if (ua.UserAccountID == 0)
                {
                    ua = new UserAccount();
                    ua.GetUserAccountByEmail(model.UserName);

                    if (ua.UserAccountID > 0)
                    {
                        // they were stupid and put their email not username
                        model.UserName = ua.UserName;
                    }
                }

                if (Membership.ValidateUser(model.UserName, model.Password))
                {
                    FormsAuthentication.RedirectFromLoginPage(model.UserName, remember);

                    if (!String.IsNullOrEmpty(returnUrl))
                    {
                        return Redirect(returnUrl);
                    }
                    else
                    {
                        ua = new UserAccount(model.UserName);

                        if (ua.IsLockedOut)
                        {
                            ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.IsLockedOut);
                            return View(model);
                        }

                        ua.LastLoginDate = DateTime.UtcNow;
                        ua.FailedPasswordAttemptCount = 0;
                        ua.IsOnLine = true;
                        ua.SigningOut = false;
                        ua.Update();

                        UserAccountDetail uad = new UserAccountDetail();
                        uad.GetUserAccountDeailForUser(ua.UserAccountID);
                        //uad.DefaultLanguage = Utilities.GetCurrentLanguageCode();
                        //uad.Update();

                        if (!string.IsNullOrWhiteSpace(uad.DefaultLanguage))
                        {
                            HttpCookie hc =
                                new HttpCookie(SiteEnums.CookieName.usersetting.ToString(), uad.DefaultLanguage);

                            NameValueCollection nvc = new NameValueCollection();
                            nvc.Add(SiteEnums.CookieValue.language.ToString(), uad.DefaultLanguage);

                            Utilities.CookieMaker(SiteEnums.CookieName.usersetting, nvc);

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

                        return RedirectToAction("Home", "Account");
                    }
                }
                else
                {
                    // it updates as online, make off
                    ua = new UserAccount(model.UserName);

                    if (ua.UserAccountID > 0)
                    {
                        ua.IsOnLine = false;
                        ua.SigningOut = true;
                        ua.Update();
                    }
                }
            }

            ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.LoginUnsuccessfulPleaseCorrect);

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Exemplo n.º 5
0
        public ActionResult ProfileDetail(string userName)
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            ua = new UserAccount(userName);

            UserAccountDetail uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

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

            MembershipUser mu = Membership.GetUser();

            ProfileModel model = new ProfileModel();

            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
                {
                    UserConnection 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("Account", "LogOn");
                }

            }

            //
            model.UserName = ua.UserName;
            model.CreateDate = ua.CreateDate;
            model.LastActivityDate = ua.LastActivityDate;
            //
            model.DisplayAge = uad.DisplayAge;
            model.Age = uad.YearsOld;
            model.BandsSeen = uad.BandsSeen;
            model.BandsToSee = uad.BandsToSee;
            model.HardwareAndSoftwareSkills = uad.HardwareSoftware;
            model.MessageToTheWorld = uad.AboutDescription;

            model.YouAreFull = uad.Sex;
            model.InterestedInFull = uad.InterestedFull;
            model.RelationshipStatusFull = uad.RelationshipStatusFull ;
            model.RelationshipStatus = uad.RelationshipStatus;
            model.InterestedIn = uad.InterestedIn;
            model.YouAre = uad.YouAre;

            model.Website = uad.ExternalURL;
            model.CountryCode = uad.Country;
            model.CountryName = uad.CountryName;
            model.IsBirthday = uad.IsBirthdayToday;
            model.ProfilePhotoMain = uad.FullProfilePicURL;
            model.ProfilePhotoMainThumb = uad.FullProfilePicThumbURL;
            model.DefaultLanguage = uad.DefaultLanguage;

            model.EnableProfileLogging = uad.EnableProfileLogging;
            model.Handed = uad.HandedFull;
            model.RoleIcon = uad.SiteBages;

            //
            StatusUpdate 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);

            PhotoItems ptiems = new PhotoItems();
            ptiems.GetUserPhotos(ua.UserAccountID);

            if (ptiems.Count > 0)
            {
                ptiems.Sort((PhotoItem x, PhotoItem y) => (y.CreateDate.CompareTo(x.CreateDate)));

                PhotoItems ptiemsDisplay = new PhotoItems();

                int maxPhotos = 8;

                foreach (PhotoItem pitm1 in ptiems)
                {
                    pitm1.UseThumb = true;
                    if (ptiemsDisplay.Count < maxPhotos)
                    {
                        ptiemsDisplay.Add(pitm1);
                    }
                    else break;
                }

                ptiemsDisplay.UseThumb = true;
                ptiemsDisplay.ShowTitle = false;

                model.HasMoreThanMaxPhotos = (ptiems.Count > maxPhotos);
                ptiemsDisplay.IsUserPhoto = true;
                model.PhotoItems = ptiemsDisplay.ToUnorderdList;
            }

            Contents conts = new Contents();

            conts.GetContentForUser(ua.UserAccountID);

            model.NewsCount = conts.Count;

            if (conts.Count > 0)
            {
                conts.Sort((Content x, Content y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

                Contents displayContents = new Contents();
                int maxCont = 1;
                int currentCount = 0;
                foreach (Content ccn1 in conts)
                {
                    currentCount++;
                    if (maxCont >= currentCount)
                    {
                        displayContents.Add(ccn1);
                    }
                    else break;
                }

                displayContents.IncludeStartAndEndTags = false;

                model.NewsArticles = displayContents.ToUnorderdList;

            }

            model.MetaDescription = ua.UserName + " " + BootBaronLib.Resources.Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(ua.LastActivityDate);

            // playlist
            BootBaronLib.AppSpec.DasKlub.BOL.Playlist plyst = new Playlist();

            plyst.GetUserPlaylist(ua.UserAccountID);

            if (plyst.PlaylistID > 0 && PlaylistVideos.GetCountOfVideosInPlaylist(plyst.PlaylistID) > 0)
            {
                ViewBag.AutoPlay = plyst.AutoPlay;
                ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0;
                ViewBag.UserPlaylistID = plyst.PlaylistID;
            }

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

                if (uad.ShowOnMapLegal)
                {

                    byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty);

                    // 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());

                    Encoding iso = Encoding.GetEncoding("ISO-8859-1");
                    Encoding utf8 = Encoding.UTF8;

                    model.DisplayOnMap = uad.ShowOnMapLegal;

                    Random 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();
                        model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)).ToString();
                    }
                    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;

            UserConnections ucons = new UserConnections();
            ucons.GetUserConnections(ua.UserAccountID);
            ucons.Shuffle();

            UserAccounts irlContacts = new UserAccounts();
            UserAccounts CyberAssociates = new UserAccounts();
            UserAccount userCon = null;

            foreach (UserConnection uc1 in ucons)
            {
                if (!uc1.IsConfirmed) continue;

                switch (uc1.StatusType)
                {
                    case 'C':
                        if (CyberAssociates.Count >= maxcountusers) continue;

                        if (uc1.ToUserAccountID != ua.UserAccountID)
                        {
                            userCon = new UserAccount(uc1.ToUserAccountID);
                        }
                        else
                        {
                            userCon = new UserAccount(uc1.FromUserAccountID);
                        }
                        CyberAssociates.Add(userCon);
                        break;
                    case 'R':
                        if (irlContacts.Count >= maxcountusers) continue;

                        if (uc1.ToUserAccountID != ua.UserAccountID)
                        {
                            userCon = new UserAccount(uc1.ToUserAccountID);
                        }
                        else
                        {
                            userCon = new UserAccount(uc1.FromUserAccountID);
                        }
                        irlContacts.Add(userCon);
                        break;
                    default:
                        break;
                }
            }

            if (irlContacts.Count > 0)
            {
                model.IRLFriendCount = irlContacts.Count;
            }

            if (CyberAssociates.Count > 0)
            {
                // ViewBag.CyberAssociatesCount = Convert.ToString( CyberAssociates.Count );
                model.CyberFriendCount = CyberAssociates.Count;
            }

            mu = Membership.GetUser();
            UserAccountDetail uadLooker = null;

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

            if (mu != null && ua.UserAccountID > 0 &&
                uadLooker.EnableProfileLogging && uad.EnableProfileLogging)
            {
                ProfileLog pl = new ProfileLog();

                pl.LookedAtUserAccountID = ua.UserAccountID;
                pl.LookingUserAccountID = Convert.ToInt32(mu.ProviderUserKey);

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

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

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

                    UserAccount viewwer = null;

                    foreach (int ID in al)
                    {
                        viewwer = new UserAccount(ID);
                        if (!viewwer.IsLockedOut && viewwer.IsApproved)
                        {
                            if (uas.Count >= maxcountusers) break;

                            uas.Add(viewwer);
                        }
                    }

                   // model.ViewingUsers = uas.ToUnorderdList;
                }
            }

            UserAccountVideos uavs = null;

            if (ua.UserAccountID > 0)
            {
                uavs = new UserAccountVideos();

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

                if (uavs.Count > 0)
                {
                    Videos favvids = new Videos();
                    Video f1 = new Video();

                    foreach (UserAccountVideo uav1 in uavs)
                    {
                        f1 = new Video(uav1.VideoID);
                        if (f1.IsEnabled) favvids.Add(f1);
                    }

                    SongRecord sng1 = null;
                    SongRecords sngrcds2 = new SongRecords();

                    foreach (Video v1 in favvids)
                    {
                        sng1 = new SongRecord(v1);
                        sngrcds2.Add(sng1);
                    }

                    sngrcds2.IsUserSelected = true;

                    ViewBag.UserFavorites = sngrcds2.VideosList();//.ListOfVideos();
                }
            }

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

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

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

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

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

                Video f2 = null;

                foreach (UserAccountVideo uav1 in uavs)
                {
                    f2 = new Video(uav1.VideoID);

                    if (!vids.Contains(f2)) vids.Add(f2);
                }

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

                model.UserName = userName;

            }
            else
            {
                // photo
                ArtistProperty aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());

                if (!string.IsNullOrEmpty(aprop.PropertyContent))
                {
                    ViewBag.ArtistPhoto = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                    ViewBag.ThumbIcon = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                }

                // meta descriptione
                aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
                if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent;

                // description
                aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
                if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false);

                #region rss
                ///// rss
                //RssResources rssrs = new RssResources();

                //rssrs.GetArtistRssResource(art.ArtistID);

                //if (rssrs.Count > 0)
                //{
                //    RssItems ritems = new RssItems();
                //    RssItems ritemsOUT = new RssItems();

                //    foreach (RssResource rssre in rssrs)
                //    {
                //        ritems.GetTopRssItemsForResource(rssre.RssResourceID);
                //        //ritm = new RssItem(rssre..ArtistID);
                //    }

                //    ritems.Sort((RssItem x, RssItem y) => (y.PubDate.CompareTo(x.PubDate)));

                //    foreach (RssItem ritm in ritems)
                //    {
                //        if (ritemsOUT.Count < 10)
                //        {
                //            ritemsOUT.Add(ritm);
                //        }
                //    }

                //    ViewBag.ArtistNews = ritemsOUT.ToUnorderdList;
                //}
                //else
                //{
                //    ViewBag.ArtistNews = null;
                //}

                //ViewBag.DisplayName = art.DisplayName;
                #endregion

                Songs sngss = new Songs();

                sngss.GetSongsForArtist(art.ArtistID);

                SongRecord snrcd = new SongRecord();

                foreach (Song sn1 in sngss)
                {
                    vids.GetVideosForSong(sn1.SongID);
                }
            }

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

            foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vids)
            {
                sngrs.Add(new SongRecord(v1));
            }

            if (mu != null && ua.UserAccountID != Convert.ToInt32(mu.ProviderUserKey))
            {
                UserConnection 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 == null || sngrs.Count == 0 && art.ArtistID == 0 && ua.UserAccountID == 0)
            {
                // no longer exists
                Response.RedirectPermanent("/");
                return new EmptyResult();
            }

            //sngrs.Sort((SongRecord x, SongRecord y) => (y.cre.CompareTo(x.CreateDate)));

            SongRecords sngDisplay = new SongRecords();

            Video vidToShow = null;

            foreach (SongRecord sr1 in sngrs)
            {
                vidToShow = new Video(sr1.VideoID);

                if (vidToShow.IsEnabled)
                {
                    sngDisplay.Add(sr1);
                }
            }

            model.SongRecords = sngDisplay.VideosList();

            return View(model);
        }
Exemplo n.º 6
0
        private void LoadVisitorsView(string userName)
        {
            int maxcountusers = 100;
            mu = Membership.GetUser();
            uad = new UserAccountDetail();
            ua = new UserAccount(userName);
            uad.GetUserAccountDeailForUser(ua.UserAccountID);
            UserAccountDetail uadLooker = new UserAccountDetail();
            uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            if (mu != null && ua.UserAccountID > 0 &&
                uad.EnableProfileLogging && uad.EnableProfileLogging)
            {
                ArrayList al = ProfileLog.GetRecentProfileViews(ua.UserAccountID);

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

                    UserAccount viewwer = null;

                    foreach (int ID in al)
                    {
                        viewwer = new UserAccount(ID);
                        if (!viewwer.IsLockedOut && viewwer.IsApproved)
                        {
                            uad = new UserAccountDetail();
                            uad.GetUserAccountDeailForUser(ID);
                            if (uad.EnableProfileLogging == false) continue;

                            if (uas.Count >= maxcountusers) break;

                            uas.Add(viewwer);
                        }
                    }

                    ViewBag.TheViewers = uas.ToUnorderdList;
                }
            }
        }
Exemplo n.º 7
0
        public ActionResult UserAddress()
        {
            LoadCountries();

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            UserAddressModel model = new UserAddressModel();

            BootBaronLib.AppSpec.DasKlub.BOL.UserAddress uadress = new UserAddress();

            uadress.GetUserAddress(ua.UserAccountID);

            if (BootBaronLib.Configs.GeneralConfigs.IsGiveAway && uadress.UserAddressID > 0) return View("NotAllowed");

            if (uadress.UserAddressID == 0)
            {
                model.PostalCode = uad.PostalCode;
                model.Country = uad.Country;
            }
            else
            {
                model.AddressLine1 = uadress.AddressLine1;
                model.AddressLine2 = uadress.AddressLine2;
                model.AddressLine3 = uadress.AddressLine3;
                model.City = uadress.City;
                model.Country = uadress.CountryISO;
                model.FirstName = uadress.FirstName;
                model.LastName = uadress.LastName;
                model.PostalCode = uadress.PostalCode;
                model.RegionState = uadress.Region;
            }

            return View(model);
        }
Exemplo n.º 8
0
        public ActionResult Settings(NameValueCollection nvc)
        {
            ViewBag.IsValid = true;

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();

            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            string enableProfileLogging = Request.Form["enableprofilelogging"];
            string emailmessages = Request.Form["emailmessages"];
            string showonmap = Request.Form["showonmap"];
            string displayAge = Request.Form["displayage"];
            string membersOnlyProfile = Request.Form["membersonlyprofile"];

            if (!string.IsNullOrEmpty(membersOnlyProfile))
                uad.MembersOnlyProfile = true;
            else uad.MembersOnlyProfile = false;

            if (!string.IsNullOrEmpty(enableProfileLogging))
                uad.EnableProfileLogging = true;
            else uad.EnableProfileLogging = false;

            if (!string.IsNullOrEmpty(displayAge))
                uad.DisplayAge = true;
            else uad.DisplayAge = false;

            if (!string.IsNullOrEmpty(emailmessages))
                uad.EmailMessages = true;
            else uad.EmailMessages = false;

            if (!string.IsNullOrEmpty(showonmap))
                uad.ShowOnMap = true;
            else uad.ShowOnMap = false;

            uad.Set();

            string username = Request.Form["username"].Trim();
            bool isNewUserName = false;
            bool isValidName = false;

            try
            {
                isValidName = !System.Text.RegularExpressions.Regex.IsMatch(@"[A-Za-z][A-Za-z0-9_]{3,14}", username);
            }
            catch
            {
                // bad name
                isValidName = false;
            }

            if (mu.UserName != username && isValidName)
            {
                // TODO: PUT IN ALL THE SAME VALIDATION AS REGISTRATION
                isNewUserName = true;
                UserAccount newUsername = new UserAccount(username.Replace(":", string.Empty) /* still annoying errors */);

                if (newUsername.UserAccountID != 0)
                {
                    ViewBag.IsValid = false;
                    ModelState.AddModelError("", BootBaronLib.Resources.Messages.AlreadyInUse + ": " + BootBaronLib.Resources.Messages.UserName);
                    uad = new UserAccountDetail();

                    uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));
                    mu = Membership.GetUser();

                    ViewBag.UserAccountDetail = uad;
                    ViewBag.Membership = mu;
                    return View();
                }
                else
                {
                    if (!Utilities.IsEmail(Request.Form["email"]))
                    {
                        ViewBag.IsValid = false;
                        ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.EMail);
                        return View();
                    }
                    else if (Request.Form["email"].Trim() != ua.EMail)
                    {
                        ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));
                        ua.EMail = Request.Form["email"];
                        ua.Update();
                    }

                    ua.UserName = username;
                    ua.Update();
                    FormsAuthentication.SetAuthCookie(username, false);
                    ViewBag.IsValid = true;
                }
            }
            else if (!Utilities.IsEmail(Request.Form["email"]))
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError("", BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.EMail);
                return View();
            }
            else if (Request.Form["email"].Trim() != ua.EMail)
            {
                ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));
                ua.EMail = Request.Form["email"];
                ua.Update();
            }

            ViewBag.ProfileUpdated = true;

            uad = new UserAccountDetail();

            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));
            mu = Membership.GetUser();

            ViewBag.UserAccountDetail = uad;
            ViewBag.Membership = mu;

            if (isNewUserName)
            {
                // new username
                Response.Redirect("~/account/settings/?updated=1");
            }

            return View();
        }
Exemplo n.º 9
0
        public ActionResult Index()
        {
            InterestIdentityViewBags();

            FindUsersModel model = new FindUsersModel();

            LoadFilteredUsers(false, model);

            ViewBag.FilteredUsers = uas.ToUnorderdList;

            // random
            Role rle = new Role(SiteEnums.RoleTypes.cyber_girl.ToString());

            UserAccounts girlModels = UserAccountRole.GetUsersInRole(rle.RoleID);

            if (girlModels!= null && girlModels.Count > 0)
            {
                BootBaronLib.Operational.StaticHelper.Shuffle(girlModels);

                UserAccount featuredModel = girlModels[0];

                UserAccountDetail featuredPhoto = new UserAccountDetail();
                featuredPhoto.GetUserAccountDeailForUser(featuredModel.UserAccountID);

                int photoNumber = Utilities.RandomNumber(1, 4);

                string photoPath = featuredPhoto.FullProfilePicURL;

                if (photoNumber > 1)
                {
                    UserPhotos ups = new UserPhotos();

                    ups.GetUserPhotos(featuredModel.UserAccountID);

                    if (ups.Count > 0)
                    {
                        foreach (UserPhoto up1 in ups)
                        {
                            if ((up1.RankOrder + 1) == photoNumber)
                            {
                                photoPath = up1.FullProfilePicURL;
                                break;
                            }
                        }
                    }
                }

                // random border color with random user pic from their 3 photos
                string[] colorBorder = BootBaronLib.Configs.GeneralConfigs.RandomColors.Split(',');

                Random rnd=new Random();
                string[] myRandomArray = colorBorder.OrderBy(x => rnd.Next()).ToArray();

                ViewBag.FeaturedModel = string.Format(@"
            <a class=""m_over"" href=""{1}"">
            <img src=""{0}"" class=""featured_user"" style="" border: 2px dashed {2}; "" /></a>", photoPath,
            featuredModel.UrlTo.ToString(), myRandomArray[0]);
            }

            return View(model);
        }
Exemplo n.º 10
0
        public void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(Request.QueryString[SiteEnums.QueryStringNames.language.ToString()]) && User != null)
            {
                MembershipUser mu = Membership.GetUser();

                if (mu != null)
                {
                    UserAccountDetail uad = new UserAccountDetail();
                    uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

                    string language = Request.QueryString[SiteEnums.QueryStringNames.language.ToString()];

                    uad.DefaultLanguage = language;
                    uad.Update();
                }
            }
        }
Exemplo n.º 11
0
        private void SendNotificationEmail(int userTo, SiteEnums.ResponseType rsp, int statusUpdateID)
        {
            UserAccount uaTo = new UserAccount(userTo);

            UserAccountDetail uad = new UserAccountDetail();

            uad.GetUserAccountDeailForUser(uaTo.UserAccountID);

            string language = Utilities.GetCurrentLanguageCode();
            // change language for message to
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(uad.DefaultLanguage);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(uad.DefaultLanguage);

            string typeGiven = string.Empty;

            if (rsp == SiteEnums.ResponseType.A)
            {
                typeGiven = Messages.Applauded;
            }
            else if (rsp == SiteEnums.ResponseType.B)
            {
                typeGiven = Messages.BeatenDown;
            }
            else if (rsp == SiteEnums.ResponseType.C)
            {
                typeGiven = Messages.Commented;
            }
            else
            {
                typeGiven = Messages.Unknown;
            }

            string statupMess = typeGiven + Environment.NewLine + Environment.NewLine +  BootBaronLib.Configs.GeneralConfigs.SiteDomain +
                System.Web.VirtualPathUtility.ToAbsolute("~/account/statusupdate/" + statusUpdateID.ToString() );

            if (uad.EmailMessages)
            {
                Utilities.SendMail(uaTo.EMail, Messages.New + ": " + Messages.Notifications,
                    Messages.New + ": " + Messages.Notifications + Environment.NewLine + Environment.NewLine +
                    statupMess  );
            }

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(language);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(language);
        }
Exemplo n.º 12
0
        public void Send(string message, int userAccountID)
        {
            if (string.IsNullOrWhiteSpace(message) || (userAccountID == 0)) return;

            ChatRoom cr = new ChatRoom();

            cr.ChatMessage = message;
            cr.CreatedByUserID = userAccountID;
            cr.Create();

            BootBaronLib.AppSpec.DasKlub.BOL.UserAccountDetail uad = new BootBaronLib.AppSpec.DasKlub.BOL.UserAccountDetail();
            uad.GetUserAccountDeailForUser(userAccountID);
            string userFace = string.Format(@"<div class=""user_face"">{0}</div>", uad.UserFace);

            if (!message.Contains("CONNECTION OPENED") && !message.Contains("CONNECTION CLOSED") && !message.Contains("RECONNECT"))
            {
                message = HttpUtility.HtmlEncode(message);
                message = Video.IFrameVideo(message);
            }

            // Call the addMessage method on all clients
            Clients.addMessage(string.Format(@"{2} <span style=""font-size:10px"">{0}</span> <span style=""font-size:14px;color:#FFF;font-family: ‘Lucida Sans Unicode’, ‘Lucida Grande’, sans-serif;"">{1}</span>", DateTime.UtcNow.ToString("u"), message, userFace));
        }
Exemplo n.º 13
0
        public ActionResult UpdateRoles(int userAccountID, string[] roleOption)
        {
            UserAccount ua = new UserAccount(userAccountID);

            // delete all their roles
            UserAccountRole.DeleteUserRoles(userAccountID);

            foreach (string newRole in roleOption)
            {
               Role thenewRole = new Role(newRole);

               UserAccountRole.AddUserToRole(userAccountID, thenewRole.RoleID);
            }

            if (ua.UserAccountID > 0)
            {
                ViewBag.SelectedUser = ua;
                UserAccountDetail uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua.UserAccountID);
                ViewBag.UserAccountDetail = uad;
            }

            LoadAllRoles();

            return View("UserManagement");
        }
Exemplo n.º 14
0
        public ActionResult FindByUsername(string username)
        {
            UserAccount ua = new UserAccount(username);

            if (ua.UserAccountID > 0)
            {
                ViewBag.SelectedUser = ua;
                UserAccountDetail uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua.UserAccountID);
                ViewBag.UserAccountDetail = uad;
            }

            LoadAllRoles();

            return View("UserManagement");
        }
Exemplo n.º 15
0
        public ActionResult Send()
        {
            string displayname = Request.Form["displayname"];
            string msg = Request.Form["message"];

            ua = new UserAccount(displayname);
            mu = Membership.GetUser();

            if (string.IsNullOrEmpty(msg) ||
                BootBaronLib.AppSpec.DasKlub.BOL.
                BlockedUser.IsBlockedUser(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey))
                )
            {
                return RedirectToAction("Reply", new { @userName = displayname });
            }

            DirectMessage dm = new DirectMessage();

            //dm.GetMostRecentSentMessage(Convert.ToInt32(mu.ProviderUserKey));

            //DateTime dbtime = Utilities.GetDataBaseTime();

            //TimeSpan tsLastPst = dbtime.Subtract(dm.CreateDate);

            //if (tsLastPst.TotalSeconds < 5 && tsLastPst.TotalSeconds > 0)
            //{
            //    return RedirectToAction("Reply", new { @userName = displayname });
            //}

            dm = new DirectMessage();
            dm.IsRead = false;
            dm.FromUserAccountID = Convert.ToInt32(mu.ProviderUserKey);
            dm.ToUserAccountID = ua.UserAccountID;
            dm.Message = msg;
            dm.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);

            dm.Create();

            string language = Utilities.GetCurrentLanguageCode();
            // change language for message to

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(uad.DefaultLanguage);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(uad.DefaultLanguage);

            StringBuilder sb = new StringBuilder();

            sb.Append(BootBaronLib.Resources.Messages.Hello);
            sb.Append(",");
            sb.AppendLine(Environment.NewLine);
            sb.AppendLine(Environment.NewLine);
            sb.AppendFormat("{0}: ", BootBaronLib.Resources.Messages.From);
            sb.Append(BootBaronLib.Configs.GeneralConfigs.SiteDomain);
            sb.Append("/");
            sb.Append(mu.UserName);
            sb.AppendLine(Environment.NewLine);
            sb.AppendFormat("{0}: ", BootBaronLib.Resources.Messages.Message);
            sb.AppendLine(msg);
            sb.AppendLine(Environment.NewLine);
            sb.AppendFormat("{0}: {1}", BootBaronLib.Resources.Messages.SignIn, BootBaronLib.Configs.GeneralConfigs.SiteDomain);
            sb.AppendLine(Environment.NewLine);

            if (uad.EmailMessages)
            {
                Utilities.SendMail(ua.EMail,
                    BootBaronLib.Resources.Messages.From + ": " + mu.UserName, sb.ToString());
            }

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(language);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(language);

            return RedirectToAction("Reply", new { @userName = displayname });
        }
Exemplo n.º 16
0
        public ActionResult EditPhoto()
        {
            mu = Membership.GetUser();
            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            LoadCurrentImagesViewBag(Convert.ToInt32(mu.ProviderUserKey));

            return View(uad);
        }
Exemplo n.º 17
0
        public ActionResult Settings()
        {
            ViewBag.IsValid = true;

            mu = Membership.GetUser();

            uad = new UserAccountDetail();

            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            ViewBag.UserAccountDetail = uad;
            ViewBag.Membership = mu;

            return View(uad);
        }
Exemplo n.º 18
0
        public ActionResult EditPhotoDelete()
        {
            string str = Request.Form["delete_photo"];

            mu = Membership.GetUser();
            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            S3Service s3 = new S3Service();

            s3.AccessKeyID = AmazonCloudConfigs.AmazonAccessKey;
            s3.SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey;

            if (str == "1")
            {
                try
                {

                    if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, uad.ProfilePicURL))
                    {
                        s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, uad.ProfilePicURL);
                    }

                    if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, uad.ProfileThumbPicURL))
                    {
                        s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, uad.ProfileThumbPicURL);
                    }

                }
                catch
                {
                    // whatever
                }

                uad.ProfileThumbPicURL = string.Empty;
                uad.ProfilePicURL = string.Empty;
                uad.Update();
            }
            else if (str == "2" || str == "3")
            {
                ups = new UserPhotos();
                ups.GetUserPhotos(uad.UserAccountID);

                foreach (UserPhoto up1 in ups)
                {
                    try
                    {
                        if ((up1.RankOrder == 1 && str == "2") || (up1.RankOrder == 2 && str == "3"))
                        {
                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, up1.PicURL))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, up1.PicURL);
                            }

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, up1.ThumbPicURL))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, up1.ThumbPicURL);
                            }

                            up1.Delete();
                        }
                    }
                    catch
                    {
                        // whatever
                    }
                }

                // update ranking
                ups = new UserPhotos();
                ups.GetUserPhotos(uad.UserAccountID);

                if (ups.Count == 1 && ups[0].RankOrder == 2)
                {
                    ups[0].RankOrder = 1;
                    ups[0].Update();
                }
            }

            Response.Redirect("~/account/editphoto");

            return new EmptyResult();
        }
Exemplo n.º 19
0
        public ActionResult UserAddress(UserAddressModel model)
        {
            LoadCountries();

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            BootBaronLib.AppSpec.DasKlub.BOL.UserAddress uadress = new UserAddress();

            uadress.GetUserAddress(ua.UserAccountID);

            TryUpdateModel(model);

            if (ModelState.IsValid)
            {
                uadress.AddressLine1 = model.AddressLine1;
                uadress.AddressLine2 = model.AddressLine2;
                uadress.AddressLine3 = model.AddressLine3;
                uadress.City = model.City;
                uadress.CountryISO = model.Country;
                uadress.FirstName = model.FirstName;
                uadress.LastName = model.LastName;
                uadress.PostalCode = model.PostalCode;
                uadress.Region = model.RegionState;
                uadress.UserAccountID = ua.UserAccountID;

                if (uadress.UserAddressID == 0) uadress.AddressStatus = 'U';

                ViewBag.ProfileUpdated = uadress.Set();
            }
            //if (BootBaronLib.AppSpec.DasKlub.BOL.UserAddress.IsBlank(ua.UserAccountID))
            //{
            //    newUAdd.UserAccountID = ua.UserAccountID;
            //    newUAdd.CreatedByUserID = ua.UserAccountID;

            //    if (Request.Form["no_button"] != null &&
            //        Request.Form["no_button"] == "no")
            //    {
            //        newUAdd.AddressStatus = 'N';
            //    }
            //    else
            //    {
            //        newUAdd.AddressStatus = 'U';
            //    }

            //    if (!string.IsNullOrEmpty(newUAdd.PostalCode) && (string.IsNullOrEmpty(newUAdd.City) || string.IsNullOrEmpty(newUAdd.Region)))
            //    {
            //        // for those those who think the system can figure them out
            //        SiteEnums.CountryCodeISO coiso = GeoData.GetCountryISOForCountryCode(newUAdd.CountryISO);

            //        SiteStructs.CityRegion cr = GeoData.GetCityRegionForPostalCodeCountry(newUAdd.PostalCode, coiso);

            //        newUAdd.Region = cr.Region;
            //        newUAdd.City = cr.CityName;
            //    }

            //    newUAdd.Create();
            //}
            ////Response.Redirect("/" + ua.UserName);
            //Response.Redirect("~/thanks.htm");

            //uad = new UserAccountDetail();
            //uad.GetUserAccountDeailForUser(ua.UserAccountID);

            return View(model);
        }
Exemplo n.º 20
0
        public ActionResult EditProfile()
        {
            ViewBag.IsValid = true;

            mu = Membership.GetUser();

            uad = new UserAccountDetail();

            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            LoadCountries();

            InterestIdentityViewBags();

            return View(uad);
        }
Exemplo n.º 21
0
        public ActionResult Visitors()
        {
            mu = Membership.GetUser();
            uad = new UserAccountDetail();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            if (ua.IsAdmin)
            {
                ViewBag.AdminLink = "/m/auth/default.aspx";
            }

            uad.GetUserAccountDeailForUser(ua.UserAccountID);
            UserAccountDetail uadLooker = new UserAccountDetail();
            uadLooker.GetUserAccountDeailForUser(ua.UserAccountID);

            UserConnections unconfirmedUsers = new UserConnections();
            UserConnections allusrcons = new UserConnections();

            allusrcons.GetUserConnections(Convert.ToInt32(mu.ProviderUserKey));

            foreach (UserConnection uc1 in allusrcons)
            {
                if (!uc1.IsConfirmed && Convert.ToInt32(mu.ProviderUserKey) != uc1.FromUserAccountID)
                {
                    unconfirmedUsers.Add(uc1);
                }
            }

            ViewBag.ApprovalList = unconfirmedUsers.ToUnorderdList;

            ViewBag.BlockedUsers = BootBaronLib.AppSpec.DasKlub.BOL.BlockedUsers.HasBlockedUsers(Convert.ToInt32(mu.ProviderUserKey));

            ViewBag.EnableProfileLogging = uad.EnableProfileLogging;

            LoadVisitorsView(ua.UserName);

            return View();
        }
Exemplo n.º 22
0
        public ActionResult EditProfile(UserAccountDetail uad)
        {
            // must change culture because decimal will not be correct for long/ lat
            string currentLang = Utilities.GetCurrentLanguageCode();

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

            LoadCountries();
            InterestIdentityViewBags();

            mu = Membership.GetUser();

            UserAccountDetail uadCurrent = new UserAccountDetail();
            uadCurrent.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);
            uadCurrent.GetUserAccountDeailForUser(uadCurrent.UserAccountID);

            ViewBag.IsValid = true;
            ViewBag.ProfileUpdated = false;

            DateTime dt = new DateTime();

            if (DateTime.TryParse(Request.Form["birthyear"]
                + "-" + Request.Form["birthmonth"] + "-" + Request.Form["birthday"], out dt))
            {
                uad.BirthDate = dt;
            }
            else
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.BirthDate);
                return View(uad);
            }

            if (string.IsNullOrEmpty(uad.Country) || uad.Country == Messages.DashSelect)
            {
                uad.Country = string.Empty;
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.Country);
                return View(uad);
            }

            if (string.IsNullOrEmpty(uad.PostalCode))
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.PostalCode);
                return View(uad);
            }

            if (uad.YouAreID == null)
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.YouAre);
                return View(uad);
            }

            if (uad.InterestedInID == null)
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.InterestedIn);
                return View(uad);
            }

            if (!string.IsNullOrEmpty(uad.ExternalURL.Trim()) &&
                !Uri.IsWellFormedUriString(uad.ExternalURL, UriKind.Absolute))
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Invalid + ": " + BootBaronLib.Resources.Messages.Website);
                return View(uad);
            }

            bool isNewProfile = false;

            if (string.IsNullOrEmpty(uad.Country.Trim()))
            {
                isNewProfile = true;
            }

            uadCurrent.AboutDesc = uad.AboutDesc;
            uadCurrent.HardwareSoftware = uad.HardwareSoftware;
            uadCurrent.BirthDate = uad.BirthDate;
            uadCurrent.YouAreID = uad.YouAreID;
            uadCurrent.ExternalURL = uad.ExternalURL;
            uadCurrent.Country = uad.Country;
            uadCurrent.PostalCode = uad.PostalCode;
            uadCurrent.BandsSeen = uad.BandsSeen;
            uadCurrent.BandsToSee = uad.BandsToSee;
            uadCurrent.RelationshipStatusID = uad.RelationshipStatusID;
            uadCurrent.InterestedInID = uad.InterestedInID;
            uadCurrent.FirstName = uad.FirstName;
            uadCurrent.LastName = uad.LastName;

            if (!string.IsNullOrWhiteSpace(uad.Country) &&
                !string.IsNullOrWhiteSpace(uad.PostalCode))
            {
                SiteStructs.LatLong latlong =
                GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);

                if (latlong.latitude != 0 && latlong.longitude != 0)
                {
                    uad.Latitude = Convert.ToDecimal(latlong.latitude);
                    uad.Longitude = Convert.ToDecimal(latlong.longitude);

                    uadCurrent.Latitude = uad.Latitude;
                    uadCurrent.Longitude = uad.Longitude;
                }
            }

            if (uadCurrent.Set() > 0)
            {
                ViewBag.ProfileUpdated = true;
            }
            else
            {
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.Error);
            }

            if (isNewProfile)
            {
                return RedirectToAction("EditPhoto");
            }

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

            return View(uad);
        }
Exemplo n.º 23
0
        public ActionResult EditPhoto(HttpPostedFileBase file)
        {
            mu = Membership.GetUser();
            UserPhoto up1 = null;
            int swapID = 0;

            var acl = CannedAcl.PublicRead;

            S3Service s3 = new S3Service();

            s3.AccessKeyID = AmazonCloudConfigs.AmazonAccessKey;
            s3.SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey;

            if (Request.Form["new_default"] != null &&
                int.TryParse(Request.Form["new_default"], out swapID))
            {
                // swap the default with the new default
                uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

                string currentDefaultMain = uad.ProfilePicURL;
                string currentDefaultMainThumb = uad.ProfileThumbPicURL;

                up1 = new UserPhoto(swapID);

                uad.ProfilePicURL = up1.PicURL;
                uad.ProfileThumbPicURL = up1.ThumbPicURL;
                uad.LastPhotoUpdate = DateTime.UtcNow;
                uad.Update();

                up1.PicURL = currentDefaultMain;
                up1.ThumbPicURL = currentDefaultMainThumb;
                up1.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                up1.Update();

                LoadCurrentImagesViewBag(Convert.ToInt32(mu.ProviderUserKey));

                return View(uad);
            }

            string photoOne = "photo_edit_1";
            string photoTwo = "photo_edit_2";
            string photoThree = "photo_edit_3";

            LoadCurrentImagesViewBag(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

            if (file == null)
            {
                ViewBag.IsValid = false;
                ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.NoFile);
                return View(uad);
            }

            string photoEdited = Request.Form["photo_edit"];
            string mainPhotoToDelete = string.Empty;
            string thumbPhotoToDelete = string.Empty;

            ups = new UserPhotos();
            ups.GetUserPhotos(uad.UserAccountID);

            if (string.IsNullOrEmpty(uad.ProfilePicURL) ||
                ups.Count == 2 && photoEdited == photoOne)
            {
                mainPhotoToDelete = uad.ProfilePicURL;
                thumbPhotoToDelete = uad.ProfileThumbPicURL;
            }
            else
            {
                if (ups.Count > 1 && photoEdited == photoTwo)
                {
                    up1 = new UserPhoto(ups[0].UserPhotoID);
                    up1.RankOrder = 1;
                    mainPhotoToDelete = up1.PicURL;
                    thumbPhotoToDelete = up1.ThumbPicURL;
                }
                else if (ups.Count > 1 && photoEdited == photoThree)
                {
                    up1 = new UserPhoto(ups[1].UserPhotoID);
                    up1.RankOrder = 2;
                    mainPhotoToDelete = ups[1].FullProfilePicURL;
                    thumbPhotoToDelete = up1.ThumbPicURL;
                }

            }

            if (!string.IsNullOrEmpty(mainPhotoToDelete))
            {
                // delete the existing photos
                try
                {

                    if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, mainPhotoToDelete))
                    {
                        s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, mainPhotoToDelete);
                    }

                    if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, thumbPhotoToDelete))
                    {
                        s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, thumbPhotoToDelete);
                    }
                }
                catch
                {
                    // whatever
                }
            }

            Bitmap b = new Bitmap(file.InputStream);

            // full
            System.Drawing.Image fullPhoto = (System.Drawing.Image)b;

            fullPhoto = ImageResize.FixedSize(fullPhoto, 300, 300, System.Drawing.Color.Black);

            string fileNameFull = Utilities.CreateUniqueContentFilename(file);

            Stream maker = fullPhoto.ToAStream(ImageFormat.Jpeg);

            s3.AddObject(
                maker,
                maker.Length,
                AmazonCloudConfigs.AmazonBucketName,
                fileNameFull,
                file.ContentType,
                acl);

            if (string.IsNullOrEmpty(uad.ProfileThumbPicURL) ||
                ups.Count == 2 && photoEdited == photoOne)
            {
                uad.ProfilePicURL = fileNameFull;
            }
            else
            {
                if (up1 == null)
                {
                    up1 = new UserPhoto();
                }

                up1.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);
                up1.PicURL = fileNameFull;

                if ((ups.Count > 0 && photoEdited == photoTwo) || (ups.Count == 0))
                {
                    up1.RankOrder = 1;
                }
                else if ((ups.Count > 1 && photoEdited == photoThree) || ups.Count == 1)
                {
                    up1.RankOrder = 2;
                }

                if (ups.Count == 1 && ups[0].RankOrder == 2)
                {
                    ups[0].RankOrder = 1;
                    ups[0].Update();
                }
            }

            fullPhoto = (System.Drawing.Image)b;

            fullPhoto = ImageResize.FixedSize(fullPhoto, 75, 75, System.Drawing.Color.Black);

            fileNameFull = Utilities.CreateUniqueContentFilename(file);

            maker = fullPhoto.ToAStream(ImageFormat.Jpeg);

            s3.AddObject(
                maker,
                maker.Length,
                AmazonCloudConfigs.AmazonBucketName,
                fileNameFull,
                file.ContentType,
                acl);

            //// thumb

            if (string.IsNullOrEmpty(uad.ProfileThumbPicURL) ||
                ups.Count == 2 && photoEdited == photoOne)
            {
                uad.ProfileThumbPicURL = fileNameFull;
                uad.LastPhotoUpdate = DateTime.UtcNow;
                uad.Set();
            }
            else
            {
                up1.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);
                up1.ThumbPicURL = fileNameFull;

                if (
                    (ups.Count == 0 && photoEdited == photoTwo) ||
                    (ups.Count > 0 && photoEdited == photoTwo)
                    )
                {
                    up1.RankOrder = 1;
                }
                else if
                    (
                    (ups.Count == 0 && photoEdited == photoThree) ||
                    (ups.Count > 1 && photoEdited == photoThree)
                    )
                {
                    up1.RankOrder = 2;
                }
            }

            b.Dispose();

            if (up1 != null && up1.UserPhotoID == 0)
            {
                up1.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                up1.Create();
            }
            else if (up1 != null && up1.UserPhotoID > 0)
            {
                up1.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                up1.Update();
            }

            LoadCurrentImagesViewBag(Convert.ToInt32(mu.ProviderUserKey));

            return View(uad);
        }
Exemplo n.º 24
0
        public ActionResult Frame()
        {
            CultureInfo usa = new CultureInfo("en-US");

            MembershipUser mu = Membership.GetUser();

                    SiteStructs.LatLong userLatLong = new SiteStructs.LatLong();
            userLatLong.latitude = 0;
            userLatLong.longitude = 0;
            UserAccountDetail uad = null;

            if (mu != null)
            {

                UserAccount ua = new UserAccount(mu.UserName);
                uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua.UserAccountID);
                //if (!string.IsNullOrEmpty(uad.PostalCode))
                //{
                //    userLatLong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);
                //}

                userLatLong.longitude = Convert.ToDouble(uad.Longitude);
                userLatLong.latitude = Convert.ToDouble(uad.Latitude);
            }

            Random rnd = new Random();

            // map

            MapModel mapPoints = new MapModel();

            mapPoints.MapPoints = new List<MapPoint>();
            MapPoint mPoint = null;

            // users
            UserAccounts uas = new UserAccounts();
            uas.GetMappableUsers();
            int offset = 0;

            // 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());

            foreach (UserAccount u1 in uas)
            {
                uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(u1.UserAccountID);

                if (uad.UserAccountDetailID == 0 || !uad.ShowOnMapLegal) continue;

                if (uad.Longitude == null || uad.Latitude == null || uad.Longitude == 0 || uad.Latitude == 0) continue;

                mPoint = new MapPoint();
                offset = rnd.Next(10, 100);

                // BUG: language adding incorrect
                mPoint.Latitude = Convert.ToDouble(Convert.ToDecimal(uad.Latitude) + Convert.ToDecimal("0.00" + offset));
                mPoint.Longitude = Convert.ToDouble(Convert.ToDecimal(uad.Longitude) + Convert.ToDecimal("0.00" + offset));

                u1.IsProfileLinkNewWindow = true;
                mPoint.Message = string.Format(@"<ul class=""user_list"">{0}</ul>",
               u1.ToUnorderdListItem);// in javascript, escape
                mPoint.Icon = uad.GenderIconLinkDark;
                mapPoints.MapPoints.Add(mPoint);
            }

            // venues

            Venues vnus = new Venues();
            vnus.GetAll();

            foreach (Venue v1 in vnus)
            {
                if (v1.Latitude == 0 || v1.Longitude == 0) continue;

                mPoint = new MapPoint();
                mPoint.Icon = v1.VenueTypeIcon;
                mPoint.Latitude = Convert.ToDouble(v1.Latitude);
                mPoint.Longitude = Convert.ToDouble(v1.Longitude);
                mPoint.Message = v1.MapText ;
                mapPoints.MapPoints.Add(mPoint);
            }

            string longI = userLatLong.longitude.ToString(usa);

            string latI = userLatLong.latitude.ToString(usa);

            StringBuilder sb = new StringBuilder();

            sb.Append(@"
            var map;
            var infowindow;
            function InitializeMap() { ");

            sb.AppendFormat(@"
            var latlng = new google.maps.LatLng({0}, {1});",
            latI, longI);

            if (mu != null && userLatLong.longitude != 0 && userLatLong.latitude != 0)
            {
                // zoom in on user
                sb.Append(@"
            var myOptions =
            {
            zoom: 8,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
            };");
            }
            else
            {
                // zoom out
                sb.Append(@"
            var myOptions =
            {
            zoom: 2,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
            };");
            }

            sb.Append(@"
            map = new google.maps.Map(document.getElementById(""map""), myOptions);
            }
             function markicons() {

            InitializeMap();

            var ltlng = [];
            var details = [];
            var iconType = [];");

            byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty);

            Encoding iso = Encoding.GetEncoding("ISO-8859-1");
            Encoding utf8 = Encoding.UTF8;

            foreach (DasKlub.Models.MapPoint mp1 in mapPoints.MapPoints)
            {

                if (mp1.Latitude == 0 || mp1.Longitude == 0) continue;

                byte[] utfBytes = utf8.GetBytes(mp1.Message.Replace(@"'", @"\'"));
                byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
                string msg = iso.GetString(isoBytes);

                  longI = mp1.Latitude.ToString(usa);

                  latI = mp1.Longitude.ToString(usa);

            //                sb.AppendFormat(@"
                    //ltlng.push(new google.maps.LatLng({0}, {1}));
                sb.Append(@" ltlng.push(new google.maps.LatLng(");
                sb.Append(longI);
                sb.Append(" , ");
                sb.Append(latI);
                sb.Append(@" )); ");

              //  {0}, {1}));

            sb.AppendFormat(@" details.push('{0}');
                    iconType.push('{1}');
                    " ,
                    msg, mp1.Icon);
            }

            sb.Append(@"
            for (var i = 0; i <= ltlng.length; i++) {

            marker = new google.maps.Marker({
                map: map,
                position: ltlng[i],
                icon: iconType[i]
            });

            (function (i, marker) {

                google.maps.event.addListener(marker, 'click', function () {

                    if (!infowindow) {
                        infowindow = new google.maps.InfoWindow();
                    }

                infowindow.setContent(details[i]);
                    infowindow.open(map, marker);

                });

            })(i, marker);
            }

            }

            window.onload = markicons; ");

            ViewBag.MapScript = sb.ToString( );

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

            return View();
        }