Ejemplo n.º 1
0
 private void ClearConditon()
 {
     for (int i = 0; i < this.txtBoxList.Count; i++)
     {
         TextEditPLM tplm = (TextEditPLM)this.txtBoxList[i];
         tplm.Text = "";
         ComboBoxEditPLM tplm2 = (ComboBoxEditPLM)this.cobList[i];
         if ((tplm2.Text == "在..之间") || (tplm2.Text == "不在..之间"))
         {
             tplm.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
             tplm.Width  = (base.Width - tplm.Left) - 5;
             tplm2.Tag   = 0;
             for (int j = 0; j < this.lblList.Count; j++)
             {
                 LabelPLM    lplm  = (LabelPLM)this.lblList[j];
                 TextEditPLM tplm3 = (TextEditPLM)this.txtList[j];
                 if (lplm.Tag == tplm.Tag)
                 {
                     this.gbFilter.Controls.Remove(lplm);
                     this.lblList.Remove(lplm);
                 }
                 if (tplm3.Tag == tplm.Tag)
                 {
                     this.gbFilter.Controls.Remove(tplm3);
                     this.txtList.Remove(tplm3);
                 }
             }
         }
         tplm2.Text = "等于";
     }
     try
     {
         this.myView.RowFilter = "";
         this.DisplayData(this.myView);
     }
     catch (PLMException exception)
     {
         PrintException.Print(exception);
     }
     catch (Exception exception2)
     {
         MessageBoxPLM.Show("过滤数据发生错误" + exception2.ToString(), "筛选数据集", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Ejemplo n.º 2
0
        private void AddFilter(ArrayList attrList)
        {
            DEMetaAttribute attribute;
            ArrayList       list = new ArrayList();

            for (int i = 0; i < attrList.Count; i++)
            {
                attribute = (DEMetaAttribute)attrList[i];
                if (attribute.IsViewable && attribute.IsFilterable)
                {
                    list.Add(attribute);
                }
            }
            if (list.Count <= 0)
            {
                this.pnlFilter.Visible = false;
            }
            else
            {
                this.pnlFilter.Visible = true;
                this.pnlFilter.Size    = new Size(base.Width, 0x12 + (list.Count * 0x19));
                int width = 0;
                int num   = 0;
                while (num < list.Count)
                {
                    attribute = (DEMetaAttribute)list[num];
                    LabelPLM lplm = new LabelPLM {
                        Top      = 0x10 + (num * 0x19),
                        Left     = 5,
                        Name     = "lbl_" + attribute.Name,
                        Text     = attribute.Label,
                        AutoSize = true,
                        Anchor   = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top
                    };
                    if (width < lplm.Width)
                    {
                        width = lplm.Width;
                    }
                    ComboBoxEditPLM tplm2 = new ComboBoxEditPLM {
                        DropDownStyle = ComboBoxStyle.DropDownList,
                        Left          = lplm.Right + 5,
                        BackColor     = SystemColors.Control,
                        Top           = 0x10 + (num * 0x19),
                        Height        = 20,
                        Width         = 80
                    };
                    if (((attribute.DataType == 0) || (attribute.DataType == 1)) || ((attribute.DataType == 2) || (attribute.DataType == 6)))
                    {
                        tplm2.Properties.Items.AddRange(new object[] { "等于", "大于", "小于", "大于等于", "小于等于", "不等于", "在..之间", "不在..之间" });
                    }
                    else if (((attribute.DataType == 4) || (attribute.DataType == 7)) || ((attribute.DataType == 3) || (attribute.DataType == 5)))
                    {
                        tplm2.Properties.Items.AddRange(new object[] { "等于", "不等于", "前几字符是", "后几字符是", "包含" });
                        tplm2.Text = "等于";
                    }
                    else
                    {
                        tplm2.Properties.Items.AddRange(new object[] { "等于", "大于", "小于", "大于等于", "小于等于", "不等于", "在..之间", "不在..之间", "前几字符是", "后几字符是", "包含" });
                    }
                    tplm2.Name = "comb_" + attribute.Name;
                    if (tplm2.Text == "")
                    {
                        tplm2.Text = "等于";
                    }
                    tplm2.Tag = 0;
                    tplm2.SelectedIndexChanged += new EventHandler(this.comb_SelectedIndexChanged);
                    TextEditPLM tplm = new TextEditPLM {
                        Left      = tplm2.Right + 5,
                        BackColor = SystemColors.Control,
                        Top       = 0x10 + (num * 0x19),
                        Name      = "txtValue_" + attribute.Name,
                        Size      = new Size(80, 0x15),
                        Text      = "",
                        Tag       = attribute,
                        Anchor    = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top
                    };
                    tplm.TextChanged += new EventHandler(this.txtValue_TextChanged);
                    this.gbFilter.Controls.Add(lplm);
                    this.gbFilter.Controls.Add(tplm2);
                    this.gbFilter.Controls.Add(tplm);
                    this.txtBoxList.Add(tplm);
                    this.cobList.Add(tplm2);
                    num++;
                }
                for (num = 0; num < this.cobList.Count; num++)
                {
                    ComboBoxEditPLM tplm3 = (ComboBoxEditPLM)this.cobList[num];
                    tplm3.Left  = (5 + width) + 5;
                    tplm3.Width = 0x58;
                    TextEditPLM tplm4 = (TextEditPLM)this.txtBoxList[num];
                    tplm4.Left  = tplm3.Right + 5;
                    tplm4.Width = (base.Width - tplm4.Left) - 5;
                }
            }
        }
Ejemplo n.º 3
0
        private void comb_SelectedIndexChanged(object sender, EventArgs e)
        {
            TextEditPLM tplm2;
            int         num = -1;

            this.FilterData();
            for (int i = 0; i < this.cobList.Count; i++)
            {
                ComboBoxEditPLM tplm = (ComboBoxEditPLM)this.cobList[i];
                if (tplm.ContainsFocus)
                {
                    int tag = (int)tplm.Tag;
                    if ((tplm.Text == "在..之间") || (tplm.Text == "不在..之间"))
                    {
                        if (tag == 1)
                        {
                            return;
                        }
                        num      = i;
                        tplm.Tag = 1;
                    }
                    else
                    {
                        switch (tag)
                        {
                        case 0:
                            return;

                        case 1:
                            for (int j = 0; j < this.lblList.Count; j++)
                            {
                                tplm2        = (TextEditPLM)this.txtBoxList[i];
                                tplm2.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
                                tplm2.Width  = (base.Width - tplm2.Left) - 5;
                                tplm.Tag     = 0;
                                LabelPLM    lplm  = (LabelPLM)this.lblList[j];
                                TextEditPLM tplm3 = (TextEditPLM)this.txtList[j];
                                if (lplm.Tag == tplm2.Tag)
                                {
                                    this.gbFilter.Controls.Remove(lplm);
                                    this.lblList.Remove(lplm);
                                }
                                if (tplm3.Tag == tplm2.Tag)
                                {
                                    this.gbFilter.Controls.Remove(tplm3);
                                    this.txtList.Remove(tplm3);
                                }
                            }
                            break;
                        }
                    }
                }
            }
            if (num >= 0)
            {
                tplm2        = (TextEditPLM)this.txtBoxList[num];
                tplm2.Anchor = AnchorStyles.Left | AnchorStyles.Top;
                tplm2.Width  = ((base.Width - tplm2.Left) - 50) / 2;
                LabelPLM lplm2 = new LabelPLM {
                    Top   = tplm2.Top,
                    Left  = tplm2.Right + 5,
                    Text  = " AND ",
                    Width = 0x23,
                    Tag   = tplm2.Tag
                };
                this.lblList.Add(lplm2);
                TextEditPLM tplm4 = new TextEditPLM {
                    Top  = tplm2.Top,
                    Left = lplm2.Right + 5,
                    Text = ""
                };
                tplm4.Width        = (base.Width - 5) - tplm4.Left;
                tplm4.Tag          = tplm2.Tag;
                tplm4.BackColor    = SystemColors.Control;
                tplm4.Anchor       = AnchorStyles.Left | AnchorStyles.Top;
                tplm4.TextChanged += new EventHandler(this.txtValue_TextChanged);
                this.txtList.Add(tplm4);
                this.gbFilter.Controls.Add(lplm2);
                this.gbFilter.Controls.Add(tplm4);
            }
        }