private void ImBtn_Click(object sender, EventArgs e) { if (FilePathTB.Text.Length > 0) { ImExcel excel = new ImExcel(); DataTable dt = excel.LoadExcel(FilePathTB.Text); List <ToolingDataSys.Code.Message> message = null; if (type == FileDataOperateType.Insert) { message = file.Insert(dt); } else if (type == FileDataOperateType.Update) { message = file.Update(dt); } else if (type == FileDataOperateType.Delete) { message = file.Delete(dt); } else if (type == FileDataOperateType.TransPosition) { IMoldFile moldFile = file as IMoldFile; message = moldFile.TransPosition(dt); } if (message != null && message.Count > 0) { new MessageDialog(message).ShowDialog(); } else { MessageBox.Show("导入成功!"); } } }