private void SeedContributionMessage(Privacy privacyData)
        {
            #region
            LocationAction objLocation = new LocationAction();
            var lstSeedContributionMessage = from u in objLocation.GetAllSeedContributionMessages()
                                             select new
                                             {
                                                 seedContribution = u.id,
                                                 cMessage = u.displayMessage
                                             };

            if (privacyData != null)
            {
                Guid uName = new Guid(privacyData.seedContribution);

                var selectedContriMessage = (from m in objLocation.GetMessageById(uName)
                                             select new
                                             {
                                                 seedContribution = m.id,
                                                 cMessage = m.displayMessage
                                             }).FirstOrDefault();

                ViewData["VSeedContribution"] = new SelectList(lstSeedContributionMessage, "seedContribution", "cMessage", selectedContriMessage.seedContribution);
            }
            else
            {
                ViewData["VSeedContribution"] = new SelectList(lstSeedContributionMessage, "seedContribution", "cMessage");
            }
            #endregion
        }
        public ActionResult PrivacyAccounts(ProfileModel objPrivacyModel)
        {
            #region
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            MemberAction objMember = new MemberAction();
            SeedSpeak.Model.Privacy privacyAccount = new SeedSpeak.Model.Privacy();
            privacyAccount.viewUsername = objPrivacyModel.ViewUsername;
            privacyAccount.seedContribution = objPrivacyModel.seedContribution;
            privacyAccount.seedCommitment = objPrivacyModel.seedCommitment;
            privacyAccount.viewLocation = Convert.ToBoolean(objPrivacyModel.viewLocation);
            privacyAccount.webNotification = Convert.ToBoolean(objPrivacyModel.webNotification);
            privacyAccount.devicePush = Convert.ToBoolean(objPrivacyModel.devicePush);
            privacyAccount.emailNotification = Convert.ToBoolean(objPrivacyModel.emailNotification);

            bool saved = objMember.ManageMemberPrivacy(memberData, privacyAccount);
            if (saved == true)
            {
                ViewData["PrivacyMsg"] = "<b>Privacy account saved succesfully.</b>";
            }
            else
            {
                ViewData["PrivacyMsg"] = "Problem saving privacy account.";
            }
            ViewData["SelectedIndex"] = 1;
            GetRegions();
            MyUsername(privacyAccount);
            SeedContributionMessage(privacyAccount);
            SeedCommitmentMessage(privacyAccount);
            GetExternalAccountList();
            GetExternalAccountList();
            GetProfileData();
            ViewData["LoggedInMember"] = memberData.id.ToString();
            return View("Profile");
            #endregion
        }
        private void MyUsername(Privacy privacyData)
        {
            #region
            LocationAction objLocation = new LocationAction();

            var lstMyUsername = from u in objLocation.GetAllMyUsernameMessages()
                                select new
                                {
                                    ViewUsername = u.id,
                                    uMessage = u.displayMessage
                                };

            if (privacyData != null)
            {
                Guid uName = new Guid(privacyData.viewUsername);

                var selectedUserMessage = (from m in objLocation.GetMessageById(uName)
                                           select new
                                           {
                                               ViewUsername = m.id,
                                               uMessage = m.displayMessage
                                           }).FirstOrDefault();

                ViewData["MyUsername"] = new SelectList(lstMyUsername, "ViewUsername", "uMessage", selectedUserMessage.ViewUsername);
            }
            else
            {
                ViewData["MyUsername"] = new SelectList(lstMyUsername, "ViewUsername", "uMessage");
            }
            #endregion
        }
Beispiel #4
0
        /// <summary>
        /// Method to Manage Member Privacy.
        /// </summary>
        /// <param name="privacy"></param>
        /// <returns></returns>
        public bool ManageMemberPrivacy(Member member, Privacy privacy)
        {
            #region Business Logic

            bool actionCompleted = false;
            try
            {
                Privacy privacyData = null;

                //see if Privacy Setting exists

                privacyData = repoObj.List<Privacy>(x => x.Member.id.Equals(member.id)).FirstOrDefault();

                if (privacyData != null)
                {
                    privacyData.viewUsername = privacy.viewUsername;
                    privacyData.seedContribution = privacy.seedContribution;
                    privacyData.seedCommitment = privacy.seedCommitment;
                    privacyData.viewLocation = privacy.viewLocation;
                    privacyData.webNotification = privacy.webNotification;
                    privacyData.devicePush = privacy.devicePush;
                    privacyData.emailNotification = privacy.emailNotification;
                    privacyData.autoTweet = privacy.autoTweet;

                    repoObj.Update<Privacy>(privacyData);
                }
                else
                {
                    privacyData = new Privacy();
                    privacyData.id = Guid.NewGuid();
                    privacyData.memberId = member.id;
                    privacyData.viewUsername = privacy.viewUsername;
                    privacyData.seedContribution = privacy.seedContribution;
                    privacyData.seedCommitment = privacy.seedCommitment;
                    privacyData.viewLocation = privacy.viewLocation;
                    privacyData.webNotification = privacy.webNotification;
                    privacyData.devicePush = privacy.devicePush;
                    privacyData.emailNotification = privacy.emailNotification;
                    privacyData.autoTweet = privacy.autoTweet;

                    repoObj.Create<Privacy>(privacyData);
                }

                actionCompleted = true;
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
            return actionCompleted;
            #endregion
        }