Esempio n. 1
0
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(Request.QueryString[SiteEnums.QueryStringNames.language.ToString()]) ||
                User == null) return;
            MembershipUser mu = MembershipWrapper.GetUser();

            if (mu == null) return;
            var uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));

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

            uad.DefaultLanguage = language;
            uad.Update();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string email = Server.UrlDecode(Request.QueryString[SiteEnums.QueryStringNames.email.ToString()]);

            string autoUnSub = Server.UrlDecode(Request.QueryString[SiteEnums.QueryStringNames.autounsubscribe.ToString()]);

            if (!string.IsNullOrWhiteSpace(email) &&
                !string.IsNullOrWhiteSpace(autoUnSub))
            {
                var ua = new UserAccount();
                ua.GetUserAccountByEmail(email);
                var uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua.UserAccountID);
                uad.EmailMessages = false;

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

            var 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>";
            }
        }
Esempio n. 4
0
        private void SendMassMail(string message)
        {
            _mail = new MailService();

            int totalSent = 0;

            var uas = new UserAccounts();
            uas.GetAll();

            foreach (UserAccount ua1 in uas.OrderBy(x => x.CreateDate))
            {
                var uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua1.UserAccountID);

                if (!uad.EmailMessages) continue;

                // safety
               if (ua1.UserName != "bootlegbaron") continue;

                var userAddress = new UserAddress();
                userAddress.GetUserAddress(ua1.UserAccountID);

                System.Threading.Thread.Sleep(200);

                if (_mail.SendMail("*****@*****.**", ua1.EMail, "Das Klub Kalendar 2017 - Competition!", message))
                {
                    totalSent++;
                }
                else
                {
                    uad.EmailMessages = false;
                    uad.Update();
                }
            }

            HttpContext.Current.Response.Write(totalSent);
        }
Esempio n. 5
0
        public ActionResult UpdateRoles(int userAccountID, IEnumerable<string> roleOption)
        {
            var ua = new UserAccount(userAccountID)
            {
                IsApproved = (Request.Form["isApproved"] != null),
                EMail =  Request.Form["email"]

            };
            ua.Update();

            var uad1 = new UserAccountDetail();
            uad1.GetUserAccountDeailForUser(ua.UserAccountID);
            uad1.EmailMessages = (Request.Form["emailMessages"] != null);
            uad1.Update();

            UserAccountRole.DeleteUserRoles(userAccountID);

            if (roleOption != null)
            {
                foreach (Role thenewRole in roleOption.Select(newRole => new Role(newRole)))
                {
                    UserAccountRole.AddUserToRole(userAccountID, thenewRole.RoleID);
                }
            }

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

            LoadAllRoles();

            return View("UserManagement");
        }
Esempio n. 6
0
        public ActionResult EditPhotoDelete()
        {
            string str = Request.Form["delete_photo"];

            _uad = new UserAccountDetail();

            if (_mu != null) _uad.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey));

            var s3 = new S3Service
            {
                AccessKeyID = AmazonCloudConfigs.AmazonAccessKey,
                SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey
            };

            switch (str)
            {
                case "1":
                    try
                    {
                        if (!string.IsNullOrWhiteSpace(_uad.RawProfilePicUrl) && s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, _uad.RawProfilePicUrl))
                        {
                            s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, _uad.RawProfilePicUrl);
                        }

                        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
                    }

                    // set to blank the profile images that were deleted
                    _uad.RawProfilePicUrl = string.Empty;
                    _uad.ProfileThumbPicURL = string.Empty;
                    _uad.ProfilePicURL = string.Empty;
                    _uad.Update();
                    break;
                case "3":
                case "2":
                    _ups = new UserPhotos();
                    _ups.GetUserPhotos(_uad.UserAccountID);
                    foreach (UserPhoto up1 in _ups)
                    {
                        try
                        {
                            if ((up1.RankOrder != 1 || str != "2") && (up1.RankOrder != 2 || str != "3")) continue;

                            if (!string.IsNullOrWhiteSpace(up1.RawPicUrl) && s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, up1.RawPicUrl))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, up1.RawPicUrl);
                            }

                            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
                        }
                    }
                    _ups = new UserPhotos();
                    _ups.GetUserPhotos(_uad.UserAccountID);
                    if (_ups.Count == 1 && _ups[0].RankOrder == 2)
                    {
                        _ups[0].RankOrder = 1;
                        _ups[0].Update();
                    }
                    break;
            }

            return RedirectToAction("EditPhoto");
        }
