public DataView Filter(DataView dvTblResult) { clsStr clsStr = new clsStr(); if (MDIParent.strKeyWord != "") { string text = ""; for (int i = 0; i < dvTblResult.Table.Columns.Count; i++) { if (text == "") { text = dvTblResult.Table.Columns[i].ColumnName + " like '%" + MDIParent.strKeyWord + "%'"; } else { string text2 = text; text = string.Concat(new string[] { text2, " or ", dvTblResult.Table.Columns[i].ColumnName, " like '%", MDIParent.strKeyWord, "%'" }); } } dvTblResult.RowFilter = text; } return(dvTblResult); }
public DataView Filter(DataView dvTblResult) { clsStr clsStr = new clsStr(); if (MDIParent.strKeyWord != "") { string text = ""; for (int i = 0; i < dvTblResult.Table.Columns.Count; i++) { if (text == "") { text = dvTblResult.Table.Columns[i].ColumnName + " like '%" + MDIParent.strKeyWord + "%'"; } else { string text2 = text; text = string.Concat(new string[] { text2, " or ", dvTblResult.Table.Columns[i].ColumnName, " like '%", MDIParent.strKeyWord, "%'" }); } } dvTblResult.RowFilter = text; } return dvTblResult; }
public frmTJSYSPXX(string strZLBH) { this.InitializeComponent(); clsMe clsMe = new clsMe(); clsMe.setFormStyl(this); clsStr clsStr = new clsStr(); clsCommon clsCommon = new clsCommon(); this.initT14(); DataRow[] array = this.dsT14.Tables["t14"].Select("BH='" + strZLBH + "'"); this.lblQYMC.Text = array[0]["QYMC"].ToString() + ":"; this.strCPMC = array[0]["CPMC"].ToString(); this.strCPBM = array[0]["CPBM"].ToString(); DataTable dataTable = new DataTable(); dataTable.TableName = "Result"; dataTable.Columns.Add("ZW"); dataTable.Columns.Add("FZDX"); dataTable.Columns.Add("SPZT"); string[] array2 = clsStr.Seperate(array[0]["ZW"].ToString(), '|'); string[] array3 = clsStr.Seperate(array[0]["FZDX"].ToString(), '|'); string[] array4 = clsStr.Seperate(array[0]["SPZT"].ToString(), '|'); for (int i = 0; i < array2.Length; i++) { if (!(array2[i].ToString() == "") || !(array3[i].ToString() == "")) { DataRow dataRow = dataTable.NewRow(); dataRow["ZW"] = array2[i]; dataRow["FZDX"] = array3[i]; string text = array4[i]; if (text != null) { if (text == "1") { dataRow["SPZT"] = "同意"; } } dataTable.Rows.Add(dataRow); } } this.grvZWFZDXSPXX.DataSource = dataTable; }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; if (this.txtZLBH.Text.Trim().Length <= 0 && this.txtZHSLH.Text.Trim().Length <= 0) { MessageBox.Show(this, "综合受理号和资料编号不能都空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtZHSLH.Focus(); this.Cursor = Cursors.Arrow; } else { if (this.txtSCQY.Text.Trim().Length <= 0) { MessageBox.Show(this, "生产企业名称不能空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtSCQY.Focus(); this.Cursor = Cursors.Arrow; } else { string text = ""; if (this.txtZLBH.Text.Trim() != "") { if (text == "") { text = "ZLBH like '%" + this.txtZLBH.Text.Trim() + "%'"; } else { text = text + " and ZLBH like '%" + this.txtZLBH.Text.Trim() + "%'"; } } if (this.txtZHSLH.Text.Trim() != "") { if (text == "") { text = "BSBH like '%" + this.txtZHSLH.Text.Trim() + "%'"; } else { text = text + " and BSBH like '%" + this.txtZHSLH.Text.Trim() + "%'"; } } if (this.txtCPMC.Text.Trim() != "") { if (text == "") { text = "CPMC like '%" + this.txtCPMC.Text.Trim() + "%'"; } else { text = text + " and CPMC like '%" + this.txtCPMC.Text.Trim() + "%'"; } } if (this.txtSCQY.Text.Trim() != "") { if (text == "") { text = "FMISPCNAME = '" + this.txtSCQY.Text.Trim() + "'"; } else { text = text + " and FMISPCNAME = '" + this.txtSCQY.Text.Trim() + "'"; } } DataRow[] array = this.dsT15.Tables["t15"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["ZLBH"] = array[i]["ZLBH"]; dataRow["BSBH"] = array[i]["BSBH"]; dataRow["CPMC"] = array[i]["CPMC"]; dataRow["FMISPCNAME"] = array[i]["FMISPCNAME"]; dataRow["ZTMC"] = array[i]["ZTMC"]; dataRow["SQRQ"] = array[i]["SQRQ"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtZLBH.Focus(); } } } }
public frmNYDetail(string strR1, string strF8, string strF14) { this.InitializeComponent(); clsMe clsMe = new clsMe(); clsMe.setFormStyl(this); this.strF8 = strF8; this.strF14 = strF14; clsStr clsStr = new clsStr(); DataRow[] array = MDIParent.dsP.Tables["P"].Select("R1='" + strR1 + "'"); this.txtDJZH.Text = array[0]["R1"].ToString(); this.txtYXQSRQ.Text = array[0]["R4"].ToString(); this.txtYXJZRQ.Text = array[0]["R5"].ToString(); this.txtDJMC.Text = array[0]["R2"].ToString(); this.txtDX.Text = array[0]["R11"].ToString(); this.txtJX.Text = array[0]["R13"].ToString(); this.txtDWMC.Text = array[0]["F2"].ToString(); this.txtNYLB.Text = array[0]["R12"].ToString(); this.txtXKZH.Text = array[0]["R80"].ToString(); this.txtQYBZ.Text = array[0]["R90"].ToString(); DataTable dataTable = new DataTable(); dataTable.TableName = "Result1"; dataTable.Columns.Add("E2"); dataTable.Columns.Add("E3"); dataTable.Columns.Add("R7"); string[] array2 = clsStr.Seperate(array[0]["E2"].ToString(), '、'); string[] array3 = clsStr.Seperate(array[0]["E3"].ToString(), '、'); string[] array4 = clsStr.Seperate(array[0]["R7"].ToString(), '、'); for (int i = 0; i < array2.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["E2"] = array2[i]; dataRow["E3"] = array3[i]; dataRow["R7"] = array4[i]; dataTable.Rows.Add(dataRow); } this.grvYXCF.DataSource = dataTable; DataTable dataTable2 = new DataTable(); dataTable2.TableName = "Result2"; dataTable2.Columns.Add("C2"); dataTable2.Columns.Add("T2"); dataTable2.Columns.Add("R10"); dataTable2.Columns.Add("R14"); string[] array5 = clsStr.Seperate(array[0]["C2"].ToString(), '|'); string[] array6 = clsStr.Seperate(array[0]["T2"].ToString(), '|'); string[] array7 = clsStr.Seperate(array[0]["R10"].ToString(), '|'); string[] array8 = clsStr.Seperate(array[0]["R14"].ToString(), '|'); for (int i = 0; i < array5.Length; i++) { if (!(array5[i].ToString() == "") || !(array6[i].ToString() == "")) { DataRow dataRow = dataTable2.NewRow(); dataRow["C2"] = array5[i]; dataRow["T2"] = array6[i]; dataRow["R10"] = array7[i]; dataRow["R14"] = array8[i]; dataTable2.Rows.Add(dataRow); } } this.grvZWFZDX.DataSource = dataTable2; this.pages = ((DataTable)this.grvZWFZDX.DataSource).Rows.Count / (this.pagesize + 1); if (this.pages * (this.pagesize + 1) != ((DataTable)this.grvZWFZDX.DataSource).Rows.Count) { this.pages++; } }
private void btnSearch_Click(object sender, EventArgs e) { this.SetHeaders(this.GetHeaderType()); this.SetGridControl(this.GetHeaderType()); clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; if (this.txtDWMC.Text.Trim() != "") { if (text == "") { text = "SYDW like '%" + this.txtDWMC.Text.Trim() + "%'"; } else { text = text + " and SYDW like '%" + this.txtDWMC.Text.Trim() + "%'"; } } if (this.txtLXR.Text.Trim() != "") { if (text == "") { text = "LXR like '%" + this.txtLXR.Text.Trim() + "%'"; } else { text = text + " and LXR like '%" + this.txtLXR.Text.Trim() + "%'"; } } if (this.txtAddress.Text.Trim() != "") { if (text == "") { text = "DWDZ like '%" + this.txtAddress.Text.Trim() + "%'"; } else { text = text + " and DWDZ like '%" + this.txtAddress.Text.Trim() + "%'"; } } clsCommon clsCommon = new clsCommon(); this.tblSYDW.Rows.Clear(); this.tblSYDW.Columns.Clear(); this.tblSYDW = clsCommon.GetFile(this.GetHeaderType()); DataRow[] array = this.tblSYDW.Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array.Length; i++) { DataRow dataRow = dataTable.NewRow(); if (this.radSC.Checked) { dataRow["SYDW"] = array[i]["SYDW"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YZBM"] = array[i]["YZBM"]; dataRow["LXR"] = array[i]["LXR"]; dataRow["tel"] = array[i]["tel"]; } else { if (this.radCL.Checked) { dataRow["SYDW"] = array[i]["SYDW"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["tel"] = array[i]["tel"]; } else { if (this.radDL.Checked) { dataRow["DWMC"] = array[i]["DWMC"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YB"] = array[i]["YB"]; dataRow["tel"] = array[i]["tel"]; dataRow["JD"] = array[i]["JD"]; } else { if (this.radHJ.Checked) { dataRow["DWMC"] = array[i]["DWMC"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YB"] = array[i]["YB"]; dataRow["tel"] = array[i]["tel"]; dataRow["SYXM"] = array[i]["SYXM"]; } else { if (this.radQFX.Checked) { dataRow["DWMC"] = array[i]["DWMC"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YB"] = array[i]["YB"]; dataRow["LXR"] = array[i]["LXR"]; dataRow["tel"] = array[i]["tel"]; dataRow["email"] = array[i]["email"]; } } } } } dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDWMC.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text = "E16 is not null or E17 is not null or E18 is not null"; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text == "") { text = string.Concat(new string[] { "(E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } else { string text2 = text; text = string.Concat(new string[] { text2, " or (E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } } } DataRow[] array2 = MDIParent.dsAED.Tables["AED"].Select(text); this.tblResult.Clear(); if (array2.Length > 0) { DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["E2"] = array2[i]["E2"]; dataRow["E3"] = array2[i]["E3"]; dataRow["E16"] = array2[i]["E16"]; dataRow["E17"] = array2[i]["E17"]; dataRow["E18"] = array2[i]["E18"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; } this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtFZDX.Text, ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "T2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or T2 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.cboZWLB.Text.Trim() != "") { if (text == "") { text = "CT like '%" + this.cboZWLB.Text.Trim() + "%'"; } else { text = text + " and CT like '%" + this.cboZWLB.Text.Trim() + "%'"; } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { string[] array3 = clsStr.Seperate(array2[i]["C2"].ToString(), '|'); string[] array4 = clsStr.Seperate(array2[i]["T2"].ToString(), '|'); string[] array5 = clsStr.Seperate(array2[i]["CT"].ToString(), '|'); for (int j = 0; j < array4.Length; j++) { bool flag = false; if (this.cboZWLB.Text.Trim() != "") { if (array5[j].ToString() == this.cboZWLB.Text.Trim()) { for (int k = 0; k < array.Length; k++) { if (this.txtFZDX.Text.Trim() == "") { flag = true; break; } if (!(array[k].ToString() == "")) { if (array4[j].IndexOf(array[k]) >= 0) { flag = true; break; } } } } } else { for (int k = 0; k < array.Length; k++) { if (this.txtFZDX.Text.Trim() == "") { flag = true; break; } if (!(array[k].ToString() == "")) { if (array4[j].IndexOf(array[k]) >= 0) { flag = true; break; } } } } if (flag) { DataRow dataRow = dataTable.NewRow(); dataRow["C2"] = array3[j]; dataRow["T2"] = array4[j]; dataTable.Rows.Add(dataRow); } } } DataRow[] array6 = dataTable.Select("C2<>'' and T2<>''", "C2,T2"); DataTable dataTable2 = new DataTable(); dataTable2 = this.tblResult.Clone(); string b = "***"; string b2 = "***"; for (int i = 0; i < array6.Length; i++) { if (array6[i]["C2"].ToString() != b || array6[i]["T2"].ToString() != b2) { DataRow dataRow = dataTable2.NewRow(); dataRow["C2"] = array6[i]["C2"]; dataRow["T2"] = array6[i]["T2"]; b = array6[i]["C2"].ToString(); b2 = array6[i]["T2"].ToString(); dataTable2.Rows.Add(dataRow); } } this.tblResult = dataTable2.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtFZDX.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = string.Concat(new string[] { "(E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } else { if (this.cboAndOr.Text == "或") { string text3 = text2; text2 = string.Concat(new string[] { text3, " or (E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } else { string text3 = text2; text2 = string.Concat(new string[] { text3, " and (E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.radHJ.Checked) { if (text == "") { text = "E2 like '%、%'"; } else { text += " and E2 like '%、%'"; } } else { if (this.radDJ.Checked) { if (text == "") { text = "E2 not like '%、%'"; } else { text += " and E2 not like '%、%'"; } } } if (this.radYY.Checked) { if (text == "") { text = "(R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } else { text += " and (R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } } else { if (!this.radAll.Checked) { if (text == "") { text = "(R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } else { text += " and (R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); try { for (int i = 0; i < array2.Length; i++) { string[] array3 = clsStr.Seperate(array2[i]["C2"].ToString(), '|'); string[] array4 = clsStr.Seperate(array2[i]["T2"].ToString(), '|'); for (int j = 0; j < array3.Length; j++) { if (!(array3[j].ToString() == "") || !(array4[j].ToString() == "")) { DataRow dataRow = dataTable.NewRow(); dataRow["C2"] = array3[j]; dataRow["T2"] = array4[j]; dataTable.Rows.Add(dataRow); } } } } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } DataRow[] array5 = dataTable.Select("C2<>'' AND T2<>''", "C2,T2"); DataTable dataTable2 = new DataTable(); dataTable2 = this.tblResult.Clone(); string b = "***"; string b2 = "***"; for (int i = 0; i < array5.Length; i++) { if (array5[i]["C2"].ToString() != b || array5[i]["T2"].ToString() != b2) { DataRow dataRow = dataTable2.NewRow(); dataRow["C2"] = array5[i]["C2"]; dataRow["T2"] = array5[i]["T2"]; b = array5[i]["C2"].ToString(); b2 = array5[i]["T2"].ToString(); dataTable2.Rows.Add(dataRow); } } this.tblResult = dataTable2.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); clsCommon clsCommon = new clsCommon(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "c1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or c1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } DataRow[] array2 = clsCommon.GetFileData("SYZZ").Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["c1"] = array2[i]["c1"]; dataRow["c2"] = array2[i]["c2"]; dataRow["c3"] = array2[i]["c3"]; dataRow["c4"] = array2[i]["c4"]; dataRow["c5"] = array2[i]["c5"]; dataRow["c6"] = array2[i]["c6"]; dataRow["c7"] = array2[i]["c7"]; dataRow["c8"] = array2[i]["c8"]; dataRow["c9"] = array2[i]["c9"]; dataRow["c10"] = array2[i]["c10"]; dataRow["c11"] = array2[i]["c11"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
public DataView FilterNY(DataView dvTblResult) { clsStr clsStr = new clsStr(); if (MDIParent.strKeyWord != "") { string text = ""; string[] array = clsStr.Seperate(MDIParent.strKeyWord, ' '); if (MDIParent.strFilterField == "") { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R1 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " or HL like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " and HL like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R13 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R13 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or F2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and F2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R4 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R4 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R5 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R5 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R11 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R11 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R12 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R12 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } } else { string[] array2 = clsStr.Seperate(MDIParent.strFilterField, '|'); for (int j = 0; j < array2.Length; j++) { string text3 = array2[j]; switch (text3) { case "R1": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R1 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R2": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "HL": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " or HL like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " and HL like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R12": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R12 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R12 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "F2": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or F2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and F2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R4": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R4 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R4 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R5": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R5 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R5 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R13": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R13 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R13 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R11": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R11 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R11 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } } } } dvTblResult.RowFilter = text; dvTblResult.Sort = ""; } return(dvTblResult); }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; if (this.txtQYMC.Text.Trim().Length <= 0 && this.txtZLBH.Text.Trim().Length <= 0 && this.txtCPMC.Text.Trim().Length <= 0 && this.txtCPBM.Text.Trim().Length <= 0) { MessageBox.Show(this, "查询条件不能全空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtQYMC.Focus(); this.Cursor = Cursors.Arrow; } else { string text = ""; if (this.txtQYMC.Text.Trim() != "") { if (text == "") { text = "QYMC like '%" + this.txtQYMC.Text.Trim() + "%'"; } else { text = text + " and QYMC like '%" + this.txtQYMC.Text.Trim() + "%'"; } } if (this.txtZLBH.Text.Trim() != "") { if (text == "") { text = "BH like '%" + this.txtZLBH.Text.Trim() + "%'"; } else { text = text + " and BH like '%" + this.txtZLBH.Text.Trim() + "%'"; } } if (this.txtCPMC.Text.Trim() != "") { if (text == "") { text = "CPMC like '%" + this.txtCPMC.Text.Trim() + "%'"; } else { text = text + " and CPMC like '%" + this.txtCPMC.Text.Trim() + "%'"; } } if (this.txtCPBM.Text.Trim() != "") { if (text == "") { text = "CPBM like '%" + this.txtCPBM.Text.Trim() + "%'"; } else { text = text + " and CPBM like '%" + this.txtCPBM.Text.Trim() + "%'"; } } DataRow[] array = frmTJSY.dsT14.Tables["t14"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["ZLBH"] = array[i]["BH"]; dataRow["CPMC"] = array[i]["CPMC"]; dataRow["CPBM"] = array[i]["CPBM"]; dataRow["QYMC"] = array[i]["QYMC"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtQYMC.Focus(); } } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); if (this.radHJ.Checked) { if ((this.txtHL1.Text.Trim() != "" || this.cboUnit1.Text.Trim() != "") && this.gridlokYXCF1.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的有效成分1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.gridlokYXCF1.Focus(); return; } if ((this.txtHL2.Text.Trim() != "" || this.cboUnit2.Text.Trim() != "") && this.gridlokYXCF2.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的有效成分2!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.gridlokYXCF2.Focus(); return; } if ((this.txtHL3.Text.Trim() != "" || this.cboUnit3.Text.Trim() != "") && this.gridlokYXCF3.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的有效成分3!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.gridlokYXCF3.Focus(); return; } if (this.txtHL1.Text.Trim() != "" && this.cboUnit1.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.cboUnit1.Focus(); return; } if (this.txtHL2.Text.Trim() != "" && this.cboUnit2.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.cboUnit2.Focus(); return; } if (this.txtHL3.Text.Trim() != "" && this.cboUnit3.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.cboUnit3.Focus(); return; } } else { if (this.radDJ.Checked) { if ((this.txtHL1.Text.Trim() != "" || this.cboUnit1.Text.Trim() != "") && this.gridlokYXCF1.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的有效成分1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.gridlokYXCF1.Focus(); return; } if (this.txtHL1.Text.Trim() != "" && this.cboUnit1.Text.Trim() == "") { MessageBox.Show(this, "请输入对应的单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.cboUnit1.Focus(); return; } } } this.Cursor = Cursors.WaitCursor; string text = ""; if (this.radHJ.Checked) { if (text == "") { text = "E2 like '%、%'"; } else { text += " and E2 like '%、%'"; } } else { if (this.radDJ.Checked) { if (text == "") { text = "E2 not like '%、%'"; } else { text += " and E2 not like '%、%'"; } } } if (this.gridlokYXCF1.Text.Trim() != "") { if (text == "") { text = string.Concat(new string[] { "(E2 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%')" }); } else { string text2 = text; text = string.Concat(new string[] { text2, " and (E2 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF1.Text.Trim().Replace("%", "[%]"), "%')" }); } } if (this.gridlokYXCF2.Text.Trim() != "") { if (text == "") { text = string.Concat(new string[] { "(E2 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%')" }); } else { string text2 = text; text = string.Concat(new string[] { text2, " and (E2 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF2.Text.Trim().Replace("%", "[%]"), "%')" }); } } if (this.gridlokYXCF3.Text.Trim() != "") { if (text == "") { text = string.Concat(new string[] { "(E2 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%')" }); } else { string text2 = text; text = string.Concat(new string[] { text2, " and (E2 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF3.Text.Trim().Replace("%", "[%]"), "%')" }); } } if (this.cboYYZL.Text.Trim() != "") { if (text == "") { text = "R13 like '%" + this.cboYYZL.Text.Trim() + "%'"; } else { text = text + " and R13 like '%" + this.cboYYZL.Text.Trim() + "%'"; } } else { if (this.radYY.Checked) { if (text == "") { text = "(R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } else { text += " and (R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } } else { if (!this.radAll.Checked) { if (text == "") { text = "(R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } else { text += " and (R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } } } } if (this.gridlokYXCF.Text.Trim() != "") { if (text == "") { text = string.Concat(new string[] { "(E2 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%')" }); } else { string text2 = text; text = string.Concat(new string[] { text2, " and (E2 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%' or E3 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%' or E4 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%' or E5 like '%", this.gridlokYXCF.Text.Trim().Replace("%", "[%]"), "%')" }); } } DataRow[] array = MDIParent.dsP.Tables["P"].Select(text, "F2"); DataRow[] array2 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); int num = 0; int num2 = 0; int i = 0; for (int j = 0; j < array.Length; j++) { while (i < array2.Length) { if (!this.radYY.Checked) { string[] array3 = clsStr.Seperate(array[j]["E2"].ToString(), '、'); string[] array4 = clsStr.Seperate(array[j]["E3"].ToString(), '、'); string[] array5 = clsStr.Seperate(array[j]["E4"].ToString(), '、'); string[] array6 = clsStr.Seperate(array[j]["E5"].ToString(), '、'); string[] array7 = clsStr.Seperate(array[j]["R7"].ToString(), '、'); num = 0; num2 = 0; if (this.gridlokYXCF1.Text.Trim() != "") { num++; if (this.txtHL1.Text.Trim() != "") { for (int k = 0; k < array3.Length; k++) { if ((array3[k].IndexOf(this.gridlokYXCF1.Text.Trim()) >= 0 || array4[k].IndexOf(this.gridlokYXCF1.Text.Trim()) >= 0 || array5[k].IndexOf(this.gridlokYXCF1.Text.Trim()) >= 0 || array6[k].IndexOf(this.gridlokYXCF1.Text.Trim()) >= 0) && array7[k] == this.txtHL1.Text.Trim() + this.cboUnit1.Text.Trim()) { num2++; } } } else { num2++; } } if (this.gridlokYXCF2.Text.Trim() != "") { num++; if (this.txtHL2.Text.Trim() != "") { for (int k = 0; k < array3.Length; k++) { if ((array3[k].IndexOf(this.gridlokYXCF2.Text.Trim()) >= 0 || array4[k].IndexOf(this.gridlokYXCF2.Text.Trim()) >= 0 || array5[k].IndexOf(this.gridlokYXCF2.Text.Trim()) >= 0 || array6[k].IndexOf(this.gridlokYXCF2.Text.Trim()) >= 0) && array7[k] == this.txtHL2.Text.Trim() + this.cboUnit2.Text.Trim()) { num2++; } } } else { num2++; } } if (this.gridlokYXCF3.Text.Trim() != "") { num++; if (this.txtHL3.Text.Trim() != "") { for (int k = 0; k < array3.Length; k++) { if ((array3[k].IndexOf(this.gridlokYXCF3.Text.Trim()) >= 0 || array4[k].IndexOf(this.gridlokYXCF3.Text.Trim()) >= 0 || array5[k].IndexOf(this.gridlokYXCF3.Text.Trim()) >= 0 || array6[k].IndexOf(this.gridlokYXCF3.Text.Trim()) >= 0) && array7[k] == this.txtHL3.Text.Trim() + this.cboUnit3.Text.Trim()) { num2++; } } } else { num2++; } } } if (array[j]["F2"].ToString() == array2[i]["F2"].ToString()) { if (num2 >= num || this.radYY.Checked) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array[j]["R1"]; dataRow["R2"] = array[j]["R2"]; dataRow["HL"] = array[j]["HL"]; dataRow["R12"] = array[j]["R12"]; dataRow["R80"] = array[j]["R80"]; dataRow["R90"] = array[j]["R90"]; dataRow["R4"] = array[j]["R4"]; dataRow["R5"] = array[j]["R5"]; dataRow["F2"] = array[j]["F2"]; dataRow["F9"] = array2[i]["F9"]; dataRow["F14"] = array2[i]["F14"]; dataRow["R11"] = array[j]["R11"]; dataRow["R13"] = array[j]["R13"]; dataRow["E2"] = array[j]["E2"]; dataRow["E3"] = array[j]["E3"]; if (this.radDJ.Checked || this.radYY.Checked) { } dataTable.Rows.Add(dataRow); } break; } i++; } } this.tblResult = dataTable.Copy(); DataView dataView = new DataView(this.tblResult); dataView.Sort = "R5 desc"; this.gridControl1.DataSource = dataView; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该产品已被吊销、禁止发布等;\r\n3、不存在该产品;\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (this.panYY.Visible) { this.gridlokYXCF.Focus(); } else { this.gridlokYXCF1.Focus(); } } }
public frmNYList(string strLinkType, string strConditions) { this.InitializeComponent(); clsMe clsMe = new clsMe(); clsMe.setFormStyl(this); clsStr clsStr = new clsStr(); DataView dataView = new DataView(MDIParent.dsP.Tables["P"]); switch (strLinkType) { case "QY_Used": dataView.RowFilter = string.Concat(new string[] { "F2='", strConditions, "' and R5>'", clsStr.Format(DateTime.Now.Date.ToString(), '-'), "'" }); this.SetHeaders_QY(); for (int i = 0; i < dataView.Count; i++) { DataRow dataRow = this.tblResult.NewRow(); dataRow["R1"] = dataView[i]["R1"]; dataRow["R2"] = dataView[i]["R2"]; dataRow["HL"] = dataView[i]["HL"]; dataRow["R12"] = dataView[i]["R12"]; dataRow["R4"] = dataView[i]["R4"]; dataRow["R5"] = dataView[i]["R5"]; dataRow["F2"] = dataView[i]["F2"]; dataRow["R13"] = dataView[i]["R13"]; dataRow["R11"] = dataView[i]["R11"]; dataRow["C2"] = dataView[i]["C2"].ToString().Replace("|", "、"); dataRow["T2"] = dataView[i]["T2"].ToString().Replace("|", "、"); dataRow["R10"] = dataView[i]["R10"].ToString().Replace("|", "、"); this.tblResult.Rows.Add(dataRow); } this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_QY(); break; case "QY_Unused": dataView.RowFilter = string.Concat(new string[] { "F2='", strConditions, "' and R5<'", clsStr.Format(DateTime.Now.Date.ToString(), '-'), "'" }); this.SetHeaders_QY(); for (int i = 0; i < dataView.Count; i++) { DataRow dataRow = this.tblResult.NewRow(); dataRow["R1"] = dataView[i]["R1"]; dataRow["R2"] = dataView[i]["R2"]; dataRow["HL"] = dataView[i]["HL"]; dataRow["R12"] = dataView[i]["R12"]; dataRow["R4"] = dataView[i]["R4"]; dataRow["R5"] = dataView[i]["R5"]; dataRow["F2"] = dataView[i]["F2"]; dataRow["R13"] = dataView[i]["R13"]; dataRow["R11"] = dataView[i]["R11"]; dataRow["C2"] = dataView[i]["C2"].ToString().Replace("|", "、"); dataRow["T2"] = dataView[i]["T2"].ToString().Replace("|", "、"); dataRow["R10"] = dataView[i]["R10"].ToString().Replace("|", "、"); this.tblResult.Rows.Add(dataRow); } this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_QY(); break; case "YXCF": { string[] array = clsStr.Seperate(strConditions, '|'); dataView.RowFilter = string.Concat(new string[] { "E2 like '%", array[0], "%' and E3 like '%", array[1], "%'" }); this.SetHeaders_YXCF(); for (int i = 0; i < dataView.Count; i++) { string[] array2 = clsStr.Seperate(dataView[i]["E2"].ToString(), '、'); string[] array3 = clsStr.Seperate(dataView[i]["E3"].ToString(), '、'); for (int j = 0; j < array2.Length; j++) { if (array2[j] == array[0] && array3[j] == array[1]) { DataRow dataRow = this.tblResult.NewRow(); dataRow["R1"] = dataView[i]["R1"]; dataRow["R2"] = dataView[i]["R2"]; dataRow["HL"] = dataView[i]["HL"]; dataRow["R12"] = dataView[i]["R12"]; dataRow["R4"] = dataView[i]["R4"]; dataRow["R5"] = dataView[i]["R5"]; dataRow["F2"] = dataView[i]["F2"]; dataRow["R13"] = dataView[i]["R13"]; dataRow["R11"] = dataView[i]["R11"]; dataRow["C2"] = dataView[i]["C2"].ToString().Replace("|", "、"); dataRow["T2"] = dataView[i]["T2"].ToString().Replace("|", "、"); dataRow["R10"] = dataView[i]["R10"].ToString().Replace("|", "、"); this.tblResult.Rows.Add(dataRow); break; } } } this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_YXCF(); break; } case "ZWFZDX": { string[] array = clsStr.Seperate(strConditions, '|'); dataView.RowFilter = string.Concat(new string[] { "C2 like '%", array[0], "%' and T2 like '%", array[1], "%'" }); this.SetHeaders_ZWFZDX(); for (int i = 0; i < dataView.Count; i++) { bool flag = false; string[] array4 = clsStr.Seperate(dataView[i]["C2"].ToString(), '|'); string[] array5 = clsStr.Seperate(dataView[i]["T2"].ToString(), '|'); for (int j = 0; j < array4.Length; j++) { if (array4[j] == array[0] && array5[j] == array[1]) { flag = true; DataRow dataRow = this.tblResult.NewRow(); dataRow["R1"] = dataView[i]["R1"]; dataRow["R2"] = dataView[i]["R2"]; dataRow["HL"] = dataView[i]["HL"]; dataRow["R12"] = dataView[i]["R12"]; dataRow["R80"] = dataView[i]["R80"]; dataRow["R90"] = dataView[i]["R90"]; dataRow["R4"] = dataView[i]["R4"]; dataRow["R5"] = dataView[i]["R5"]; dataRow["F2"] = dataView[i]["F2"]; dataRow["R13"] = dataView[i]["R13"]; dataRow["R11"] = dataView[i]["R11"]; dataRow["C2"] = dataView[i]["C2"].ToString().Replace("|", "、"); dataRow["T2"] = dataView[i]["T2"].ToString().Replace("|", "、"); dataRow["R10"] = dataView[i]["R10"].ToString().Replace("|", "、"); this.tblResult.Rows.Add(dataRow); } if (flag) { break; } } } this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_ZWFXDX(); break; } case "YXCF2JX": { string[] array = clsStr.Seperate(strConditions, '|'); dataView.RowFilter = string.Concat(new string[] { "E2 like '%", array[0], "%' and E3 like '%", array[1], "%' ", (array[2] == "") ? "" : (" and R13='" + array[2] + "'"), " and ", array[3] }); this.SetHeaders_JX(); for (int i = 0; i < dataView.Count; i++) { DataRow dataRow = this.tblResult.NewRow(); dataRow["R1"] = dataView[i]["R1"]; dataRow["R2"] = dataView[i]["R2"]; dataRow["HL"] = dataView[i]["HL"]; dataRow["R12"] = dataView[i]["R12"]; dataRow["R80"] = dataView[i]["R80"]; dataRow["R90"] = dataView[i]["R90"]; dataRow["R4"] = dataView[i]["R4"]; dataRow["R5"] = dataView[i]["R5"]; dataRow["F2"] = dataView[i]["F2"]; dataRow["R13"] = dataView[i]["R13"]; dataRow["R11"] = dataView[i]["R11"]; dataRow["C2"] = dataView[i]["C2"].ToString().Replace("|", "、"); dataRow["T2"] = dataView[i]["T2"].ToString().Replace("|", "、"); dataRow["R10"] = dataView[i]["R10"].ToString().Replace("|", "、"); this.tblResult.Rows.Add(dataRow); } this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_JX(); break; } case "YXCF2ZWFXDX": { string[] array = clsStr.Seperate(strConditions, '|'); dataView.RowFilter = string.Concat(new string[] { "C2 like '%", array[0], "%' and T2 like '%", array[1], "%' and ", array[2] }); this.SetHeaders_ZWFZDX(); for (int i = 0; i < dataView.Count; i++) { bool flag = false; string[] array4 = clsStr.Seperate(dataView[i]["C2"].ToString(), '|'); string[] array5 = clsStr.Seperate(dataView[i]["T2"].ToString(), '|'); for (int j = 0; j < array4.Length; j++) { if (array4[j] == array[0] && array5[j] == array[1]) { flag = true; DataRow dataRow = this.tblResult.NewRow(); dataRow["R1"] = dataView[i]["R1"]; dataRow["R2"] = dataView[i]["R2"]; dataRow["HL"] = dataView[i]["HL"]; dataRow["R12"] = dataView[i]["R12"]; dataRow["R80"] = dataView[i]["R80"]; dataRow["R90"] = dataView[i]["R90"]; dataRow["R4"] = dataView[i]["R4"]; dataRow["R5"] = dataView[i]["R5"]; dataRow["F2"] = dataView[i]["F2"]; dataRow["R13"] = dataView[i]["R13"]; dataRow["R11"] = dataView[i]["R11"]; dataRow["C2"] = dataView[i]["C2"].ToString().Replace("|", "、"); dataRow["T2"] = dataView[i]["T2"].ToString().Replace("|", "、"); dataRow["R10"] = dataView[i]["R10"].ToString().Replace("|", "、"); this.tblResult.Rows.Add(dataRow); } if (flag) { break; } } } this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_ZWFXDX(); break; } case "QYCPTJ": { this.SetHeaders_QYCPTJ(); DataRow[] array6 = MDIParent.dsP.Tables["P"].Select("", "F2"); DataRow[] array7 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); int second = DateTime.Now.Second; string text = second.ToString(); int num; if (text.Length > 1) { num = (int)Convert.ToInt16(text.Substring(text.Length - 1)); } else { num = (int)Convert.ToInt16(text); } int k = 0; for (int i = 0; i < array7.Length; i++) { while (k < array6.Length) { if (!(array7[i]["F2"].ToString() == array6[k]["F2"].ToString())) { break; } DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array6[k]["R1"]; dataRow["R2"] = array6[k]["R2"]; dataRow["HL"] = array6[k]["HL"]; dataRow["R12"] = array6[k]["R12"]; dataRow["R80"] = array6[k]["R80"]; dataRow["R90"] = array6[k]["R90"]; dataRow["R4"] = array6[k]["R4"]; dataRow["R5"] = array6[k]["R5"]; dataRow["F2"] = array7[i]["F2"]; dataRow["F9"] = array7[i]["F9"]; dataRow["F14"] = array7[i]["F14"]; dataRow["R11"] = array6[k]["R11"]; dataRow["R13"] = array6[k]["R13"]; dataRow["F8"] = array7[i]["F8"]; int num2 = (int)Convert.ToInt16(dataRow["R1"].ToString().Trim().Substring(dataRow["R1"].ToString().Trim().Length - 1)); if (num2 < num) { dataRow["XH"] = num2 - num + 10; } else { dataRow["XH"] = num2 - num; } if (dataRow["JS"].ToString().Trim() != "") { dataTable.Rows.Add(dataRow); } k++; } if (k == array6.Length) { break; } } this.tblResult = dataTable.Copy(); this.tblResult.DefaultView.Sort = "R5 desc"; this.grv.DataSource = this.tblResult.DefaultView; this.SetStyle_QYCPTJ(); break; } } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; int num = 0; string text2 = ""; string text3 = ""; string[] array = clsStr.Seperate(this.txtDJZW.Text, ' '); string text4 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { num++; if (text4 == "") { text4 = "C2 like '%" + array[i] + "%'"; text2 = array[i]; } else { if (this.cboAndOr.Text == "且") { text4 = text4 + " and C2 like '%" + array[i] + "%'"; } else { text4 = text4 + " or C2 like '%" + array[i] + "%'"; } text2 = text2 + ' ' + array[i]; } } } string[] array2 = clsStr.Seperate(text2, ' '); if (text4 != "") { if (text == "") { text = "(" + text4 + ")"; } else { text = text + " and (" + text4 + ")"; } } array = clsStr.Seperate(this.txtFZDX.Text, ' '); text4 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text4 == "") { text4 = "T2 like '%" + array[i] + "%'"; text3 = array[i]; } else { if (num >= 2) { MessageBox.Show(this, "登记作物与防治对象不能同时填多个!", "提示"); this.Cursor = Cursors.Default; return; } if (this.cboAndOr1.Text == "且") { text4 = text4 + " and T2 like '%" + array[i] + "%'"; } else { text4 = text4 + " or T2 like '%" + array[i] + "%'"; } text3 = text3 + ' ' + array[i]; } } } string[] array3 = clsStr.Seperate(text3, ' '); if (text4 != "") { if (text == "") { text = "(" + text4 + ")"; } else { text = text + " and (" + text4 + ")"; } } if (this.cboNYLB.Text.Trim() != "") { if (text == "") { text = "R12 = '" + this.cboNYLB.Text.Trim() + "'"; } else { text = text + " and R12 = '" + this.cboNYLB.Text.Trim() + "'"; } } if (this.radHJ.Checked) { if (text == "") { text = "E2 like '%、%'"; } else { text += " and E2 like '%、%'"; } } else { if (this.radDJ.Checked) { if (text == "") { text = "E2 not like '%、%'"; } else { text += " and E2 not like '%、%'"; } } } if (this.radYY.Checked) { if (text == "") { text = "(R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } else { text += " and (R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } } else { if (!this.radAll.Checked) { if (text == "") { text = "(R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } else { text += " and (R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } } } if (this.txtNF.Text.Trim() != "") { if (text == "") { text = "R1 like '%" + this.txtNF.Text.Trim() + "%'"; } else { text = text + " and R1 like '%" + this.txtNF.Text.Trim() + "%'"; } } if (this.cboZWLB.Text.Trim() != "") { if (text == "") { text = "CT like '%" + this.cboZWLB.Text.Trim() + "%'"; } else { text = text + " and CT like '%" + this.cboZWLB.Text.Trim() + "%'"; } } if (this.cboFZDXLB.Text.Trim() != "") { if (text == "") { text = "TT like '%" + this.cboFZDXLB.Text.Trim() + "%'"; } else { text = text + " and TT like '%" + this.cboFZDXLB.Text.Trim() + "%'"; } } DataRow[] array4 = MDIParent.dsP.Tables["P"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array4.Length; i++) { bool flag; if (this.cboZWLB.Text.Trim() != "") { string[] array5 = clsStr.Seperate(array4[i]["CT"].ToString(), '|'); flag = false; for (int j = 0; j < array5.Length; j++) { if (array5[j] == this.cboZWLB.Text.Trim()) { flag = true; break; } } } else { flag = true; } bool flag2; if (this.cboFZDXLB.Text.Trim() != "") { string[] array6 = clsStr.Seperate(array4[i]["TT"].ToString(), '|'); flag2 = false; for (int j = 0; j < array6.Length; j++) { if (array6[j] == this.cboFZDXLB.Text.Trim()) { flag2 = true; break; } } } else { flag2 = true; } bool flag3; if (this.txtDJZW.Text.Trim() != "" && this.txtFZDX.Text.Trim() != "") { string[] array7 = clsStr.Seperate(array4[i]["C2"].ToString(), '|'); string[] array8 = clsStr.Seperate(array4[i]["T2"].ToString(), '|'); flag3 = false; if (array2.Length > 1) { if (this.cboAndOr.Text == "且") { int num2 = 0; for (int j = 0; j < array8.Length; j++) { if (array8[j].IndexOf(this.txtFZDX.Text.Trim()) >= 0) { for (int k = 0; k < array2.Length; k++) { if (array7[j].IndexOf(array2[k]) >= 0) { num2++; break; } } if (num2 == array2.Length) { flag3 = true; break; } } } } else { for (int j = 0; j < array8.Length; j++) { if (array8[j].IndexOf(this.txtFZDX.Text.Trim()) >= 0) { for (int k = 0; k < array2.Length; k++) { if (array7[j].IndexOf(array2[k]) >= 0) { flag3 = true; break; } } if (flag3) { break; } } } } } else { if (array3.Length > 1) { if (this.cboAndOr1.Text == "且") { int num3 = 0; for (int j = 0; j < array7.Length; j++) { if (array7[j].IndexOf(this.txtDJZW.Text.Trim()) >= 0) { for (int k = 0; k < array3.Length; k++) { if (array8[j].IndexOf(array3[k]) >= 0) { num3++; break; } } if (num3 == array3.Length) { flag3 = true; break; } } } } else { for (int j = 0; j < array7.Length; j++) { if (array7[j].IndexOf(this.txtDJZW.Text.Trim()) >= 0) { for (int k = 0; k < array3.Length; k++) { if (array8[j].IndexOf(array3[k]) >= 0) { flag3 = true; break; } } if (flag3) { break; } } } } } else { for (int j = 0; j < array7.Length; j++) { if (array7[j].IndexOf(this.txtDJZW.Text.Trim()) >= 0 && array8[j].IndexOf(this.txtFZDX.Text.Trim()) >= 0) { flag3 = true; break; } } } } } else { flag3 = true; } if (flag && flag2 && flag3) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array4[i]["R1"]; dataRow["R2"] = array4[i]["R2"]; dataRow["HL"] = array4[i]["HL"]; dataRow["R12"] = array4[i]["R12"]; dataRow["R80"] = array4[i]["R80"]; dataRow["R90"] = array4[i]["R90"]; dataRow["R4"] = array4[i]["R4"]; dataRow["R5"] = array4[i]["R5"]; dataRow["F2"] = array4[i]["F2"]; dataRow["R11"] = array4[i]["R11"]; dataRow["R13"] = array4[i]["R13"]; dataTable.Rows.Add(dataRow); } } DataRow[] array9 = dataTable.Select("", "F2"); DataRow[] array10 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable2 = new DataTable(); dataTable2 = this.tblResult.Clone(); int l = 0; for (int i = 0; i < array9.Length; i++) { while (l < array10.Length) { if (array9[i]["F2"].ToString() == array10[l]["F2"].ToString()) { if (this.txtNF.Text.Trim() == "" || array9[i]["R1"].ToString().IndexOf(this.txtNF.Text.Trim()) == 2) { DataRow dataRow = dataTable2.NewRow(); dataRow["R1"] = array9[i]["R1"]; dataRow["R2"] = array9[i]["R2"]; dataRow["HL"] = array9[i]["HL"]; dataRow["R12"] = array9[i]["R12"]; dataRow["R80"] = array9[i]["R80"]; dataRow["R90"] = array9[i]["R90"]; dataRow["R4"] = array9[i]["R4"]; dataRow["R5"] = array9[i]["R5"]; dataRow["F2"] = array10[l]["F2"]; dataRow["F9"] = array10[l]["F9"]; dataRow["F14"] = array10[l]["F14"]; dataRow["R11"] = array9[i]["R11"]; dataRow["R13"] = array9[i]["R13"]; dataRow["F8"] = array10[l]["F8"]; dataTable2.Rows.Add(dataRow); } break; } l++; } } this.tblResult = dataTable2.Copy(); DataView dataView = new DataView(this.tblResult); dataView.Sort = "R5 desc"; this.gridControl1.DataSource = dataView; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该产品已被吊销、禁止发布等;\r\n3、不存在该产品;\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDJZW.Focus(); return; } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = string.Concat(new string[] { "(E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } else { if (this.cboAndOr.Text == "且") { string text3 = text2; text2 = string.Concat(new string[] { text3, " and (E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } else { string text3 = text2; text2 = string.Concat(new string[] { text3, " or (E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%')" }); } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.txtJX.Text.Trim() != "") { if (text == "") { text = "R13 like '%" + this.txtJX.Text.Trim() + "%'"; } else { text = text + " and R13 like '%" + this.txtJX.Text.Trim() + "%'"; } } if (this.radHJ.Checked) { if (text == "") { text = "E2 like '%、%'"; } else { text += " and E2 like '%、%'"; } } else { if (this.radDJ.Checked) { if (text == "") { text = "E2 not like '%、%'"; } else { text += " and E2 not like '%、%'"; } } } if (this.radYY.Checked) { if (text == "") { text = "(R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } else { text += " and (R13 like '%原药%' or R13 like '%原粉%' or R13 like '%母液%' or R13 like '%母药%' or R13 like '%母粉%')"; } } else { if (!this.radAll.Checked) { if (text == "") { text = "(R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } else { text += " and (R13 not like '%原药%' and R13 not like '%原粉%' and R13 not like '%母液%' and R13 not like '%母药%' and R13 not like '%母粉%')"; } } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { string[] array3 = clsStr.Seperate(array2[i]["E2"].ToString(), '、'); string[] array4 = clsStr.Seperate(array2[i]["E3"].ToString(), '、'); string[] array5 = clsStr.Seperate(array2[i]["E4"].ToString(), '、'); string[] array6 = clsStr.Seperate(array2[i]["E5"].ToString(), '、'); for (int j = 0; j < array4.Length; j++) { bool flag = false; if (this.txtYXCF.Text.Trim() != "") { for (int k = 0; k < array.Length; k++) { if (!(array[k].ToString() == "")) { if (array4[j].IndexOf(array[k]) >= 0 || array3[j].IndexOf(array[k]) >= 0 || array6[j].IndexOf(array[k]) >= 0 || array5[j].IndexOf(array[k]) >= 0) { flag = true; break; } flag = false; } } } else { flag = true; } if (flag) { DataRow dataRow = dataTable.NewRow(); dataRow["E2"] = array3[j]; dataRow["E3"] = array4[j]; dataRow["R13"] = array2[i]["R13"]; dataTable.Rows.Add(dataRow); } } } DataRow[] array7 = dataTable.Select("E2<>''", "E2,E3,R13"); DataTable dataTable2 = new DataTable(); dataTable2 = this.tblResult.Clone(); string b = "***"; string b2 = "***"; string b3 = "***"; for (int i = 0; i < array7.Length; i++) { if (array7[i]["E2"].ToString() != b || array7[i]["E3"].ToString() != b2 || array7[i]["R13"].ToString() != b3) { DataRow dataRow = dataTable2.NewRow(); dataRow["E2"] = array7[i]["E2"]; dataRow["E3"] = array7[i]["E3"]; dataRow["R13"] = array7[i]["R13"]; b = array7[i]["E2"].ToString(); b2 = array7[i]["E3"].ToString(); b3 = array7[i]["R13"].ToString(); dataTable2.Rows.Add(dataRow); } } this.tblResult = dataTable2.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); clsMe clsMe = new clsMe(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtDJZH.Text, ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } array = clsStr.Seperate(this.txtDJMC.Text, ' '); text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { array[i] = array[i].Replace("%", "[%]"); if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.cboNYLB.Text.Trim() != "") { if (text == "") { text = "R12 = '" + this.cboNYLB.Text.Trim() + "'"; } else { text = text + " and R12 = '" + this.cboNYLB.Text.Trim() + "'"; } } if (this.txtJX.Text.Trim() != "") { if (text == "") { text = "R13 like '%" + this.txtJX.Text.Trim() + "%'"; } else { text = text + " and R13 like '%" + this.txtJX.Text.Trim() + "%'"; } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text, "F2"); DataRow[] array3 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); int j = 0; string text3 = DateTime.Now.Second.ToString(); if (text3.Length > 1) { int num = (int)Convert.ToInt16(text3.Substring(text3.Length - 1)); } else { int num = (int)Convert.ToInt16(text3); } string b = "***"; for (int i = 0; i < array3.Length; i++) { while (j < array2.Length) { if (!(array3[i]["F2"].ToString() == array2[j]["F2"].ToString())) { break; } if (array3[i]["F2"].ToString() != b) { DataRow dataRow = dataTable.NewRow(); dataRow["F2"] = array3[i]["F2"]; dataRow["F3"] = array3[i]["F3"]; dataRow["F4"] = array3[i]["F4"]; dataRow["F5"] = array3[i]["F5"]; dataRow["F6"] = array3[i]["F6"]; dataRow["F7"] = array3[i]["F7"]; dataRow["F8"] = array3[i]["F8"]; dataRow["F9"] = array3[i]["F9"]; dataRow["F10"] = array3[i]["F10"]; dataRow["F11"] = array3[i]["F11"]; dataRow["F12"] = array3[i]["F12"]; dataRow["F14"] = array3[i]["F14"]; dataTable.Rows.Add(dataRow); b = array3[i]["F2"].ToString(); } j++; } if (j == array2.Length) { break; } } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该厂家或已更改名称;\r\n3、不存在该厂家;\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDJZH.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtDJZW.Text, ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "C2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or C2 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.cboFZDXLB.Text.Trim() != "") { if (text == "") { text = "TT like '%" + this.cboFZDXLB.Text.Trim() + "%'"; } else { text = text + " and TT like '%" + this.cboFZDXLB.Text.Trim() + "%'"; } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); try { for (int i = 0; i < array2.Length; i++) { string[] array3 = clsStr.Seperate(array2[i]["C2"].ToString(), '|'); string[] array4 = clsStr.Seperate(array2[i]["T2"].ToString(), '|'); string[] array5 = clsStr.Seperate(array2[i]["TT"].ToString(), '|'); for (int j = 0; j < array3.Length; j++) { bool flag = false; if (this.cboFZDXLB.Text.Trim() != "") { if (array5[j].ToString() == this.cboFZDXLB.Text.Trim()) { for (int k = 0; k < array.Length; k++) { if (this.txtDJZW.Text.Trim() == "") { flag = true; break; } if (!(array[k].ToString() == "")) { if (array3[j].IndexOf(array[k]) >= 0) { flag = true; break; } } } } } else { for (int k = 0; k < array.Length; k++) { if (this.txtDJZW.Text.Trim() == "") { flag = true; break; } if (!(array[k].ToString() == "")) { if (array3[j].IndexOf(array[k]) >= 0) { flag = true; break; } } } } if (flag) { DataRow dataRow = dataTable.NewRow(); dataRow["C2"] = array3[j]; dataRow["T2"] = array4[j]; dataTable.Rows.Add(dataRow); } } } } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } DataRow[] array6 = dataTable.Select("C2<>'' AND T2<>''", "C2,T2"); DataTable dataTable2 = new DataTable(); dataTable2 = this.tblResult.Clone(); string b = "***"; string b2 = "***"; for (int i = 0; i < array6.Length; i++) { if (array6[i]["C2"].ToString() != b || array6[i]["T2"].ToString() != b2) { DataRow dataRow = dataTable2.NewRow(); dataRow["C2"] = array6[i]["C2"]; dataRow["T2"] = array6[i]["T2"]; b = array6[i]["C2"].ToString(); b2 = array6[i]["T2"].ToString(); dataTable2.Rows.Add(dataRow); } } this.tblResult = dataTable2.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDJZW.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = string.Concat(new string[] { "E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%'" }); } else { string text3 = text2; text2 = string.Concat(new string[] { text3, " or E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%'" }); } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.cboZGDX.Text.Trim() != "") { if (text == "") { text = "E23='" + this.cboZGDX.Text.Trim() + "'"; } else { text = text + " and E23='" + this.cboZGDX.Text.Trim() + "'"; } } if (this.cboGWDX.Text.Trim() != "") { if (text == "") { text = "E24='" + this.cboGWDX.Text.Trim() + "'"; } else { text = text + " and E24='" + this.cboGWDX.Text.Trim() + "'"; } } DataRow[] array2 = MDIParent.dsAED.Tables["AED"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["E2"] = array2[i]["E2"]; dataRow["E3"] = array2[i]["E3"]; dataRow["E13"] = array2[i]["E13"]; dataRow["E14"] = array2[i]["E14"]; dataRow["E25"] = array2[i]["E25"]; dataRow["E26"] = array2[i]["E26"]; dataRow["E27"] = array2[i]["E27"]; dataRow["E28"] = array2[i]["E28"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; if (this.txtDWMC.Text.Trim() != "") { if (text == "") { text = "F2 like '%" + this.txtDWMC.Text.Trim() + "%'"; } else { text = text + " and F2 like '%" + this.txtDWMC.Text.Trim() + "%'"; } } string[] array = clsStr.Seperate(this.txtDJZH.Text, ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } array = clsStr.Seperate(this.txtDJMC.Text, ' '); text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { array[i] = array[i].Replace("%", "[%]"); if (text2 == "") { text2 = string.Concat(new string[] { "R2 like '%", array[i], "%' or R3 like '%", array[i], "%'" }); } else { string text3 = text2; text2 = string.Concat(new string[] { text3, " or R2 like '%", array[i], "%'or R3 like '%", array[i], "%'" }); } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } string text4 = this.cboGQSJ.Text.Trim(); if (text4 != null) { if (!(text4 == "半年内")) { if (!(text4 == "半年到一年间")) { if (!(text4 == "一年到两年间")) { if (text4 == "过期") { if (text == "") { text = "R5<='" + clsStr.Format(this.dtpJZRQ.Text.Trim(), '-') + "'"; } else { text = text + " and R5<='" + clsStr.Format(this.dtpJZRQ.Text.Trim(), '-') + "'"; } } } else { if (text == "") { text = string.Concat(new string[] { "R5<'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddYears(-1).ToString(), '-'), "' and R5>'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddYears(-2).ToString(), '-'), "'" }); } else { string text3 = text; text = string.Concat(new string[] { text3, " and R5<'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddYears(-1).ToString(), '-'), "'and R5>'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddYears(-2).ToString(), '-'), "'" }); } } } else { if (text == "") { text = string.Concat(new string[] { "R5<'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddMonths(-6).ToString(), '-'), "' and R5>'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddYears(-1).ToString(), '-'), "'" }); } else { string text3 = text; text = string.Concat(new string[] { text3, " and R5<'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddMonths(-6).ToString(), '-'), "'and R5>'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddYears(-1).ToString(), '-'), "'" }); } } } else { if (text == "") { text = string.Concat(new string[] { "R5<'", clsStr.Format(this.dtpJZRQ.Text.Trim(), '-'), "' and R5>'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddMonths(-6).ToString(), '-'), "'" }); } else { string text3 = text; text = string.Concat(new string[] { text3, " and R5<'", clsStr.Format(this.dtpJZRQ.Text.Trim(), '-'), "'and R5>'", clsStr.Format(Convert.ToDateTime(this.dtpJZRQ.Text.Trim()).AddMonths(-6).ToString(), '-'), "'" }); } } } if (text == "") { text = "R1 not like 'SY%'"; } else { text += " and R1 not like 'SY%'"; } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text, "F2"); DataRow[] array3 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); int j = 0; for (int i = 0; i < array2.Length; i++) { while (j < array3.Length) { if (array2[i]["F2"].ToString() == array3[j]["F2"].ToString()) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array2[i]["R1"]; dataRow["R2"] = array2[i]["R2"]; dataRow["HL"] = array2[i]["HL"]; dataRow["R12"] = array2[i]["R12"]; dataRow["R80"] = array2[i]["R80"]; dataRow["R90"] = array2[i]["R90"]; dataRow["R4"] = array2[i]["R4"]; dataRow["R5"] = array2[i]["R5"]; dataRow["F2"] = array2[i]["F2"]; dataRow["F9"] = array3[j]["F9"]; dataRow["F14"] = array3[j]["F14"]; dataRow["R11"] = array2[i]["R11"]; dataRow["R13"] = array2[i]["R13"]; dataRow["F8"] = array3[j]["F8"]; dataTable.Rows.Add(dataRow); break; } j++; } } this.tblResult = dataTable.Copy(); DataView dataView = new DataView(this.tblResult); dataView.Sort = "R5 desc"; this.gridControl1.DataSource = dataView; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该产品已被吊销、禁止发布等;\r\n3、不存在该产品;\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDWMC.Focus(); } }
public DataView FilterNY(DataView dvTblResult) { clsStr clsStr = new clsStr(); if (MDIParent.strKeyWord != "") { string text = ""; string[] array = clsStr.Seperate(MDIParent.strKeyWord, ' '); if (MDIParent.strFilterField == "") { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R1 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " or HL like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " and HL like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R13 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R13 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or F2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and F2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R4 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R4 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R5 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R5 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R11 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R11 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R12 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R12 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } } else { string[] array2 = clsStr.Seperate(MDIParent.strFilterField, '|'); for (int j = 0; j < array2.Length; j++) { string text3 = array2[j]; switch (text3) { case "R1": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R1 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R2": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "HL": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " or HL like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "HL like '%" + array[i] + "%'"; } else { text2 = text2 + " and HL like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R12": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R12 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R12 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R12 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "F2": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or F2 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "F2 like '%" + array[i] + "%'"; } else { text2 = text2 + " and F2 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R4": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R4 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R4 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R4 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R5": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R5 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R5 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R5 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R13": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R13 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R13 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R13 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } case "R11": { string text2 = ""; if (MDIParent.strAndOr == "or") { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R11 like '%" + array[i] + "%'"; } } } } else { for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R11 like '%" + array[i] + "%'"; } else { text2 = text2 + " and R11 like '%" + array[i] + "%'"; } } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " or (" + text2 + ")"; } } break; } } } } dvTblResult.RowFilter = text; dvTblResult.Sort = ""; } return dvTblResult; }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); if (this.txtLSDJZH.Text.Trim() != "" && this.txtZSDJZH.Text.Trim() != "") { MessageBox.Show(this, "临时登记证号与正式登记证号不能都填!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtLSDJZH.Focus(); } else { this.Cursor = Cursors.WaitCursor; string text = ""; string text2 = "LS is not null"; string[] array = clsStr.Seperate(this.txtLSDJZH.Text, ' '); for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "LS like '%" + array[i] + "%'"; } else { text2 = text2 + " and LS like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } array = clsStr.Seperate(this.txtZSDJZH.Text, ' '); text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.txtQYMC.Text.Trim() != "") { if (text == "") { text = "F2 like '%" + this.txtQYMC.Text.Trim() + "%'"; } else { text = text + " and F2 like '%" + this.txtQYMC.Text.Trim() + "%'"; } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text, "F2"); DataRow[] array3 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); int j = 0; for (int i = 0; i < array2.Length; i++) { while (j < array3.Length) { if (array2[i]["F2"].ToString() == array3[j]["F2"].ToString()) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array2[i]["R1"]; dataRow["LS"] = array2[i]["LS"]; dataRow["R2"] = array2[i]["R2"]; dataRow["HL"] = array2[i]["HL"]; dataRow["R12"] = array2[i]["R12"]; dataRow["R4"] = array2[i]["R4"]; dataRow["R5"] = array2[i]["R5"]; dataRow["F2"] = array2[i]["F2"]; dataRow["F9"] = array3[j]["F9"]; dataRow["F14"] = array3[j]["F14"]; dataRow["R11"] = array2[i]["R11"]; dataRow["R13"] = array2[i]["R13"]; dataTable.Rows.Add(dataRow); break; } j++; } } this.tblResult = dataTable.Copy(); DataView dataView = new DataView(this.tblResult); dataView.Sort = "R5 desc"; this.gridControl1.DataSource = dataView; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该产品已被吊销、禁止发布等;\r\n3、不存在该产品;\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtLSDJZH.Focus(); } } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtDJZH.Text, ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } array = clsStr.Seperate(this.txtDJMC.Text, ' '); text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { array[i] = array[i].Replace("%", "[%]"); if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.txtDWMC.Text.Trim() != "") { if (text == "") { text = "F2 like'%" + this.txtDWMC.Text.Trim() + "%'"; } else { text = text + " and F2 like'%" + this.txtDWMC.Text.Trim() + "%'"; } } DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text, "F2"); for (int i = 0; i < array2.Length; i++) { DataRow[] array3 = MDIParent.dsBQ.Tables["bq"].Select("R1='" + array2[i]["R1"].ToString() + "'"); if (array3.Length == 1) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array3[0]["R1"]; dataRow["R2"] = array2[i]["R2"]; dataRow["F2"] = array2[i]["F2"]; dataTable.Rows.Add(dataRow); } } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该产品已被吊销、禁止发布等;\r\n3、不存在该产品;\r\n请您输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDJZH.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = string.Concat(new string[] { "E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%'" }); } else { string text3 = text2; text2 = string.Concat(new string[] { text3, " or E2 like '%", array[i], "%' or E3 like '%", array[i], "%' or E4 like '%", array[i], "%' or E5 like '%", array[i], "%'" }); } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.txtCADJH.Text.Trim() != "") { if (text == "") { text = "E8 like '%" + this.txtCADJH.Text.Trim() + "%'"; } else { text = text + " and E8 like '%" + this.txtCADJH.Text.Trim() + "%'"; } } if (this.cboHXLB.Text.Trim() != "") { if (text == "") { text = "E30 = '" + this.cboHXLB.Text.Trim() + "'"; } else { text = text + " and E30 = '" + this.cboHXLB.Text.Trim() + "'"; } } if (this.cboZYFS.Text.Trim() != "") { if (text == "") { text = "E11 like '%" + this.cboZYFS.Text.Trim() + "%'"; } else { text = text + " and E11 like '%" + this.cboZYFS.Text.Trim() + "%'"; } } if (this.cboNYLB.Text.Trim() != "") { if (text == "") { text = "E29 = '" + this.cboNYLB.Text.Trim() + "'"; } else { text = text + " and E29 = '" + this.cboNYLB.Text.Trim() + "'"; } } if (this.cboFXFF.Text.Trim() != "") { if (text == "") { text = "E10 like '%" + this.cboFXFF.Text.Trim() + "%'"; } else { text = text + " and E10 like '%" + this.cboFXFF.Text.Trim() + "%'"; } } DataRow[] array2 = MDIParent.dsAED.Tables["AED"].Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["E2"] = array2[i]["E2"]; dataRow["E3"] = array2[i]["E3"]; dataRow["E4"] = array2[i]["E4"]; dataRow["E5"] = array2[i]["E5"]; dataRow["E8"] = array2[i]["E8"]; dataRow["E29"] = array2[i]["E29"]; dataRow["E11"] = array2[i]["E11"]; dataRow["E30"] = array2[i]["E30"]; dataRow["E13"] = array2[i]["E13"]; dataRow["E14"] = array2[i]["E14"]; dataRow["E10"] = array2[i]["E10"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); clsMe clsMe = new clsMe(); if (!this.radAll.Checked && this.cboDJSQ.Text.Trim() == "") { MessageBox.Show(this, "查找范围不是全部时,登记日期不能空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.cboDJSQ.Focus(); } else { this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtDJZH.Text, ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "R1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } array = clsStr.Seperate(this.txtDJMC.Text, ' '); text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { array[i] = array[i].Replace("%", "[%]"); if (text2 == "") { text2 = "R2 like '%" + array[i] + "%'"; } else { text2 = text2 + " or R2 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } text2 = ""; Calendar calendar = CultureInfo.InvariantCulture.Calendar; string text3 = this.cboDJSQ.Text.Trim(); if (text3 != null) { if (!(text3 == "本周")) { if (!(text3 == "上一周")) { if (!(text3 == "本月")) { if (!(text3 == "上一月")) { if (!(text3 == "本年")) { if (text3 == "上一年") { text2 = "R4>='" + clsStr.Format((Convert.ToInt32(calendar.GetYear(DateTime.Now.Date)) - 1).ToString() + "-01-01", '-') + "'"; text2 = text2 + " and R4<'" + clsStr.Format(Convert.ToInt32(calendar.GetYear(DateTime.Now.Date)).ToString() + "-01-01", '-') + "'"; } } else { text2 = "R4>='" + clsStr.Format(Convert.ToInt32(calendar.GetYear(DateTime.Now.Date)).ToString() + "-01-01", '-') + "'"; text2 = text2 + " and R4<='" + clsStr.Format(DateTime.Now.Date.ToString(), '-') + "'"; } } else { text2 = "R4>='" + clsStr.Format(DateTime.Now.Date.AddMonths(-1).ToString("yyyy-MM-dd").Substring(0, 8) + "01", '-') + "'"; text2 = text2 + " and R4<'" + clsStr.Format(DateTime.Now.Date.ToString("yyyy-MM-dd").Substring(0, 8) + "01", '-') + "'"; } } else { text2 = "R4>='" + clsStr.Format(DateTime.Now.Date.ToString("yyyy-MM-dd").Substring(0, 8) + "01", '-') + "'"; text2 = text2 + " and R4<='" + clsStr.Format(DateTime.Now.Date.ToString(), '-') + "'"; } } else { text2 = "R4 >'" + clsStr.Format(DateTime.Now.Date.AddDays((double)(-(double)this.ConvertNumWeek(calendar.GetDayOfWeek(DateTime.Now.Date).ToString()) - 7)).ToString(), '-') + "'"; text2 = text2 + " and R4 <'" + clsStr.Format(DateTime.Now.Date.AddDays((double)(-(double)this.ConvertNumWeek(calendar.GetDayOfWeek(DateTime.Now.Date).ToString()) + 1)).ToString(), '-') + "'"; } } else { text2 = "R4 >'" + clsStr.Format(DateTime.Now.Date.AddDays((double)(-(double)this.ConvertNumWeek(calendar.GetDayOfWeek(DateTime.Now.Date).ToString()))).ToString(), '-') + "'"; text2 = text2 + " and R4<='" + clsStr.Format(DateTime.Now.Date.ToString(), '-') + "'"; } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } if (this.cboNYLB.Text.Trim() != "") { if (text == "") { text = "R12 = '" + this.cboNYLB.Text.Trim() + "'"; } else { text = text + " and R12 = '" + this.cboNYLB.Text.Trim() + "'"; } } if (this.txtJX.Text.Trim() != "") { if (text == "") { text = "R13 like '%" + this.txtJX.Text.Trim() + "%'"; } else { text = text + " and R13 like '%" + this.txtJX.Text.Trim() + "%'"; } } DataRow[] array2 = MDIParent.dsP.Tables["P"].Select(text, "F2"); DataRow[] array3 = MDIParent.dsF.Tables["F"].Select("", "F2"); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); int j = 0; for (int i = 0; i < array3.Length; i++) { while (j < array2.Length) { if (!(array3[i]["F2"].ToString() == array2[j]["F2"].ToString())) { break; } if (this.radAll.Checked) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array2[j]["R1"]; dataRow["R2"] = array2[j]["R2"]; dataRow["HL"] = array2[j]["HL"]; dataRow["R12"] = array2[j]["R12"]; dataRow["R80"] = array2[j]["R80"]; dataRow["R90"] = array2[j]["R90"]; dataRow["R4"] = array2[j]["R4"]; dataRow["R5"] = array2[j]["R5"]; dataRow["F2"] = array3[i]["F2"]; dataRow["F9"] = array3[i]["F9"]; dataRow["F14"] = array3[i]["F14"]; dataRow["R11"] = array2[j]["R11"]; dataRow["R13"] = array2[j]["R13"]; dataRow["F8"] = array3[i]["F8"]; dataTable.Rows.Add(dataRow); } else { if (this.radNewDJ.Checked) { if (array2[j]["R4"].ToString().Trim().Length > 3) { if (array2[j]["R1"].ToString().Substring(2, 4) == array2[j]["R4"].ToString().Substring(0, 4)) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array2[j]["R1"]; dataRow["R2"] = array2[j]["R2"]; dataRow["HL"] = array2[j]["HL"]; dataRow["R12"] = array2[j]["R12"]; dataRow["R80"] = array2[j]["R80"]; dataRow["R90"] = array2[j]["R90"]; dataRow["R4"] = array2[j]["R4"]; dataRow["R5"] = array2[j]["R5"]; dataRow["F2"] = array3[i]["F2"]; dataRow["F9"] = array3[i]["F9"]; dataRow["F14"] = array3[i]["F14"]; dataRow["R11"] = array2[j]["R11"]; dataRow["R13"] = array2[j]["R13"]; dataRow["F8"] = array3[i]["F8"]; dataTable.Rows.Add(dataRow); } } } else { if (this.radNewXZ.Checked) { if (array2[j]["R4"].ToString().Trim().Length > 3) { if (array2[j]["R1"].ToString().Substring(2, 4) != array2[j]["R4"].ToString().Substring(0, 4)) { DataRow dataRow = dataTable.NewRow(); dataRow["R1"] = array2[j]["R1"]; dataRow["R2"] = array2[j]["R2"]; dataRow["HL"] = array2[j]["HL"]; dataRow["R12"] = array2[j]["R12"]; dataRow["R80"] = array2[j]["R80"]; dataRow["R90"] = array2[j]["R90"]; dataRow["R4"] = array2[j]["R4"]; dataRow["R5"] = array2[j]["R5"]; dataRow["F2"] = array3[i]["F2"]; dataRow["F9"] = array3[i]["F9"]; dataRow["F14"] = array3[i]["F14"]; dataRow["R11"] = array2[j]["R11"]; dataRow["R13"] = array2[j]["R13"]; dataRow["F8"] = array3[i]["F8"]; dataTable.Rows.Add(dataRow); } } } } } j++; } if (j == array2.Length) { break; } } this.tblResult = dataTable.Copy(); DataView dataView = new DataView(this.tblResult); dataView.Sort = "R5 desc"; this.gridControl1.DataSource = dataView; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据,可能由以下原因造成:\r\n1、您输入的条件太多,过于复杂;\r\n2、该产品已被吊销、禁止发布等;\r\n3、不存在该产品;\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDJZH.Focus(); } } }