public override DataSet Clone() { SkipLogicRuleData data = (SkipLogicRuleData)base.Clone(); data.InitVars(); return(data); }
/// <summary> /// Add a new skip logic rule /// </summary> public void AddSkipLogicRule(SkipLogicRuleData newSkipLogicRule) { SqlConnection connection = new SqlConnection(DbConnection.NewDbConnectionString); SqlCommand insertCommand = new SqlCommand("vts_spQuestionSkipLogicRuleAddNew", connection); insertCommand.CommandType = CommandType.StoredProcedure; insertCommand.Parameters.Add(new SqlParameter("@SkipQuestionId", SqlDbType.Int, 4, "SkipQuestionId")); insertCommand.Parameters.Add(new SqlParameter("@QuestionID", SqlDbType.Int, 4, "QuestionID")); insertCommand.Parameters.Add(new SqlParameter("@AnswerID", SqlDbType.Int, 4, "AnswerID")); insertCommand.Parameters.Add(new SqlParameter("@TextFilter", SqlDbType.NVarChar, 0xfa0, "TextFilter")); insertCommand.Parameters.Add(new SqlParameter("@ConditionalOperator", SqlDbType.Int, 4, "ConditionalOperator")); insertCommand.Parameters.Add(new SqlParameter("@ExpressionOperator", SqlDbType.Int, 4, "ExpressionOperator")); insertCommand.Parameters.Add(new SqlParameter("@Score", SqlDbType.Int, 4, "Score")); insertCommand.Parameters.Add(new SqlParameter("@ScoreMax", SqlDbType.Int, 4, "ScoreMax")); insertCommand.Parameters.Add(new SqlParameter("@SkipLogicRuleID", SqlDbType.Int, 4, "SkipLogicRuleID")); insertCommand.Parameters["@SkipLogicRuleID"].Direction = ParameterDirection.Output; DbConnection.db.UpdateDataSet(newSkipLogicRule, "SkipLogicRules", insertCommand, new SqlCommand(), new SqlCommand(), UpdateBehavior.Transactional); }
/// <summary> /// Add a new skip logic rule /// </summary> public void AddSkipLogicRule(SkipLogicRuleData newSkipLogicRule) { QuestionFactory.Create().AddSkipLogicRule(newSkipLogicRule); }
/// <summary> /// Retrieves the skip logic rules for this question /// </summary> public SkipLogicRuleData GetQuestionSkipLogicRules(int questionId) { SkipLogicRuleData dataSet = new SkipLogicRuleData(); ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@SkipQuestionId", questionId).SqlValue); } DbConnection.db.LoadDataSet("vts_spQuestionSkipLogicRuleGetAll", dataSet, new string[] { "SkipLogicRules" }, commandParameters.ToArray()); return dataSet; }
private void AddRuleButton_Click(object sender, System.EventArgs e) { SkipLogicRuleData skipLogicRuleData = new SkipLogicRuleData(); SkipLogicRuleData.SkipLogicRulesRow skipLogicRule = skipLogicRuleData.SkipLogicRules.NewSkipLogicRulesRow(); if ((LogicDropDownList.SelectedValue == "3" || LogicDropDownList.SelectedValue == "4" || LogicDropDownList.SelectedValue == "5") && Information.IsNumeric(ScoreTextbox.Text)) { skipLogicRule.Score = int.Parse(ScoreTextbox.Text); } else if (LogicDropDownList.SelectedValue == "6" && Information.IsNumeric(ScoreTextbox.Text) && Information.IsNumeric(ScoreMaxTextbox.Text)) { skipLogicRule.Score = int.Parse(ScoreTextbox.Text); skipLogicRule.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) { skipLogicRule.SetAnswerIdNull(); } else if ( answerId < 0) { skipLogicRule.AnswerId = -answerId; } else { skipLogicRule.AnswerId = answerId; } if (TextFilterTextbox.Visible) { skipLogicRule.ExpressionOperator = int.Parse(ExpressionLogicDropdownlist.SelectedValue); skipLogicRule.TextFilter = TextFilterTextbox.Text; } } skipLogicRule.SkipQuestionId = _questionId; skipLogicRule.QuestionId = int.Parse(QuestionFilterDropdownlist.SelectedValue); skipLogicRule.ConditionalOperator = int.Parse(LogicDropDownList.SelectedValue); skipLogicRuleData.SkipLogicRules.AddSkipLogicRulesRow(skipLogicRule); new Question().AddSkipLogicRule(skipLogicRuleData); MessageLabel.Visible = true; ((PageBase)Page).ShowNormalMessage(MessageLabel,((PageBase)Page).GetPageResource("SkipLogicRuleAddedMessage")); BindFields(); ScoreTextbox.Text = string.Empty; ScoreMaxTextbox.Text = string.Empty; }
public SkipLogicRulesRowChangeEvent(SkipLogicRuleData.SkipLogicRulesRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void RemoveSkipLogicRulesRow(SkipLogicRuleData.SkipLogicRulesRow row) { base.Rows.Remove(row); }
public void AddSkipLogicRulesRow(SkipLogicRuleData.SkipLogicRulesRow row) { base.Rows.Add(row); }