Esempio n. 1
0
        private void butSure_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateData() == false)
                {
                    return;
                }

                WhereItem result = new WhereItem();

                result.Name      = txtWhereItemName.Text;
                result.LinkType  = cbxLinkType.Text;
                result.Condition = rtbWhereContext.Text;


                foreach (TabPage tc in tabItems.TabPages)
                {
                    InputItem ii = new InputItem();
                    ii.CopyFrom(_wi.InputItems[tc.Name]);

                    if (string.IsNullOrEmpty(ii.ControlType))
                    {
                        ii.ControlType = QueryConstDefine.Txt;
                    }


                    result.AddInputItem(ii, ii.StartIndex);
                }

                result.SourceFmt = result.SaveWhereToString();

                _wi = result;

                _isOk = true;

                this.Close();
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
Esempio n. 2
0
        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                //tabItems.TabPages.Clear();
                if (_isTabChanging)
                {
                    return;
                }

                _isCondationChange = true;


                string     source = rtbWhereContext.Text;
                MatchInfos inputs = QueryHelper.GetMinMatchData(source, "[", "]");

                for (int i = _wi.InputItems.Values.Count - 1; i >= 0; i--)
                {
                    InputItem iiDel = _wi.InputItems.Values.ElementAt(i);
                    if (source.IndexOf("[" + iiDel.Name + "]") < 0)
                    {
                        _wi.InputItems.Remove(iiDel.Name);
                    }
                }

                //删除不存在的tab
                for (int i = tabItems.TabPages.Count - 1; i >= 0; i--)
                {
                    if (inputs.Contains(tabItems.TabPages[i].Name) == false)
                    {
                        tabItems.TabPages.RemoveAt(i);
                    }
                }



                InputControlEnable(true);


                foreach (MatchInfo input in inputs)
                {
                    if (string.IsNullOrEmpty(input.MatchContext))
                    {
                        continue;
                    }

                    if (tabItems.TabPages.IndexOfKey(input.MatchContext) >= 0)
                    {
                        continue;
                    }

                    if (input.MatchContext.IndexOf("系统_") >= 0)
                    {
                        continue;
                    }

                    tabItems.TabPages.Add(input.MatchContext, input.MatchContext);

                    if (_wi.InputItems.ContainsKey(input.MatchContext) == false)
                    {
                        InputItem curInput = new InputItem();
                        curInput.Name = input.MatchContext;

                        _wi.AddInputItem(curInput, input.StartIndex);
                    }
                }



                if (tabItems.TabPages.Count > 0)
                {
                    tabItems.SelectedIndex = 0;
                }
                else
                {
                    //清除数据
                    cbxControlType.SelectedIndex = 0;
                    rtbDataFrom.Text             = "";
                    txtExtPros.Text      = "";
                    txtDefaultValue.Text = "";
                    chkReplace.Checked   = false;
                }

                InputControlEnable((tabItems.TabPages.Count <= 0) ? false : true);

                rtbWhereContext.Focus();
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
            finally
            {
                _isCondationChange = false;
            }
        }