Esempio n. 1
0
 private void dataGridView1_DataSourceChanged(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.Rows)
     {
         string syscolumnname = row.Cells["syscolumnname"].Value.ToString();
         if (syscolumnname == "")
         {
             syscolumnname = row.Cells[0].Value.ToString();
         }
         DataGridViewComboBoxCell cell = row.Cells[1] as DataGridViewComboBoxCell;
         if (cell != null)
         {
             bool hasfind = false;
             foreach (var x in cell.Items)
             {
                 CfGSTColumn item = x as CfGSTColumn;
                 if (item.ShownAme == syscolumnname)
                 {
                     cell.Value = item.ShownAme;
                     hasfind    = true;
                     break;
                 }
             }
             if (!hasfind)
             {
                 cell.Value = "忽略";
             }
         }
     }
 }
Esempio n. 2
0
        private void textBox1_Enter(object sender, EventArgs e)
        {
            CfGSTColumn col = (CfGSTColumn)cmbColName.SelectedItem;

            if (col.ShownAme.IndexOf("日") >= 0)
            {
                monthCalendar1.Visible = true;
                monthCalendar1.Top     = this.textBox1.Top + this.textBox1.Height + 10;
                monthCalendar1.Left    = textBox1.Left + 10;
                monthCalendar1.Update();
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            tmp.ColumnMapping.Clear();
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                DataGridViewComboBoxCell cell = row.Cells[1] as DataGridViewComboBoxCell;
                string excelname = row.Cells[0].Value.ToString();
                string splitchar = row.Cells[2].Value.ToString();
                if (cell != null)
                {
                    if (cell.Value.ToString() == "忽略")
                    {
                        continue;
                    }
                    string      colname  = cell.Value.ToString();
                    CfGSTColumn configst = (from x in ddl
                                            where x.ShownAme == colname
                                            select x).First();

                    ColumnMapping tmpmapping = new ColumnMapping();
                    tmpmapping.SplitChar            = splitchar;
                    tmpmapping.SystemColumnName     = configst.ColName;
                    tmpmapping.Tablename            = configst.TBName;
                    tmpmapping.Coltype              = configst.ClType;
                    tmpmapping.ExcelColumnName      = excelname;
                    tmpmapping.SystemColumnShowName = configst.ShownAme;
                    tmp.ColumnMapping.Add(excelname, tmpmapping);
                }
            }
            tmp.IsWPIDefault    = chkWPI_AN.Checked;
            tmp.IsEPODCODefault = chkEPO_AN.Checked;

            if (tmp.Name != this.txtTemple.Text.Trim())
            {
                TemplateHelper.Delete(tmp.Type + "_" + tmp.Name);
            }
            tmp.Name = this.txtTemple.Text;
            tmp.Type = this.cmbType.Text;
            TemplateHelper.SaveTemplate(tmp);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Trim() == "")
            {
                MessageBox.Show("请输入过滤条件", "提示");
                return;
            }
            monthCalendar1.Visible = false;
            CfGSTColumn col         = (CfGSTColumn)cmbColName.SelectedItem;
            string      filtertype  = cmbFilterType.Text;
            string      stroperator = "";
            string      values      = this.textBox1.Text.Trim();

            if (col.ShownAme.IndexOf("") > 0)
            {
                if (col.TBName != "show_base")
                {
                    values = values.FormatDate();
                }
            }
            switch (filtertype)
            {
            case "等于":
                stroperator = "=";
                break;

            case "不等于":
                stroperator = "<>";
                break;

            case "大于":
                stroperator = ">";
                break;

            case "小于":
                stroperator = "<";
                break;

            case "包含":
                stroperator = "like";
                values      = "%" + values + "%";
                break;

            case "不包含":
                stroperator = "not like";
                values      = "%" + values + "%";
                break;

            case "前方一致":
                stroperator = "like";
                values      = values + "%";
                break;

            case "后方一致":
                stroperator = "like";
                values      = "%" + values;
                break;
            }
            string sql = "";

            switch (col.ShownAme)
            {
            case "是否合作申请":
            case "是否国外来华":
            case "是否三局":
            case "是否五局":
            case "是否公知技术":
                if (values == "是")
                {
                    values = "1";
                    sql    = string.Format("{0}.{1} {2} {3}", col.TBName, col.ColName, stroperator, values);
                }
                if (values == "否")
                {
                    values = "0";
                    sql    = string.Format("({0}.{1} {2} {3} or {0}.{1} is null)", col.TBName, col.ColName, stroperator, values);
                }
                break;

            default:
                switch (col.ClType)
                {
                case "varchar":
                    values = "'" + values + "'";
                    break;
                }

                sql = string.Format("{0}.{1} {2} {3}", col.TBName, col.ColName, stroperator, values);
                break;
            }

            var res = from x in dt.AsEnumerable()
                      where x["Tabl_ColName"].ToString() == col.ColName && x["Tablename"].ToString() == col.TBName
                      select x;
            DataRow f;

            if (res.Count() == 0)
            {
                f = dt.NewRow();
            }
            else
            {
                f = res.First();
            }
            string andor = " and ";

            if (cmbLuoJi.Text == "或者")
            {
                andor = " or ";
            }
            f["luoji"]        = cmbLuoJi.Text;
            f["Colname"]      = col.ShownAme;
            f["Tablename"]    = col.TBName;
            f["Tabl_ColName"] = col.ColName;

            if (res.Count() == 0)
            {
                f["Sql"]           += sql;
                f["Colopererator"] += col.ShownAme + " " + filtertype + " " + values + " ";
            }
            else
            {
                f["Sql"]           += andor + sql;
                f["Colopererator"] += cmbLuoJi.Text + " " + col.ShownAme + " " + filtertype + " " + values + " ";
            }
            if (res.Count() == 0)
            {
                dt.Rows.Add(f);
            }
            BindData();
            ff();
        }
