/// <summary> /// 执行存储过程验证序号(保存时) /// </summary> /// <param name="psv"></param> private void ExecImport(ParamsImport psv) { try { SqlConnection sqlConn = new SqlConnection(); SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "[PRO_TM_ImportDataAll_Modify]"); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_TableName", psv.Tg_TableName, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_Engid", psv.Tg_Engid, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_FatherIndex", psv.Tg_FatherIndex, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_TotalTaishu", psv.Tg_TotalTaishu, SqlDbType.Int, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Src_TableName", psv.Src_TableName, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Src_Engid", psv.Src_Engid, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Src_FatherIndex", psv.Src_FatherIndex, SqlDbType.Text, 1000); //////DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Sc_TotalTaishu", psv.Sc_TotalTaishu, SqlDbType.Int, 1000); // DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Coype_Type", psv.Coype_Type, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Bef_RepTuhao_1", psv.Bef_RepTuhao_1, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Aft_RepTuhao_1", psv.Aft_RepTuhao_1, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Bef_RepTuhao_2", psv.Bef_RepTuhao_2, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Aft_RepTuhao_2", psv.Aft_RepTuhao_2, SqlDbType.Text, 1000); DBCallCommon.AddParameterToStoredProc(sqlCmd, "@NotImport", psv.NotImport, SqlDbType.Text, 4000); sqlConn.Open(); sqlCmd.CommandTimeout = 0; sqlCmd.ExecuteNonQuery(); sqlConn.Close(); } catch (Exception) { throw; } }
/// <summary> /// 开始导入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_ImportAll(object sender, EventArgs e) { string retValue = this.CheckEnableSubmit(); if (retValue == "Ok") { ParamsImport psv = new ParamsImport(); psv.Tg_TableName = "TBPM_STRINFODQO"; psv.Tg_Engid = ViewState["TaskID"].ToString(); ////psv.Tg_FatherIndex = ""; psv.Src_TableName = "View_TM_DQO"; psv.Src_Engid = ddlEngName.SelectedValue.Split('%')[0]; ////psv.Src_FatherIndex = ""; psv.Bef_RepTuhao_1 = txtOldTu_1.Text.Trim(); psv.Aft_RepTuhao_1 = txtNewTu_1.Text.Trim(); psv.Bef_RepTuhao_2 = txtOldTu_2.Text.Trim(); psv.Aft_RepTuhao_2 = txtNewTu_2.Text.Trim(); for (int i = 0; i < Convert.ToInt16((ViewState["CurrentFX"]).ToString()); i++) { ZCZJ_DPF.UserInputZongxu tt = (ZCZJ_DPF.UserInputZongxu)tb1.FindControl("UserInputZongxu_" + (i + 1).ToString()); if (tt.Visible) { psv.Src_FatherIndex = ((TextBox)tt.FindControl("txtBeforeFX")).Text.Trim().Split('|')[1].Trim(); psv.Tg_FatherIndex = ((TextBox)tt.FindControl("txtAfterFX")).Text.Trim(); psv.NotImport = tt.ArrayNotImport.Replace("-", "'"); psv.Tg_TotalTaishu = lblNumber.Text.Trim(); try { this.ExecImport(psv); ((TextBox)tt.FindControl("txtBeforeFX")).Text = ""; ((TextBox)tt.FindControl("txtAfterFX")).Text = ""; } catch (Exception) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('导入【" + psv.Src_FatherIndex + "】时出错,该父序及后续父序导入未完成!!!\\r\\r可能原因:复制导致目标工程中序号重复');", true); return; } } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('导入完成!!!');", true); } else if (retValue.Contains("BelongTo")) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('无法导入!!!\\r【复制后父序】存在归属关系!!!');", true); } else if (retValue.Contains("Empty")) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('无法导入!!!\\r【待复制父序】及【复制后父序】不能为空!!!');", true); } else if (retValue.Contains("NoFather")) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('无法导入!!!\\r父级不存在!!!');", true); } }