private void BindData() { if (qdto.GetType() == typeof(BuildQueryDTO)) { var dto = qdto as BuildQueryDTO; this.tabControl1.SelectedIndex = 0; this.textBoxBase.Text = dto.SearchBase; this.comboBoxScope.SelectedIndex = (int)dto.SearchScope; this.comboBoxLogicalOp.SelectedIndex = (int)dto.Operator; this.listViewConditions.Items.Clear(); foreach (var item in dto.CondList) { ListViewItem lvi = new ListViewItem(item.Attribute); var cond = this.comboBoxCond.Items[(int)item.Condition].ToString(); lvi.SubItems.Add(cond); lvi.SubItems.Add(item.Value); this.listViewConditions.Items.Add(lvi); } foreach (var item in dto.AttrToReturn) { var lvi = new ListViewItem(new string[] { item }); listViewAttrToReturn.Items.Add(lvi); this.comboBoxAttrToReturn.SelectedIndex = 0; this.comboBoxAttrToReturn.Items.Remove(item); } } else if (qdto.GetType() == typeof(TextQueryDTO)) { var dto = qdto as TextQueryDTO; this.tabControl1.SelectedIndex = 1; this.textBoxBase.Text = dto.SearchBase; this.comboBoxScope.SelectedIndex = (int)dto.SearchScope; this.textBoxFilterString.Text = dto.GetFilterString(); foreach (var item in dto.AttrToReturn) { var lvi = new ListViewItem(new string[] { item }); listViewAttrToReturn.Items.Add(lvi); this.comboBoxAttrToReturn.SelectedIndex = 0; this.comboBoxAttrToReturn.Items.Remove(item); } } }
private void BindData() { if (_qdto.GetType() == typeof(BuildQueryDTO)) { var dto = _qdto as BuildQueryDTO; SearchQueryTabView.SelectAt(0); SearchBaseTextField.StringValue = dto.SearchBase; SearchScopeComboBox.SelectItem((int)dto.SearchScope); BfOperatorComboBox.SelectItem((int)dto.Operator); BfAttributeComboBox.SelectItem(0); BfConditionComboBox.SelectItem(0); _searchCondDs.condList.Clear(); foreach (var item in dto.CondList) { _searchCondDs.condList.Add(new FilterDTO(item.Attribute, item.Condition, item.Value)); } BfConditionsTableView.ReloadData(); _attrToReturnDs.attrList.Clear(); foreach (var item in dto.AttrToReturn) { _attrToReturnDs.attrList.Add(item); } AttrToReturnTableView.ReloadData(); } else if (_qdto.GetType() == typeof(TextQueryDTO)) { var dto = _qdto as TextQueryDTO; SearchQueryTabView.SelectAt(1); SearchBaseTextField.StringValue = dto.SearchBase; SearchScopeComboBox.SelectItem((int)dto.SearchScope); TfSearchFilterTextView.Value = dto.GetFilterString(); _attrToReturnDs.attrList.Clear(); foreach (var item in dto.AttrToReturn) { _attrToReturnDs.attrList.Add(item); } AttrToReturnTableView.ReloadData(); } }