protected void cmdQuery_ServerClick(object sender, System.EventArgs e) { string fileName = FileLoadProcess.UploadFile2ServerUploadFolder(this.Page, this.DownLoadPathBom, null); if (fileName == null) { ExceptionManager.Raise(this.GetType().BaseType, "$Error_UploadFileIsEmpty"); } string fileName2 = fileName.ToUpper(); if (fileName2.LastIndexOf(".XLS") == -1) { ExceptionManager.Raise(this.GetType().BaseType, "$Error_UploadFileTypeError_XLS"); } this.UploadedFileName = fileName; this.RequestData(); ArrayList importArray = this.GetAllRows(); if (importArray.Count == 0) { return; } DataTable dt = this.GetImportDT(importArray); ImportData.ImportDateEngine importEngine = new BenQGuru.eMES.Web.BaseSetting.ImportData.ImportDateEngine( base.DataProvider, this.InputType, dt, this.GetUserCode(), importArray, this.gridHelper); importEngine.CheckDataValid(); foreach (GridRecord row in gridWebGrid.Rows) { if (!string.IsNullOrEmpty(row.Items.FindItemByKey("ImportResult").Text)) { this.cmdEnter.Disabled = true; this.cmdGridExport.Disabled = false; return; } } this.cmdEnter.Disabled = false; this.cmdGridExport.Disabled = true; }
protected void cmdAdd_ServerClick(object sender, EventArgs e) { //RequestData(); //ArrayList importArray = this.gridHelper.GetCheckedRows(); ArrayList importArray = this.gridHelper.GetCheckedRows();//测试一下 逻辑还是用上面这句 if (importArray.Count == 0) { return; } DataTable dt = this.GetImportDT(importArray); ImportData.ImportDateEngine importEngine = new BenQGuru.eMES.Web.BaseSetting.ImportData.ImportDateEngine( base.DataProvider, this.InputType, dt, this.GetUserCode(), importArray, this.gridHelper); //this.gridHelper.AddColumn("ImportResult","导入结果",150); #region 验证数据有效性 //try //{ // /*added by jessie lee, 2005/11/30, // * 操作时间过长时添加进度条*/ // this.Page.Response.Write("<div id='mydiv' >"); // this.Page.Response.Write("_"); // this.Page.Response.Write("</div>"); // this.Page.Response.Write("<script>mydiv.innerText = '';</script>"); // this.Page.Response.Write("<script language=javascript>;"); // this.Page.Response.Write("var dots = 0;var dotmax = 10;function ShowWait()"); // this.Page.Response.Write("{var output; output = '正在验证导入数据的有效性,请稍后';dots++;if(dots>=dotmax)dots=1;"); // this.Page.Response.Write("for(var x = 0;x < dots;x++){output += '·';}mydiv.innerText = output;}"); // this.Page.Response.Write("function StartShowWait(){mydiv.style.visibility = 'visible'; "); // this.Page.Response.Write("window.setInterval('ShowWait()',1000);}"); // this.Page.Response.Write("function HideWait(){mydiv.style.display = 'none';"); // this.Page.Response.Write("window.clearInterval();}"); // this.Page.Response.Write("StartShowWait();</script>"); // this.Page.Response.Flush(); // //importEngine.CheckDataValid(); // this.Page.Response.Write("<script language=javascript>HideWait();</script>"); // /* // string script1 = // "<div id='mydiv' >_</div>"+ // "<script>mydiv.innerText = '';</script>"+ // "<script language=javascript>;"+ // "var dots = 0;var dotmax = 10;function ShowWait()"+ // "{var output; output = '正在导入数据,请稍后';dots++;if(dots>=dotmax)dots=1;"+ // "for(var x = 0;x < dots;x++){output += '·';}mydiv.innerText = output;}" // +"function StartShowWait(){mydiv.style.visibility = 'visible'; "+ // "window.setInterval('ShowWait()',1000);}"+ // "function HideWait(){mydiv.style.display = 'none';"+ // "window.clearInterval();}"+ // "StartShowWait();</script>"; // this.Page.RegisterStartupScript(Guid.NewGuid().ToString(),script1); // importEngine.CheckDataValid(); // this.Page.RegisterStartupScript(Guid.NewGuid().ToString(),"<script language=javascript>HideWait();</script>"); // */ //} //catch(Exception ex) //{ // throw ex ; //} //finally //{ // this.Page.Response.Write("<script language=javascript>HideWait();</script>"); //} #endregion #region 导入数据 try { /*added by jessie lee, 2005/11/30, * 操作时间过长时添加进度条*/ //this.Page.Response.Write("<div id='mydiv2' >"); //this.Page.Response.Write("_"); //this.Page.Response.Write("</div>"); //this.Page.Response.Write("<script>mydiv2.innerText = '';</script>"); //this.Page.Response.Write("<script language=javascript>;"); //this.Page.Response.Write("var dots = 0;var dotmax = 10;function ShowWait()"); //this.Page.Response.Write("{var output; output = '正在导入数据,请稍后';dots++;if(dots>=dotmax)dots=1;"); //this.Page.Response.Write("for(var x = 0;x < dots;x++){output += '·';}mydiv2.innerText = output;}"); //this.Page.Response.Write("function StartShowWait(){mydiv2.style.visibility = 'visible'; "); //this.Page.Response.Write("window.setInterval('ShowWait()',1000);}"); //this.Page.Response.Write("function HideWait(){mydiv2.style.display = 'none';"); //this.Page.Response.Write("window.clearInterval();}"); //this.Page.Response.Write("StartShowWait();</script>"); //this.Page.Response.Flush(); bool isRollBack = this.ImportList.SelectedValue == "RoolBack" ? true : false; importEngine.Import(isRollBack); //this.Page.Response.Write("<script language=javascript>HideWait();</script>"); /* * string script2 = * "<div id='mydiv2' >_</div>"+ * "<script>mydiv2.innerText = '';</script>"+ * "<script language=javascript>;"+ * "var dots = 0;var dotmax = 10;function ShowWait()"+ * "{var output; output = '正在导入数据,请稍后';dots++;if(dots>=dotmax)dots=1;"+ * "for(var x = 0;x < dots;x++){output += '·';}mydiv2.innerText = output;}" +"function StartShowWait(){mydiv2.style.visibility = 'visible'; "+ * "window.setInterval('ShowWait()',1000);}"+ * "function HideWait(){mydiv2.style.display = 'none';"+ * "window.clearInterval();}"+ * "StartShowWait();</script>"; * this.Page.RegisterStartupScript(Guid.NewGuid().ToString(),script2); * importEngine.Import(); * this.Page.RegisterStartupScript(Guid.NewGuid().ToString(),"<script language=javascript>HideWait();</script>"); */ } catch (Exception ex) { throw ex; } finally { //this.Page.Response.Write("<script language=javascript>HideWait();</script>"); } #endregion if (importEngine.ErrorArray != null) { importEngine.ErrorArray = null; } this.cmdGridExport.Disabled = false; this.cmdEnter.Disabled = true; }