Esempio n. 5
0
        private void cmbColName_SelectedIndexChanged(object sender, EventArgs e)
        {
            CfGSTColumn col = (CfGSTColumn)cmbColName.SelectedItem;

            this.textBox1.Text = "";
            List <string> filtertype = null;
            List <string> yesorno    = new List <string>();

            switch (col.ClType)
            {
            case "int":
                filtertype = new List <string> {
                    "等于", "不等于", "大于", "小于"
                };
                break;

            case "varchar":
                filtertype = new List <string> {
                    "等于", "不等于", "包含", "不包含", "前方一致", "后方一致"
                };
                break;

            case "tinyint":
                filtertype = new List <string> {
                    "等于", "不等于", "大于", "小于"
                };
                break;
            }
            cmbFilterType.Items.Clear();
            switch (col.ShownAme)
            {
            case "是否合作申请":
            case "是否国外来华":
            case "是否三局":
            case "是否五局":
            case "是否公知技术":
                filtertype = new List <string> {
                    "等于"
                };
                yesorno = new List <string>()
                {
                    "是", "否"
                };
                break;

            case "专利类型":
                filtertype = new List <string> {
                    "等于", "不等于"
                };
                yesorno = new List <string>()
                {
                    "发明专利", "实用新型", "外观专利"
                };
                break;

            case "专利类型(含PCT)":
                filtertype = new List <string> {
                    "等于", "不等于"
                };
                yesorno = new List <string>()
                {
                    "发明专利", "发明专利PCT", "实用新型", "实用新型PCT", "外观专利"
                };
                break;

            case "申请人类型":
            case "主申请人类型":
                filtertype = new List <string> {
                    "等于", "不等于"
                };
                yesorno = new List <string>()
                {
                    "企业", "高校", "科研单位", "事业单位", "个人"
                };
                break;
            }
            if (col.ShownAme.IndexOf("日") >= 0)
            {
                filtertype = new List <string> {
                    "等于", "不等于", "大于", "小于"
                };
            }
            if (yesorno.Count > 0)
            {
                cmbvalue.Items.Clear();
                cmbvalue.Visible = true;
                textBox1.Visible = false;
                textBox1.Text    = "";
                foreach (var s in yesorno)
                {
                    cmbvalue.Items.Add(s);
                }
                cmbvalue.SelectedIndex = 0;
            }
            else
            {
                cmbvalue.Visible = false;
                textBox1.Visible = true;
            }
            foreach (var s in filtertype)
            {
                cmbFilterType.Items.Add(s);
            }
            cmbFilterType.SelectedIndex = 0;
        }