Esempio n. 1
0
        protected void cmdAdd_ServerClick(object sender, EventArgs e)
        {
            ArrayList importArray = this.gridHelper.GetCheckedRows();

            if (importArray.Count == 0)
            {
                return;
            }

            this.InputType = "WORKPLAN";

            DataTable dt = this.GetImportDT(importArray);


            ImportData.ImportDateEngine importEngine = new BenQGuru.eMES.Web.WarehouseWeb.ImportData.ImportDateEngine(
                base.DataProvider, this.InputType, dt, this.GetUserCode(), importArray);

            this.gridHelper.AddColumn("ImportResult", "导入结果", null, 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>");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                this.Page.Response.Write("<script language=javascript>HideWait();</script>");
            }
            #endregion

            #region 导入数据
            try
            {
                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;
                bool isRollBack = false;
                importEngine.Import(isRollBack);

                this.Page.Response.Write("<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.cmdEnter.Disabled = true;
        }
Esempio n. 2
0
        protected void cmdAdd_ServerClick(object sender, EventArgs e)
        {
            this.XmlHelper.SelectedImportType = InputType;
            cmdQuery_ServerClick(this, e);

            ArrayList importArray = new ArrayList();

            foreach (GridRecord row in this.gridWebGrid.Rows)
            {
                importArray.Add(row);
            }
            if (importArray.Count == 0)
            {
                return;
            }

            DataTable dt = this.GetImportDT(importArray);



            ImportData.ImportDateEngine importEngine = new BenQGuru.eMES.Web.WarehouseWeb.ImportData.ImportDateEngine(
                base.DataProvider, languageComponent1, this.InputType, dt, this.GetUserCode(), importArray);

            importEngine.fromPage = this.Page;

            #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>");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //this.Page.Response.Write("<script language=javascript>HideWait();</script>");
            }
            #endregion

            #region 导入数据
            try
            {
                //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 = false;
                importEngine.Import(isRollBack);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //this.Page.Response.Write("<script language=javascript>HideWait();</script>");
            }
            #endregion

            if (importEngine.ErrorArray != null)
            {
                importEngine.ErrorArray = null;
            }
        }