/// <summary> /// Updates a message condition /// </summary> public void UpdateMessageCondition(MessageConditionData updatedMessageCondition) { SurveyFactory.Create().UpdateMessageCondition(updatedMessageCondition); }
private void AddUpdateMessageCondition(bool updateMode) { MessageConditionData messageConditionData = new MessageConditionData(); MessageConditionData .MessageConditionsRow messageCondition = messageConditionData .MessageConditions.NewMessageConditionsRow(); if ((MessageConditionDropdownlist.SelectedValue == "2" || MessageConditionDropdownlist.SelectedValue == "3" || MessageConditionDropdownlist.SelectedValue == "4") && Information.IsNumeric(ScoreTextbox.Text)) { messageCondition.Score = int.Parse(ScoreTextbox.Text); } else if (MessageConditionDropdownlist.SelectedValue == "5" && Information.IsNumeric(ScoreTextbox.Text) && Information.IsNumeric(ScoreMaxTextbox.Text)) { messageCondition.Score = int.Parse(ScoreTextbox.Text); messageCondition.ScoreMax = int.Parse(ScoreMaxTextbox.Text); } else if (MessageConditionDropdownlist.SelectedValue == "2" || MessageConditionDropdownlist.SelectedValue == "3" || MessageConditionDropdownlist.SelectedValue == "4" || MessageConditionDropdownlist.SelectedValue == "5") { ((PageBase)Page).ShowErrorMessage(MessageLabel,((PageBase)Page).GetPageResource("ScoreNotNumericMessage")); MessageLabel.Visible = true; return; } // Condition created from a selected question else if (MessageConditionDropdownlist.SelectedValue == "1") { if ((LogicDropDownList.SelectedValue == "3" || LogicDropDownList.SelectedValue == "4" || LogicDropDownList.SelectedValue == "5") && Information.IsNumeric(ScoreTextbox.Text)) { messageCondition.Score = int.Parse(ScoreTextbox.Text); } else if (LogicDropDownList.SelectedValue == "6" && Information.IsNumeric(ScoreTextbox.Text) && Information.IsNumeric(ScoreMaxTextbox.Text)) { messageCondition.Score = int.Parse(ScoreTextbox.Text); messageCondition.ScoreMax = int.Parse(ScoreMaxTextbox.Text); } else if (LogicDropDownList.SelectedValue == "3" || LogicDropDownList.SelectedValue == "4" || LogicDropDownList.SelectedValue == "5" || LogicDropDownList.SelectedValue == "6") { ((PageBase)Page).ShowErrorMessage(MessageLabel,((PageBase)Page).GetPageResource("ScoreNotNumericMessage")); MessageLabel.Visible = true; return; } else { int answerId = int.Parse(AnswerFilterDropdownlist.SelectedValue); if (answerId == 0) { messageCondition.SetAnswerIdNull(); } else if ( answerId < 0) { messageCondition.AnswerId = -answerId; } else { messageCondition.AnswerId = answerId; } if (TextFilterTextbox.Visible) { messageCondition.ExpressionOperator = int.Parse(ExpressionLogicDropdownlist.SelectedValue); messageCondition.TextFilter = TextFilterTextbox.Text; } } messageCondition.QuestionId = int.Parse(QuestionFilterDropdownlist.SelectedValue); messageCondition.ConditionalOperator = int.Parse(LogicDropDownList.SelectedValue); } messageCondition.ThankYouMessage = ConditionCKeditor.Text.Length > 3900 ? ConditionCKeditor.Text.Substring(0, 3900) : ConditionCKeditor.Text; messageCondition.MessageConditionalOperator = int.Parse(MessageConditionDropdownlist.SelectedValue); messageConditionData.MessageConditions.AddMessageConditionsRow(messageCondition); if (updateMode) { messageCondition.MessageConditionId = _messageConditionId; new Survey().UpdateMessageCondition(messageConditionData); } else { messageCondition.SurveyId = SurveyId; new Survey().AddMessageCondition(messageConditionData); } }
/// <summary> /// Add a new condition to show a given thank you message /// </summary> /// <param name="newBranchingRule"></param> public void AddMessageCondition(MessageConditionData newMessageCondition) { SurveyFactory.Create().AddMessageCondition(newMessageCondition); }