private void toolStripMenuItem_RowImportFromExcel_Click(object sender, EventArgs e) { DataTable myDataTable = Class_DataControlBind.ImportExcelToDataTable(); if (myDataTable != null) { Form_WelderBelong_ImportFromExcel myForm = new Form_WelderBelong_ImportFromExcel(); myForm.InitDataGridView(this.myEventArgs_Unit.EmployerHPID, this.myEventArgs_Unit.DepartmentHPID, this.myEventArgs_Unit.WorkPlaceHPID, myDataTable); if (myForm.ShowDialog() == DialogResult.OK) { this.dataGridView_Data.DataSource = null; this.myDataView = null; this.myDataTable = null; this.RefreshData(false); } } }
private void toolStripMenuItem_RowAddByExcel_Click(object sender, EventArgs e) { DataTable myDataTable = Class_DataControlBind.ImportExcelToDataTable(); if (myDataTable != null) { if (!myDataTable.Columns.Contains("IdentificationCard")) { MessageBox.Show("数据表中不存在 'IdentificationCard' 列!"); return; } DataRow[] myDataRow_Range; myDataRow_Range = myDataTable.Select("len(IdentificationCard)>0"); StringBuilder myStringBuilder = new StringBuilder(); myStringBuilder.Append("1=0"); foreach (DataRow myDataRow in myDataRow_Range) { myStringBuilder.Append(string.Format(" Or IdentificationCard='{0}'", Class_DataValidateTool.CovertIdentificationCard(myDataRow["IdentificationCard"].ToString()))); } EventArgs_WelderFilter g = new EventArgs_WelderFilter(myStringBuilder.ToString()); Publisher_WelderFilter.OnEventName(g); } }
private void toolStripMenuItem_RowAddByExcel_Click(object sender, EventArgs e) { DataTable myDataTable = Class_DataControlBind.ImportExcelToDataTable(); if (myDataTable != null) { StringBuilder myStringBuilder = new StringBuilder(); if (myDataTable.Columns.Contains("CertificateNo")) { DataRow[] myDataRow_Range; myDataRow_Range = myDataTable.Select("len(CertificateNo)>0"); myStringBuilder.Append("1=0"); foreach (DataRow myDataRow in myDataRow_Range) { myStringBuilder.Append(string.Format(" Or CertificateNo='{0}'", myDataRow["CertificateNo"].ToString())); } } else if (myDataTable.Columns.Contains("ExaminingNo")) { DataRow[] myDataRow_Range; myDataRow_Range = myDataTable.Select("len(ExaminingNo)>0"); myStringBuilder.Append("1=0"); foreach (DataRow myDataRow in myDataRow_Range) { myStringBuilder.Append(string.Format(" Or ExaminingNo='{0}'", myDataRow["ExaminingNo"].ToString())); } } else { MessageBox.Show("数据表中不存在 'CertificateNo'或'ExaminingNo' 列!"); return; } EventArgs_DataManager my_e = new EventArgs_DataManager(this.myEventArgs_DataManager.str_DataManagerText, this.myEventArgs_DataManager.str_DataManagerName, this.myEventArgs_DataManager.str_DataManagerTag); my_e.str_Filter = myStringBuilder.ToString(); Publisher_DataManager.OnEventName(my_e); } }