private void DtsStart(DtsInfo dts) { // this.lbHint.Text = "共 " + tb.Rows.Count.ToString() + " 条记录,正在导入..."; this.lbHint.Text = "正在导入,请稍候..."; this.btnDtc.Disabled = true; this.btnClear.Disabled = true; this.btnStop.Visible = true; this.tbProgress.Visible = true; int Count = dts.DataSource.Rows.Count; this.txtCount.Value = Count.ToString(); this.tdCount.InnerText = Count.ToString(); this.txtIsContinue.Value = "1"; }
private void DtsFinish() { if (Session["DtsSale"] != null) { this.txtIsContinue.Value = "0"; DtsInfo dts = (DtsInfo)Session["DtsSale"]; Session["DtsSale"] = null; this.lbHint.Text = dts.GetResult(); // ((DtsProgress)this.DtsProgress).Over(); } this.btnDtc.Disabled = false; this.btnClear.Disabled = false; this.tbProgress.Visible = false; this.btnStop.Visible = false; this.txtIsContinue.Value = "0"; }
private void DtsContinue() { string act = "" + Request["act"]; if (act == "") { return; } if (Session["DtsSale"] == null) { return; } string server = Request["server"]; string database = Request["database"]; DtsInfo dts = (DtsInfo)Session["DtsSale"]; string ErrMess = ""; string IsEof = "1"; if (!dts.EOF) { dts.CurrentIndex = dts.CurrentIndex + 1; DataRow dr = dts.DataSource.Rows[dts.CurrentIndex]; string case_id = dr["case_id"].ToString(); string case_name = dr["case_name"].ToString(); try { // BLL.DtsPayRule.DtsPaySingle(server, database, case_id); BLL.DtsPayRule.DtsPaySingleByClient(case_id); /* * if (dts.DataSource.TableName.ToUpper() == "CLIENT") //按客户导入 * { * BLL.DtsPayRule.DtsPaySingleByClient(case_id); * } * else //按合同导入 * { * BLL.DtsPayRule.DtsPaySingleByContract(case_id); * } */ } catch (Exception ex) { ErrMess = "“" + case_name + "”:" + ex.Message; dts.AddErr(ErrMess); } if (!dts.EOF) { IsEof = "0"; } // ((DtsProgress)this.DtsProgress).SetCurrentIndex(dts.CurrentIndex); } //部分字符会引起js出错,替换掉 ErrMess = ErrMess.Replace("'", " "); ErrMess = ErrMess.Replace("\n", " "); string script = "<script language='javascript'>\n" + string.Format("window.parent.DtsExecReturn('{0}', '{1}', {2}, {3});\n", ErrMess, IsEof, dts.CurrentIndex, dts.ErrCount) + "</script>\n"; Page.RegisterStartupScript("DtsExecReturn", script); }
protected void btnDtc_ServerClick(object sender, System.EventArgs e) { ClearAll(); // string server = System.Configuration.ConfigurationSettings.AppSettings["SaleServerName"]; // string database = System.Configuration.ConfigurationSettings.AppSettings["SaleDatabaseName"]; // // this.txtServer.Value = server; // this.txtDatabase.Value = database; // DataTable tb = BLL.DtsPayRule.GetDtsPay(server, database); string ProjectCode = this.sltProject.Value.Trim(); string ClientName = this.txtClientName.Value.Trim(); DataTable tb; if (ClientName != "") //按客户 { tb = BLL.DtsPayRule.GetDtsPayByClient(ProjectCode, ClientName); } else { tb = BLL.DtsPayRule.GetDtsPayByProject(ProjectCode); } /* * //取要导入的数据 * switch (this.rdoOption.SelectedValue) * { * case "0": * tb = BLL.DtsPayRule.GetDtsPayByProject(ProjectCode); * break; * case "1": * tb = BLL.DtsPayRule.GetDtsPayByClient(ProjectCode, ClientName); * // tb = BLL.DtsPayRule.GetDtsPayByContract(ContractID); * break; * default: * return; * } */ if (tb.Rows.Count == 0) { Response.Write(JavaScript.Alert(true, "无数据")); return; } DtsInfo dts = new DtsInfo(tb); Session["DtsSale"] = dts; DtsStart(dts); // ((DtsProgress)this.DtsProgress).Start(dts.Count); /* string script = "<script language='javascript'>\n" + "isDtsContinue = true;\n" + "</script>\n"; + Page.RegisterStartupScript("ContinueDts", script); */ }