private void DeleteFilter(int filterId) { var childFilters = new Filters().GetFiltersByParent(SurveyId, filterId); foreach (var filter in childFilters.Filters.OfType<FilterData.FiltersRow>()) { DeleteFilter(filter.FilterId); } new Filter().DeleteFilter(filterId); }
/// <summary> /// Get the current DB data and fill /// the fields with them /// </summary> public void BindFields() { FilterData filterData = new Filters().GetFilterById(FilterId); FilterNameTextBox.Text = filterData.Filters[0].Description; LogicalOperatorDropDownList.SelectedValue = filterData.Filters[0].LogicalOperatorTypeID.ToString(); RulesRepeater.DataSource = new Filters().GetRulesForFilter(FilterId); RulesRepeater.DataMember = "FilterRules"; RulesRepeater.DataBind(); QuestionFilterDropdownlist.DataSource = new Questions().GetAnswerableQuestionList(SurveyId); QuestionFilterDropdownlist.DataTextField = "QuestionText"; QuestionFilterDropdownlist.DataValueField = "QuestionID"; QuestionFilterDropdownlist.DataBind(); QuestionFilterDropdownlist.Items.Insert(0, new ListItem(((PageBase)Page).GetPageResource("SelectQuestionMessage"), "-1")); BindFieldsAutoGenerate(); BindFieldsParentFilter(ParentFilterNameDropDownList); SelectParentFilter(ParentFilterNameDropDownList, filterData.Filters[0].ParentFilterId); //ParentFilterNameDropDownList.SelectedValue = filterData.Filters[0].ParentFilterId.ToString(); AddRuleButton.Enabled = false; AnswerLabel.Visible = false; AnswerFilterDropdownlist.Visible = false; TextFilterTextbox.Visible = false; FilterText.Visible = false; }