public bool SaveData(object obj, string prameter) { try { string errMsg = ""; int result; if (testTestplanSelfInfor.CheckBox1CheckedFlag == false) { result = pDataIO.CopyTestPlan(Convert.ToInt32(SourceTestPlanID), testTestplanSelfInfor.TBItemNameText.Trim(), Convert.ToInt32(moduleTypeID), logTracingString, out errMsg); } else { PNText = testTestplanSelfInfor.DropDownList2Text; TypeText = testTestplanSelfInfor.DropDownList1Text; pDataIO.OpenDatabase(true); string sql; sql = "select GlobalProductionName.ID from GlobalProductionName,GlobalProductionType " + "where GlobalProductionName.PID=GlobalProductionType.ID and GlobalProductionType.ItemName='" + TypeText + "' and GlobalProductionName.PN='" + PNText + "'"; DataTable dt = pDataIO.GetDataTable(sql, ""); if (dt.Rows.Count != 0) { moduleTypeID = dt.Rows[0]["ID"].ToString(); } result = pDataIO.CopyTestPlan(Convert.ToInt32(SourceTestPlanID), testTestplanSelfInfor.TBItemNameText.Trim(), Convert.ToInt32(moduleTypeID), logTracingString, out errMsg); } if (result > 0) { if (testPlanAddFunctionAuthority == false) { string userPlanStr = "select * from UserPlanAction where ID='-1'"; DataTable userPlanTable = pDataIO.GetDataTable(userPlanStr, "UserPlanAction"); DataRow userDR = userPlanTable.NewRow(); userDR[0] = -1; userDR[1] = Session["UserID"].ToString().Trim(); userDR[2] = result; userDR[3] = true; userDR[4] = true; userDR[5] = true; userPlanTable.Rows.Add(userDR); int resltUserPlan = -1; if (Session["DB"].ToString().ToUpper() == "ATSDB") { resltUserPlan = pDataIO.UpdateWithProc("UserPlanAction", userPlanTable, userPlanStr, logTracingString, "ATS_V2"); } else if (Session["DB"].ToString().ToUpper() == "ATSDEBUGDB") { resltUserPlan = pDataIO.UpdateWithProc("UserPlanAction", userPlanTable, userPlanStr, logTracingString, "ATS_VXDEBUG"); } if (resltUserPlan < 0) { errMsg = errMsg.Replace("'", @"""").Replace("\r", "").Replace("\n", "\\n").Replace("\t", "\\t"); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), "aaa", "<script>alert('" + errMsg + "');</script>", false); testTestplanSelfInfor.TBItemNameText = ""; } else { //Response.Redirect("~/WebFiles/Production_ATS/TestPlan/TestPlanList.aspx?uId=" + moduleTypeID.Trim()); DataTable dt = pDataIO.GetDataTable("select PID from GlobalProductionName where ID=" + moduleTypeID, "GlobalProductionName"); int typeID = Convert.ToInt32(dt.Rows[0]["PID"]); dt = pDataIO.GetDataTable("select newtable.num from (select ROW_NUMBER() OVER (ORDER BY GlobalProductionType.ID ASC) AS num,GlobalProductionType.ID from GlobalProductionType where GlobalProductionType.IgnoreFlag='false') as newtable where newtable.ID=" + typeID, "GlobalProductionTypeNum"); Session["TreeNodeExpand"] = Convert.ToInt32(dt.Rows[0]["num"]) - 1; dt = pDataIO.GetDataTable("select newtable.num,newtable.ID from (select ROW_NUMBER() OVER (ORDER BY GlobalProductionName.ID ASC) AS num,GlobalProductionName.* from GlobalProductionName where IgnoreFlag='false' and PID =" + typeID + ") as newtable where newtable.ID =" + moduleTypeID, "GlobalProductionNameNum"); Session["TreeNodeExpand"] = Session["TreeNodeExpand"].ToString() + "+" + (Convert.ToInt32(dt.Rows[0]["num"]) - 1).ToString(); Session["TreeNodeExpand"] = Session["TreeNodeExpand"].ToString() + "+1"; dt = pDataIO.GetDataTable("select newtable.num,newtable.ID from (select ROW_NUMBER() OVER (ORDER BY TopoTestPlan.ID ASC) AS num,TopoTestPlan.* from TopoTestPlan where IgnoreFlag='false' and PID =" + moduleTypeID + ") as newtable where newtable.ItemName ='" + testTestplanSelfInfor.TBItemNameText.Trim() + "'", "TopoTestPlanNum"); Session["TreeNodeExpand"] = Session["TreeNodeExpand"].ToString() + "+" + (Convert.ToInt32(dt.Rows[0]["num"]) - 1).ToString(); Session["iframe_src"] = "WebFiles/Production_ATS/TestPlan/TestplanSelfInfor.aspx?uId=" + Convert.ToInt32(dt.Rows[0]["ID"]); ScriptManager.RegisterStartupScript(this, typeof(Page), "", "window.parent.RefreshTreeNode();", true); } } else { //Response.Redirect("~/WebFiles/Production_ATS/TestPlan/TestPlanList.aspx?uId=" + moduleTypeID.Trim()); DataTable dt = pDataIO.GetDataTable("select PID from GlobalProductionName where ID=" + moduleTypeID, "GlobalProductionName"); int typeID = Convert.ToInt32(dt.Rows[0]["PID"]); dt = pDataIO.GetDataTable("select newtable.num from (select ROW_NUMBER() OVER (ORDER BY GlobalProductionType.ID ASC) AS num,GlobalProductionType.ID from GlobalProductionType where GlobalProductionType.IgnoreFlag='false') as newtable where newtable.ID=" + typeID, "GlobalProductionTypeNum"); Session["TreeNodeExpand"] = Convert.ToInt32(dt.Rows[0]["num"]) - 1; dt = pDataIO.GetDataTable("select newtable.num,newtable.ID from (select ROW_NUMBER() OVER (ORDER BY GlobalProductionName.ID ASC) AS num,GlobalProductionName.* from GlobalProductionName where IgnoreFlag='false' and PID =" + typeID + ") as newtable where newtable.ID =" + moduleTypeID, "GlobalProductionNameNum"); Session["TreeNodeExpand"] = Session["TreeNodeExpand"].ToString() + "+" + (Convert.ToInt32(dt.Rows[0]["num"]) - 1).ToString(); Session["TreeNodeExpand"] = Session["TreeNodeExpand"].ToString() + "+1"; dt = pDataIO.GetDataTable("select newtable.num,newtable.ID from (select ROW_NUMBER() OVER (ORDER BY TopoTestPlan.ID ASC) AS num,TopoTestPlan.* from TopoTestPlan where IgnoreFlag='false' and PID =" + moduleTypeID + ") as newtable where newtable.ItemName ='" + testTestplanSelfInfor.TBItemNameText.Trim() + "'", "TopoTestPlanNum"); Session["TreeNodeExpand"] = Session["TreeNodeExpand"].ToString() + "+" + (Convert.ToInt32(dt.Rows[0]["num"]) - 1).ToString(); Session["iframe_src"] = "WebFiles/Production_ATS/TestPlan/TestplanSelfInfor.aspx?uId=" + Convert.ToInt32(dt.Rows[0]["ID"]); ScriptManager.RegisterStartupScript(this, typeof(Page), "", "window.parent.RefreshTreeNode();", true); } } else { errMsg = errMsg.Replace("'", @"""").Replace("\r", "").Replace("\n", "\\n").Replace("\t", "\\t"); //string Url = Request.Url.ToString(); //HttpContext.Current.Response.Write("<script>alert('" + msg + "');javascript:location='"+Url+"';</script>"); //ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), "aaa", "<script>alert('" + errMsg + "');javascript:location='" + Url + "';</script>", false); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), "aaa", "<script>alert('" + errMsg + "');</script>", false); testTestplanSelfInfor.TBItemNameText = ""; } return(true); } catch (System.Exception ex) { pDataIO.WriteErrorLogs(ex.ToString()); throw ex; } }
public bool SaveData(object obj, string prameter) { try { string errMsg = ""; int result; if (testTestplanSelfInfor.CheckBox1CheckedFlag == false) { result = pDataIO.CopyTestPlan(Convert.ToInt32(SourceTestPlanID), testTestplanSelfInfor.TBItemNameText.Trim(), Convert.ToInt32(moduleTypeID), logTracingString, out errMsg); } else { PNText = testTestplanSelfInfor.DropDownList2Text; TypeText = testTestplanSelfInfor.DropDownList1Text; pDataIO.OpenDatabase(true); string sql; sql = "select GlobalProductionName.ID from GlobalProductionName,GlobalProductionType " + "where GlobalProductionName.PID=GlobalProductionType.ID and GlobalProductionType.ItemName='" + TypeText + "' and GlobalProductionName.PN='" + PNText + "'"; DataTable dt = pDataIO.GetDataTable(sql, ""); if (dt.Rows.Count != 0) { moduleTypeID = dt.Rows[0]["ID"].ToString(); } result = pDataIO.CopyTestPlan(Convert.ToInt32(SourceTestPlanID), testTestplanSelfInfor.TBItemNameText.Trim(), Convert.ToInt32(moduleTypeID), logTracingString, out errMsg); } if (result > 0) { if (testPlanAddFunctionAuthority == false) { string userPlanStr = "select * from UserPlanAction where ID='-1'"; DataTable userPlanTable = pDataIO.GetDataTable(userPlanStr, "UserPlanAction"); DataRow userDR = userPlanTable.NewRow(); userDR[0] = -1; userDR[1] = Session["UserID"].ToString().Trim(); userDR[2] = result; userDR[3] = true; userDR[4] = true; userDR[5] = true; userPlanTable.Rows.Add(userDR); int resltUserPlan = pDataIO.UpdateWithProc("UserPlanAction", userPlanTable, userPlanStr, logTracingString); if (resltUserPlan < 0) { errMsg = errMsg.Replace("'", @"""").Replace("\r", "").Replace("\n", "\\n").Replace("\t", "\\t"); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), "aaa", "<script>alert('" + errMsg + "');</script>", false); testTestplanSelfInfor.TBItemNameText = ""; } else { Response.Redirect("~/WebFiles/TestPlan/TestPlanList.aspx?uId=" + moduleTypeID.Trim()); } } else { Response.Redirect("~/WebFiles/TestPlan/TestPlanList.aspx?uId=" + moduleTypeID.Trim()); } } else { errMsg = errMsg.Replace("'", @"""").Replace("\r", "").Replace("\n", "\\n").Replace("\t", "\\t"); //string Url = Request.Url.ToString(); //HttpContext.Current.Response.Write("<script>alert('" + msg + "');javascript:location='"+Url+"';</script>"); //ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), "aaa", "<script>alert('" + errMsg + "');javascript:location='" + Url + "';</script>", false); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), "aaa", "<script>alert('" + errMsg + "');</script>", false); testTestplanSelfInfor.TBItemNameText = ""; } return(true); } catch (System.Exception ex) { pDataIO.WriteErrorLogs(ex.ToString()); throw ex; } }