Esempio n. 7
0
        private UserPhoto SwapOutDefaultPhoto(int currentUserId, int swapID)
        {
            UserPhoto up1;
            _uad = new UserAccountDetail();
            if (_mu != null) _uad.GetUserAccountDeailForUser(currentUserId);

            string currentDefaultRaw = _uad.RawProfilePicUrl;
            string currentDefaultMain = _uad.ProfilePicURL;
            string currentDefaultMainThumb = _uad.ProfileThumbPicURL;

            up1 = new UserPhoto(swapID);

            _uad.RawProfilePicUrl = up1.RawPicUrl;
            _uad.ProfilePicURL = up1.PicURL;
            _uad.ProfileThumbPicURL = up1.ThumbPicURL;
            _uad.LastPhotoUpdate = DateTime.UtcNow;
            _uad.Update();

            up1.RawPicUrl = currentDefaultRaw;
            up1.PicURL = currentDefaultMain;
            up1.ThumbPicURL = currentDefaultMainThumb;

            if (_mu != null) up1.UpdatedByUserID = currentUserId;

            up1.Update();

            if (_mu != null) LoadCurrentImagesViewBag(currentUserId);
            return up1;
        }
Esempio n. 8
0
        private void LoadFilteredUsers(bool isAjax, FindUsersModel model)
        {
            _mu = MembershipWrapper.GetUser();

            model.AgeFrom = (!string.IsNullOrWhiteSpace(Request.QueryString["AgeFrom"]))
                ? Convert.ToInt32(Request.QueryString["AgeFrom"])
                : model.AgeFrom;
            model.AgeTo = (!string.IsNullOrWhiteSpace(Request.QueryString["AgeTo"]))
                ? Convert.ToInt32(Request.QueryString["AgeTo"])
                : model.AgeTo;

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

                    if (!string.IsNullOrWhiteSpace(Request.QueryString.ToString()))
                    {
                        uad.FindUserFilter = Request.QueryString.ToString();
                        uad.Update();
                    }
                    else if (!string.IsNullOrWhiteSpace(uad.FindUserFilter))
                    {
                        Response.Redirect(string.Format("~/findusers?{0}", uad.FindUserFilter));
                    }
                }
            }

            model.InterestedInID =
                (Request.QueryString["InterestedInID"] != null && Request.QueryString["InterestedInID"] == string.Empty)
                    ? null
                    : (Request.QueryString["InterestedInID"] == null)
                        ? model.InterestedInID
                        : Convert.ToInt32(Request.QueryString["InterestedInID"]);

            model.RelationshipStatusID =
                (Request.QueryString["RelationshipStatusID"] != null &&
                 Request.QueryString["RelationshipStatusID"] == string.Empty)
                    ? null
                    : (Request.QueryString["RelationshipStatusID"] == null)
                        ? model.RelationshipStatusID
                        : Convert.ToInt32(Request.QueryString["RelationshipStatusID"]);

            model.YouAreID =
                (Request.QueryString["YouAreID"] != null && Request.QueryString["YouAreID"] == string.Empty)
                    ? null
                    : (Request.QueryString["YouAreID"] == null)
                        ? model.YouAreID
                        : Convert.ToInt32(Request.QueryString["YouAreID"]);

            model.Lang = (Request.QueryString["lang"] != null && Request.QueryString["lang"] == string.Empty)
                ? null
                : Request.QueryString["lang"] ?? model.Lang;

            model.PostalCode
                = (Request.QueryString["postalcode"] != null && Request.QueryString["postalcode"] == string.Empty)
                    ? null
                    : Request.QueryString["postalcode"] ?? model.PostalCode;

            model.Country
                = (Request.QueryString["country"] != null && Request.QueryString["country"] == string.Empty)
                    ? null
                    : Request.QueryString["country"] ?? model.Country;

            _uas = new UserAccounts();

            bool sortByDistance;

            _uas.GetListUsers(_userPageNumber, PageSize, model.AgeFrom, model.AgeTo, model.InterestedInID,
                model.RelationshipStatusID,
                model.YouAreID, model.Country, model.PostalCode, model.Lang, out sortByDistance);

            if (!isAjax)
            {
                ViewBag.SortByDistance = sortByDistance;
            }

            if (_mu == null || isAjax) return;
            if (string.IsNullOrWhiteSpace(Request.QueryString.ToString())) return;
            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey));

            uad.FindUserFilter = Request.QueryString.ToString();
            uad.Update();
        }