protected void BtnImport_Click(object sender, EventArgs e) { PageBase page = (PageBase)this.Page; if (UpdFile.PostedFile.FileName != "") { string timeStr = DateTime.Now.ToString("yyyyMMddhhmmss"); string filePath = Request.PhysicalApplicationPath + @"Export\" + "jobstructure"+ timeStr +".xls" ; UpdFile.SaveAs(filePath); string errorMessage; string[] sheetNames = ExcelHelper.GetExcelSheetNames(filePath); DataSet ds = ExcelHelper.GetDataSetFromExcel(filePath, sheetNames[0], out errorMessage); JobStructure job = new JobStructure(); bool b = job.ImportJobStructure(ds, out errorMessage); if (!b) page.Alert(errorMessage); else page.Alert(new RM(ResourceFile.Msg)["SaveSuccess"]); DataView dv = ds.Tables[0].DefaultView; dv.RowFilter = "pOut = 0"; if (dv.Count > 0) { GrdList.DataSource = dv; GrdList.DataBind(); } File.Delete(filePath); } }