Пример #1
0
        private void btClear_Click(object sender, EventArgs e)
        {
            I3SearchItem item = (I3SearchItem)gridSearch.BindingContext[searchInfo.Items].Current;

            item.SearchType = I3SearchType.stNone;
            item.RefreshResult();

            viewSearch.UpdateCurrentRow();
        }
Пример #2
0
 public void Copy(I3SearchInfo source)
 {
     FirstIsAnd = source.FirstIsAnd;
     Items.Clear();
     foreach (I3SearchItem item in source.Items)
     {
         I3SearchItem tmpItem = new I3SearchItem();
         tmpItem.FieldName    = item.FieldName;
         tmpItem.FieldCaption = item.FieldCaption;
         tmpItem.FieldType    = item.FieldType;
         tmpItem.SearchType   = item.SearchType;
         tmpItem.LookString   = item.LookString;
         tmpItem.SearchString = item.SearchString;
         tmpItem.String1      = item.String1;
         tmpItem.Num1         = item.Num1;
         tmpItem.Num2         = item.Num2;
         tmpItem.Date1        = item.Date1;
         tmpItem.Date2        = item.Date2;
         tmpItem.RefreshResult();
         Items.Add(tmpItem);
     }
 }
Пример #3
0
        private void pc_VisibleChanged(object sender, EventArgs e)
        {
            if (!pc.Visible)
            {
                return;
            }
            if (gridSearch.BindingContext == null)
            {
                return;
            }
            if (gridSearch.BindingContext[searchInfo.Items] == null)
            {
                return;
            }
            if (gridSearch.BindingContext[searchInfo.Items].Current == null)
            {
                return;
            }

            I3SearchItem item = (I3SearchItem)gridSearch.BindingContext[searchInfo.Items].Current;

            tabControl1.TabPages.Clear();
            switch (item.FieldType)
            {
            case I3SearchItemType.sitString:
                tabControl1.TabPages.Add(pEqual);
                edEqualString.Visible = true;
                edEqualString.Text    = item.String1;
                edEqualNum.Visible    = false;
                edEqualDate.Visible   = false;
                tabControl1.TabPages.Add(pDim);
                edDimString.Visible = true;
                edDimString.Text    = item.String1;
                if (item.SearchType == I3SearchType.stNone || item.SearchType == I3SearchType.stEqual)
                {
                    tabControl1.SelectedTab = pEqual;
                    edEqualString.Focus();
                }
                else
                {
                    tabControl1.SelectedTab = pDim;
                    edDimString.Focus();
                }
                break;

            case I3SearchItemType.sitNum:
                tabControl1.TabPages.Add(pEqual);
                edEqualString.Visible = false;
                edEqualNum.Visible    = true;
                edEqualNum.Top        = edEqualString.Top;
                edEqualNum.Text       = item.Num1.ToString();
                edEqualDate.Visible   = false;
                tabControl1.TabPages.Add(pInterval);
                edNum1.Visible        = true;
                edNum1.Text           = item.Num1.ToString();
                lbIntervalNum.Visible = true;
                edNum2.Visible        = true;
                edNum2.Text           = item.Num2.ToString();
                dp.Visible            = false;
                if (item.SearchType == I3SearchType.stNone || item.SearchType == I3SearchType.stEqual)
                {
                    tabControl1.SelectedTab = pEqual;
                    edEqualNum.Focus();
                }
                else
                {
                    tabControl1.SelectedTab = pInterval;
                    edNum1.Focus();
                }
                break;

            case I3SearchItemType.sitDate:
                tabControl1.TabPages.Add(pEqual);
                edEqualString.Visible = false;
                edEqualNum.Visible    = false;
                edEqualDate.Visible   = true;
                edEqualDate.Value     = item.Date1;
                edEqualDate.Top       = edEqualString.Top;
                tabControl1.TabPages.Add(pInterval);
                edNum1.Visible        = false;
                lbIntervalNum.Visible = false;
                edNum2.Visible        = false;
                dp.Visible            = true;
                dp.Top       = edNum1.Top;
                dp.BeginDate = item.Date1;
                dp.EndDate   = item.Date2;
                if (item.SearchType == I3SearchType.stNone || item.SearchType == I3SearchType.stEqual)
                {
                    tabControl1.SelectedTab = pEqual;
                    edEqualDate.Focus();
                }
                else
                {
                    tabControl1.SelectedTab = pInterval;
                    dp.Focus();
                }
                break;

            default:
                break;
            }
        }
Пример #4
0
        private void btOK_Click(object sender, EventArgs e)
        {
            I3SearchItem item = (I3SearchItem)gridSearch.BindingContext[searchInfo.Items].Current;

            switch (item.FieldType)
            {
            case I3SearchItemType.sitString:
                if (tabControl1.TabPages[tabControl1.SelectedIndex] == pEqual)
                {
                    item.SearchType = I3SearchType.stEqual;
                    item.String1    = edEqualString.Text;
                }
                else
                {
                    item.SearchType = I3SearchType.stDim;
                    item.String1    = edDimString.Text;
                }
                item.RefreshResult();
                break;

            case I3SearchItemType.sitNum:
                if (tabControl1.TabPages[tabControl1.SelectedIndex] == pEqual)
                {
                    item.SearchType = I3SearchType.stEqual;
                    try
                    {
                        item.Num1 = float.Parse(edEqualNum.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请输入数值作为参数!", "输入数值", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                else
                {
                    item.SearchType = I3SearchType.stInterval;
                    try
                    {
                        item.Num1 = float.Parse(edNum1.Text);
                        item.Num2 = float.Parse(edNum2.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请输入数值作为参数!", "输入数值", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                item.RefreshResult();
                break;

            case I3SearchItemType.sitDate:
                if (tabControl1.TabPages[tabControl1.SelectedIndex] == pEqual)
                {
                    item.SearchType = I3SearchType.stEqual;
                    item.Date1      = edEqualDate.Value;
                }
                else
                {
                    item.SearchType = I3SearchType.stInterval;
                    item.Date1      = dp.BeginDate;
                    item.Date2      = dp.EndDate;
                }
                item.RefreshResult();
                break;

            default:
                break;
            }

            viewSearch.UpdateCurrentRow();
        }