Beispiel #1
0
        protected void btnAddNewQuestion_Click(object sender, EventArgs e)
        {
            if (!HasWriteAccess)
                return;
            
            ProfileQuestion question = new ProfileQuestion();
            question.Name = "NewName";
            question.AltName = "New alternative name";
            question.Description = "New description";
            question.Hint = "New hint";
            question.EditStyle = ProfileQuestion.eEditStyle.Hidden;
            question.ShowStyle = ProfileQuestion.eShowStyle.Hidden;
            question.SearchStyle = ProfileQuestion.eSearchStyle.Hidden;
            question.Required = true;
            question.TopicID = Convert.ToInt32(TopicID);

            question.Save();
            PopulateDataGrid();
        }
        private void StoreAllSettings()
        {
            var billingPlanOptions = Config.Users.GetNonPayingMembersOptions();

            #region step 1
            Config.Misc.SiteTitle = txtSiteName.Text;
            Config.Misc.SiteEmail = txtSiteEmail.Text;

            //var siteModel = (SiteModel)Int32.Parse(rblSiteModel.SelectedValue);
            //switch(siteModel)
            //{
            //    case SiteModel.SubscriptionBased:
            //        Config.Users.PaymentRequired = true;
            //        Config.Credits.Required = false;
            //        break;
            //    case SiteModel.PerContact:
            //        Config.Credits.Required = true;
            //        Config.Users.PaymentRequired = false;
            //        break;
            //    case SiteModel.Free:
            //        Config.Credits.Required = false;
            //        Config.Users.PaymentRequired = false;
            //        break;
            //}

            #region activate selected languages
            foreach (ListItem item in cblSiteLanguages.Items)
            {
                var language = Language.Fetch(Int32.Parse(item.Value));

                if (item.Selected)
                {
                    language.Active = true;
                }
                else
                {
                    language.Active = false;
                }

                language.Save();
            }

            if (cbOtherLanguage.Checked && txtOtherLanguage.Text.Trim().Length > 0)
            {
                var language = Language.Create(txtOtherLanguage.Text, true);
                language.Save();
            }
            #endregion

            #endregion

            #region step 2

            Config.Misc.EnableAjaxChat = cbEnableAjaxChatRoom.Checked;
            billingPlanOptions.UserCanUseChat.Value = cbEnableAjaxChatRoom.Checked;

            Config.Misc.EnableIntegratedIM = cbEnableMessenger.Checked;
            Config.Misc.EnableCoolIris = cbEnableCoolIris.Checked;
            Config.Users.EnablePhotoAlbums = cbEnablePhotoAlbums.Checked;
            Config.Ads.Enable = cbEnableClassifiedAds.Checked;
            if (Config.Ads.Enable)
            {
                Config.Ads.OnlyRegisteredUsersCanBrowseClassifieds = cbOnlyRegisteredUsersCanBrowseClassifiedAds.Checked;
                Config.Ads.EnableAdComments = cbAllowUsersToLeaveCommentsOnTheClassifiedAds.Checked;
            }
            Config.Misc.EnableBlogs = cbEnableBlogs.Checked;
            if (Config.Misc.EnableBlogs)
            {
                Config.Misc.EnableBlogPostApproval = cbEnableBlogPostApproval.Checked;
            }

            Config.Groups.EnableGroups = cbEnableCommunityGroups.Checked;
            if (Config.Groups.EnableGroups)
            {
                Config.Groups.EnableAjaxChat = cbEnableAjaxChatRoomsInGroups.Checked;
                billingPlanOptions.CanCreateGroups.Value = cbAllowUsersToCreateGroups.Checked;
                billingPlanOptions.MaxGroupsPerMember.Value = Int32.Parse(txtMaximumGroupsToJoin.Text);
            }

            Config.Misc.EnableVideoUpload = cbEnableVideoFileUploads.Checked;
            if (Config.Misc.EnableVideoUpload)
            {
                billingPlanOptions.MaxVideoUploads.Value = Int32.Parse(txtMaximumUploadedVideosPerUser.Text);
            }

            Config.Misc.EnableYouTubeVideos = cbEnableYouTubeVideosEmbedding.Checked;
            if (Config.Misc.EnableYouTubeVideos)
            {
                billingPlanOptions.MaxVideos.Value = Int32.Parse(txtMaximumYouTubeVideosPerUser.Text);
                //Config.Misc.MaxYouTubeVideos = Int32.Parse(txtMaximumYouTubeVideosPerUser.Text);
            }

            Config.Misc.EnableAudioUpload = cbEnableMP3FileUploads.Checked;
            if (Config.Misc.EnableAudioUpload)
            {
                billingPlanOptions.MaxAudioUploads.Value = Int32.Parse(txtMaximumMP3FilesPerUser.Text);
            }

            Config.Misc.EnableProfileVideoBroadcast = cbEnableLiveWebcamVideoStreaming.Checked;
            Config.Misc.EnableGadgets = cbEnableGadgets.Checked;
            Config.Misc.StopUsersWithAdBlocker = cbEnableAdBlockerBlocker.Checked;
            if (cbEnableSkypeIntegration.Checked)
            {
                //create question
                ProfileQuestion question = new ProfileQuestion();
                question.Name = "Skype";
                question.AltName = String.Empty;
                question.Description = "Skype";
                question.Hint = String.Empty;
                question.EditStyle = ProfileQuestion.eEditStyle.SingleLine;
                question.ShowStyle = ProfileQuestion.eShowStyle.SkypeLink;
                question.SearchStyle = ProfileQuestion.eSearchStyle.Hidden;
                question.Required = false;
                question.TopicID = 2;//hardcoded value

                question.Save();
            }
            //Config.Users.EnableEcards = cbEnableECards.Checked;
            Config.Users.EnableFriends = cbEnableFriends.Checked;
            Config.Users.EnableFavorites = cbEnableFavorites.Checked;
            Config.Search.DistanceSearchEnabled = cbEnableDistanceSearch.Checked;
            #endregion

            #region step 3
            Config.Photos.AutoApprovePhotos = !cbPhotoApprovalRequiredByAdministrator.Checked;
            Config.Photos.EnableExplicitPhotos = cbAllowExplicitPhotos.Checked;
            if (Config.Photos.EnableExplicitPhotos)
            {
                Config.Photos.MakeExplicitPhotosPrivate = cbAlwaysMakeExplicitPhotosPrivate.Checked;
                Config.Users.MinAgeForExplicitPhotos = Int32.Parse(txtMinimumAgeToSeeExplicitPhotos.Text);
            }
            Config.Photos.EnablePrivatePhotos = cbAllowPrivatePhotos.Checked;
            Config.Photos.MaxPhotos = Int32.Parse(txtMaximumPhotosPerUser.Text);
            Config.Users.EnableProfileComments = cbAllowUsersToCommentOnProfiles.Checked;
            Config.Photos.EnablePhotoComments = cbAllowUsersToCommentOnPhotos.Checked;
            Config.Ratings.EnableProfileRatings = cbAllowUsersToRateProfiles.Checked;
            Config.Ratings.EnablePhotoRatings = cbAllowUsersToRatePhotos.Checked;
            if (Config.Ratings.EnablePhotoRatings)
            {
                Config.Ratings.EnableRatePhotos = cbEnableHotOrNotStyle.Checked;
            }
            Config.Users.EnableUserStatusText = cbAllowUsersToSetStatus.Checked;
            Config.Users.EnableProfileSkins = cbAllowUsersToUseSkins.Checked;
            if (Config.Users.EnableProfileSkins)
            {
                billingPlanOptions.UserCanUseSkin.Value = cbAllowUsersToUseSkins.Checked;
                billingPlanOptions.UserCanEditSkin.Value = cbAllowUsersToCustomizeSkin.Checked;
            }
            Config.Users.EnableRelationshipStatus = cbAllowUsersToSpecifyRelationships.Checked;
            #endregion

            #region step 4
            //Config.Misc.EnableSpamDetection = cbEnableSpamDetection.Checked;
            Config.Misc.EnableCaptcha = cbEnableCaptchaValidation.Checked;
            Config.Users.AutoActivateUsers = !cbRequireEmailConfirmation.Checked;
            Config.Misc.EnableMessageFilter = cbEnableEmailAndPhoneNumberFiltering.Checked;
            Config.Misc.EnableSpamDetection = cbBlockSendingMultipleSimilarMessages.Checked;
            if (Config.Misc.EnableSpamDetection)
            {
                Config.Misc.MaxSameMessages = Int32.Parse(txtNumberOfSimilarMessages.Text);
            }

            Config.Users.MessageVerificationEnabled = cbManuallyApproveInitialUserMessages.Checked;
            if (Config.Users.MessageVerificationEnabled)
            {
                Config.Users.MessageVerificationsCount = Int32.Parse(txtMessagesPerUserToBeApproved.Text);
            }

            //Config.Users.MembersMaxMessagesPerDay
            billingPlanOptions.MaxMessagesPerDay.Value = Int32.Parse(txtMaximumMessagesPerDay.Text);
            Config.Users.MaxContactedUsersPerDay = Int32.Parse(txtMaximumUsersContactedPerDay.Text);

            Config.AbuseReports.UserCanReportProfileAbuse = cbAllowUsersToReportProfileAbuse.Checked;
            Config.AbuseReports.UserCanReportPhotoAbuse = cbAllowUsersToReportPhotoAbuse.Checked;
            Config.AbuseReports.UserCanReportMessageAbuse = cbAllowUsersToReportMessageAbuse.Checked;
            #endregion

            Config.Users.SetNonPayingMembersOptions(billingPlanOptions);
        }