コード例 #1
0
        private void ComboDataType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string searchCondition_old = "";

            if (ComboSearchCondition.SelectedIndex > -1)
            {
                searchCondition_old = ComboSearchCondition.SelectedText;
            }

            ComboSearchCondition.Items.Clear();
            StaticFunctions.PopulateOperatorComboBox(ComboSearchCondition, ComboDataType.Text);

            if (searchCondition_old != "")
            {
                ComboSearchCondition.SelectedIndex = ComboDataType.FindStringExact(searchCondition_old);
            }


            if (ComboDataType.Text == Constants.ValueType_Bool)
            {
                radioBtnYes.Visible = true;
                radioBtnYes.Left    = TxtSearchVal1.Left;
                radioBtnYes.Top     = TxtSearchVal1.Top;

                radioBtnNo.Visible = true;
                radioBtnNo.Left    = radioBtnYes.Left + radioBtnYes.Width + 10;
                radioBtnNo.Top     = radioBtnYes.Top;

                TxtSearchVal1.Visible      = false;
                TxtSearchVal2.Visible      = false;
                Label_SearchValue2.Visible = false;
            }
            else
            {
                TxtSearchVal1.Visible      = true;
                TxtSearchVal2.Visible      = (ComboSearchCondition.Text == Constants.operator_Between);
                Label_SearchValue2.Visible = (ComboSearchCondition.Text == Constants.operator_Between);
                radioBtnYes.Visible        = false;
                radioBtnNo.Visible         = false;
            }

            queryMeta.searchCondition = ComboSearchCondition.Text;
            if (ComboSearchCondition.Text == "")
            {
                this.queryMeta.searchValue1 = "";
                this.queryMeta.searchValue2 = "";
            }
            if (ComboDataType.Text == Constants.ValueType_Bool)
            {
                this.queryMeta.searchValue1 = (this.radioBtnYes.Checked == true ? radioBtnYes.Text : radioBtnNo.Text);
                this.queryMeta.searchValue2 = "";
            }
            this.TxtSearchQuery.Text = this.queryMeta.ToQueryText();
        }
コード例 #2
0
        private void BtnNext_Click(object sender, EventArgs e)
        {
            if (this.currentStep == 0)
            {
                if (this.ListGridColumns.SelectedIndex < 0)
                {
                    MessageBox.Show("Please select a column from the list on which the search query will run", Constants.msgAttention, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                int k = ComboDataType.FindStringExact(dgvToBeSearchedMeta.GetColumnValueTypeAt(this.ListGridColumns.SelectedIndex));
                if (k != ComboDataType.SelectedIndex)
                {
                    ComboDataType.SelectedIndex = k;
                    ComboSearchCondition.Items.Clear();
                    StaticFunctions.PopulateOperatorComboBox(ComboSearchCondition, ComboDataType.Text);
                }

                ActivePanel(1);
            }
            else if (this.currentStep == 1)
            {
                if (this.ComboDataType.Text == "")
                {
                    MessageBox.Show("Please choose the data type of the column", Constants.msgAttention, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (this.ComboSearchCondition.Text == "")
                {
                    MessageBox.Show("Please choose the search column condition", Constants.msgAttention, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                ActivePanel(2);
            }
            else if (this.currentStep == 2)
            {
                ActivePanel(0);

                // this is the last step, move the collected results to searchgrid
                string conj = this.radioBtnAnd.Text;
                if (this.radioBtnNot.Checked == true)
                {
                    conj = radioBtnNot.Text;
                }
                else if (this.radioBtnOr.Checked == true)
                {
                    conj = radioBtnOr.Text;
                }
                this.searchForm.BuildandAddSearchRow(conj, this.ListGridColumns.SelectedItem.ToString(),
                                                     ListGridColumns.SelectedIndex, ComboDataType.Text, ComboSearchCondition.Text,
                                                     TxtSearchVal1.Text, TxtSearchVal2.Text, this.ComboDataType.Text == Constants.ValueType_Bool ? 1 : 0);

                this.searchForm.UpdateQueryText();  // update the query text of the searchForm
                this.queryMeta.ResetValues();
                if (ListGridColumns.SelectedIndex > -1)
                {
                    queryMeta.colName = ListGridColumns.SelectedItem.ToString();
                }
                this.TxtSearchQuery.Text = queryMeta.ToQueryText();
            }


            this.currentStep++;
            if (this.currentStep == 3)
            {
                this.currentStep = 0;
                BtnBack.Enabled  = false;
            }
            else
            {
                BtnBack.Enabled = true;
            }
        }