private void CopyExistingQuestionButton_Click(object sender, System.EventArgs e) { if (_libraryId == -1) { int questionId; if (SourceDropDownList.SelectedValue == "0") { questionId = int.Parse(LibraryQuestionsDropDownList.SelectedValue); } else { questionId = int.Parse(SurveyQuestionListDropdownlist.SelectedValue); } new Question().CopyQuestionById(questionId, SurveyId, _displayOrder, _pageNumber); UINavigator.NavigateToSurveyBuilder(SurveyId, MenuIndex); } else { new Question().CopyQuestionToLibrary(int.Parse(SurveyQuestionListDropdownlist.SelectedValue), _libraryId); UINavigator.NavigateToLibraryTemplates(getSurveyId(), _libraryId, MenuIndex); } }
private void AddQuestion() { if (QuestionDropDownList.SelectedValue == "single") { // Adds the new single question QuestionData newQuestion = new Question().AddDefaultSingleQuestion(SurveyId, _displayOrder, _pageNumber, Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text); UINavigator.NavigateToSingleQuestionEdit(getSurveyId(), newQuestion.Questions[0].QuestionId, _libraryId, MenuIndex); } else if (QuestionDropDownList.SelectedValue == "matrix") { // Adds the new parent matrix question H:\SurveyProject\SurveyWAP\Images\ QuestionData newQuestion = new Question().AddDefaultMatrixQuestion(SurveyId, _displayOrder, _pageNumber, Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text); UINavigator.NavigateToMatrixQuestionEdit(SurveyId, newQuestion.Questions[0].QuestionId, _libraryId, MenuIndex); } else { new Question().AddStaticInformationText(SurveyId, _displayOrder, _pageNumber, QuestionFreeTextBox.Text, txtQuestionID.Text); UINavigator.NavigateToSurveyBuilder(SurveyId, MenuIndex); } }
protected void OnOrderDown(object sender, CommandEventArgs e) { int qid = int.Parse(((LibraryQuestionOptionsControl)sender).QuestionId); new Questions().MoveQuestionDown(qid); UINavigator.NavigateToLibraryTemplates(getSurveyId(), _libraryId, -1); }
private void ImportXMLButton_Click(object sender, System.EventArgs e) { if (ImportFile.PostedFile != null) { NSurveyQuestion importedQuestions = new NSurveyQuestion(); try { importedQuestions.ReadXml(System.Xml.XmlReader.Create(ImportFile.PostedFile.InputStream, (new System.Xml.XmlReaderSettings() { XmlResolver = null }))); SetImportedQuestionsDefaults(importedQuestions); new Question().ImportQuestions(importedQuestions, NSurveyUser.Identity.UserId); if (_libraryId == -1) { UINavigator.NavigateToSurveyBuilder(SurveyId, MenuIndex); } else { UINavigator.NavigateToLibraryTemplates(getSurveyId(), _libraryId, MenuIndex); } } catch (Exception ex) { ((PageBase)Page).ShowErrorMessage(MessageLabel, ex.Message); MessageLabel.Visible = true; } } }
private void SendInvitationButton_Click(object sender, System.EventArgs e) { //Init Async call ASyncMailing mail = new ASyncMailing(); ASyncMailingState mailingState = new ASyncMailingState(mail, Session.SessionID); AsyncCallback cb = new AsyncCallback(MailingCallback); // Build message to send EmailingMessage message; message = new EmailingMessage(); message.FromEmail = FromTextBox.Text; message.FromName = FromNameTextbox.Text; message.Subject = SubjectTextBox.Text; message.Body = HttpUtility.HtmlDecode(MailingCKEditor.Text); message.Format = EmailFormat.Html; // Dummy session variable to init the session in case // it was not initialized Session["IamADummy"] = "StartIt"; // Start the mailing mail.BeginMailIt(Session.SessionID, SurveyId, AnonymousEntriesCheckBox.Checked, MailingListTextBox.Text, message, cb, mailingState); // Open the poll page while the mailing continues UINavigator.NavigateToMailingPoll(SurveyId, MenuIndex); }
private void DeleteFile(int fileId, string groupGuid) { // Deletes the file new Answer().DeleteAnswerFile(fileId, groupGuid); UINavigator.NavigateToVoterReport(SurveyId, _voterId, MenuIndex); }
private void Page_Load(object sender, System.EventArgs e) { Session.Abandon(); Response.Cookies.Clear(); FormsAuthentication.SignOut(); UINavigator.NavigateToLogin(); }
protected void OnBackButton(object sender, System.EventArgs e) { int _questionId = -1; if (!(Request.QueryString["QuestionId"] != null && int.TryParse(Request.QueryString["QuestionId"], out _questionId))) _questionId = -1; Response.Redirect(UINavigator.LibraryTemplateReturnUrl() == null ? UINavigator.SurveyContentBuilderLink + (_questionId == -1 ? string.Empty : "?" + Constants.Constants.ScrollQuestionQstr + "=" + _questionId.ToString()) : UINavigator.LibraryTemplateReturnUrl()); }
private void EditQuestionButton_Click(object sender, System.EventArgs e) { if (_questionId == -1) { return; } else { UINavigator.NavigateToSingleQuestionEdit(SurveyId, _questionId, (int)ViewState["LibraryId"], MenuIndex); } }
private void SetupSecurity() { // Check if we can edit extended properties if ((_userProvider is INSurveyUserProvider)) { CheckRight(NSurveyRights.AccessUserManager, true); } else { UINavigator.NavigateToAccessDenied(SurveyId, MenuIndex); } }
/// <summary> /// Check if the current user has the given right /// else if specified redirect to the access denied page /// </summary> /// <param name="right"></param> /// <param name="accessDeniedRedirect"></param> /// <returns>true or false</returns> public bool CheckRight(NSurveyRights right, bool accessDeniedRedirect) { if (NSurveyUser.Identity.IsAdmin || NSurveyUser.HasRight(right)) { return(true); } else if (accessDeniedRedirect) { UINavigator.NavigateToAccessDenied(getSurveyId(), MenuIndex); } return(false); }
/// <summary> /// IsSingleUserMode boolean /// </summary> /// <remarks>Check if the system was setup in single user mode</remarks> /// <param name="redirectIfSingle"></param> /// <returns>true or false</returns> public bool IsSingleUserMode(bool redirectIfSingle) { // Did the system setup a dummy admin if (NSurveyUser.Identity.UserId == 0 && NSurveyUser.Identity.IsAdmin) { if (redirectIfSingle) { UINavigator.NavigateToAccessDenied(SurveyId, MenuIndex); } return(true); } return(false); }
private void AddAddinButton_Click(object sender, System.EventArgs e) { new SecurityAddIn().AddSecurityAddInToSurvey(SurveyId, int.Parse(SecurityAddInDropDownList.SelectedValue), _addInOrder); WebSecurityAddInData.WebSecurityAddInsRow addInRow = (WebSecurityAddInData.WebSecurityAddInsRow) new SecurityAddIns().GetAddInById(SurveyId, int.Parse(SecurityAddInDropDownList.SelectedValue)).WebSecurityAddIns.Rows[0]; try { IWebSecurityAddIn addedAddin = WebSecurityAddInFactory.Create(addInRow, ViewState, null); addedAddin.InitOnSurveyAddition(); } catch (Exception) { new SecurityAddIn().DeleteWebSecurityAddIn(SurveyId, int.Parse(SecurityAddInDropDownList.SelectedValue)); throw; } UINavigator.NavigateToSurveySecurity(SurveyId, MenuIndex); }
private void AddQuestionToLibrary() { if (QuestionDropDownList.SelectedValue == "single") { // Adds the new single question to the library QuestionData newQuestion = new Question().AddDefaultSingleQuestion(_libraryId, Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text); UINavigator.NavigateToSingleQuestionEdit(getSurveyId(), newQuestion.Questions[0].QuestionId, _libraryId, MenuIndex); } else if (QuestionDropDownList.SelectedValue == "matrix") { // Adds the new parent matrix question to the library QuestionData newQuestion = new Question().AddDefaultMatrixQuestion(_libraryId, Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text); UINavigator.NavigateToMatrixQuestionEdit(getSurveyId(), newQuestion.Questions[0].QuestionId, _libraryId, MenuIndex); } else { new Question().AddStaticInformationText(_libraryId, Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text); UINavigator.NavigateToLibraryTemplates(getSurveyId(), _libraryId, MenuIndex); } }
private void ValidatedFilesDataGrid_SelectedIndexChanged(object sender, System.EventArgs e) { UINavigator.NavigateToVoterReport(SurveyId, int.Parse(ValidatedFilesDataGrid.Items[ValidatedFilesDataGrid.SelectedIndex].Cells[8].Text.ToString()), MenuIndex); }
private void InsertQuestionButton_Click(object sender, System.EventArgs e) { UINavigator.NavigateToInsertQuestion(getSurveyId(), 1, 1, _libraryId, MenuIndex); }
protected void OnBackButton(object sender, System.EventArgs e) { Response.Redirect(UINavigator.LibraryTemplateReturnUrl() == null ? UINavigator.SurveyContentBuilderLink + (_questionId == -1 ? string.Empty : "?" + Constants.Constants.ScrollQuestionQstr + "=" + _questionId.ToString()) : UINavigator.LibraryTemplateReturnUrl()); }
private void EditAnswersButton_Click(object sender, System.EventArgs e) { UINavigator.NavigateToSingleQuestionAnswersEdit(getSurveyId(), _questionId, (int)ViewState["LibraryId"], MenuIndex); }
protected void ReadOnlyAnswersLinkButton_Click(object sender, EventArgs e) { UINavigator.NavigateToVoterReport(SurveyId, _voterId, MenuIndex); }
private void AddRuleButton_Click(object sender, System.EventArgs e) { AddUpdateMessageCondition(false); UINavigator.NavigateToSurveyPrivacyOptions(SurveyId, MenuIndex); }
private void ConditionCancelButton_Click(object sender, System.EventArgs e) { UINavigator.NavigateToSurveyPrivacyOptions(SurveyId, MenuIndex); }
private void ViewDetails(object sender, System.EventArgs e) { UINavigator.NavigateToVoterReport(SurveyId, int.Parse(FieldReportDataGrid.DataKeys[FieldReportDataGrid.SelectedIndex].ToString()), MenuIndex); }