public bool CopyData(object obj, string prameter) { bool isSelected = false; int selectCount = 0; string copySourceID = ""; try { for (int i = 0; i < testTestplanList.Length; i++) { ASCXTestPlanList cb = (ASCXTestPlanList)TestPlanList.FindControl(testTestplanList[i].ID); if (cb != null) { if (cb.BeSelected == true) { selectCount++; isSelected = true; copySourceID = cb.TestplanSelfID; } } else { Response.Write("<script>alert('can not find user control!');</script>"); return(false); } } if (isSelected == false || selectCount > 1) { //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('请至少选择一个!');return false;</script>"); this.Page.RegisterStartupScript("", "<script>alert('只能选择一个!');</script>"); //Response.Write("<script>alert('请至少选择一个!');</script>"); return(false); } Response.Redirect("~/WebFiles/Production_ATS/TestPlan/CopyTestPlan.aspx?uId=" + moduleTypeID.Trim() + "&sourceID=" + copySourceID); } catch (System.Exception ex) { throw ex; } return(true); }
public bool DeleteData(object obj, string prameter) { //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>if(confirm('Are you sure you want to delete?')){DeleteData1();}else{}</script>"); bool isSelected = false; bool deleteAction = false; string noAuthorityIDStr = ""; string deletStr = "select * from TopoTestPlan where IgnoreFlag='False'and PID=" + moduleTypeID; try { for (int i = 0; i < testTestplanList.Length; i++) { ASCXTestPlanList cb = (ASCXTestPlanList)TestPlanList.FindControl(testTestplanList[i].ID); if (cb != null) { if (cb.BeSelected == true) { //mydt.Rows[i].Delete(); if (deleteFunctionAuthority) { mydt.Rows[i]["IgnoreFlag"] = true; isSelected = true; deleteAction = true; } else { if (GetTestPlanDeleteAuthority(testTestplanList[i].ID)) { mydt.Rows[i]["IgnoreFlag"] = true; isSelected = true; deleteAction = true; } else { isSelected = true; noAuthorityIDStr += testTestplanList[i].TestplanSelfText + ";"; } } } } else { Response.Write("<script>alert('can not find user control!');</script>"); return(false); } } if (isSelected == false) { //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('请至少选择一个!');return false;</script>"); this.Page.RegisterStartupScript("", "<script>alert('请至少选择一个!');</script>"); //Response.Write("<script>alert('请至少选择一个!');</script>"); return(false); } if (deleteAction) { int result = -1; if (Session["DB"].ToString().ToUpper() == "ATSDB") { result = pDataIO.UpdateWithProc("TopoTestPlan", mydt, deletStr, logTracingString, "ATS_V2"); } else if (Session["DB"].ToString().ToUpper() == "ATSDEBUGDB") { result = pDataIO.UpdateWithProc("TopoTestPlan", mydt, deletStr, logTracingString, "ATS_VXDEBUG"); } if (result > 0) { mydt.AcceptChanges(); } else { pDataIO.AlertMsgShow("数据更新失败!"); } } if (noAuthorityIDStr != "") { noAuthorityIDStr += "你没有操作权限!"; noAuthorityIDStr = noAuthorityIDStr.Replace("'", @"""").Replace("\r", "").Replace("\n", "\\n").Replace("\t", "\\t"); string tempurl = Request.Url.ToString(); string myscript = @"alert('" + noAuthorityIDStr + "');window.location.href='" + tempurl + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", myscript, true); } else { 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"; Session["iframe_src"] = "WebFiles/Production_ATS/TestPlan/TestPlanList.aspx?uId=" + moduleTypeID; ScriptManager.RegisterStartupScript(this, typeof(Page), "", "window.parent.RefreshTreeNode();", true); //Response.Redirect(Request.Url.ToString()); } return(true); } catch (System.Exception ex) { pDataIO.WriteErrorLogs(ex.ToString()); throw ex; } }
public bool DeleteData(object obj, string prameter) { //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>if(confirm('Are you sure you want to delete?')){DeleteData1();}else{}</script>"); bool isSelected = false; bool deleteAction = false; string noAuthorityIDStr = ""; string deletStr = "select * from TopoTestPlan where IgnoreFlag='False'and PID=" + moduleTypeID; try { for (int i = 0; i < testTestplanList.Length; i++) { ASCXTestPlanList cb = (ASCXTestPlanList)TestPlanList.FindControl(testTestplanList[i].ID); if (cb != null) { if (cb.BeSelected == true) { //mydt.Rows[i].Delete(); if (deleteFunctionAuthority) { mydt.Rows[i]["IgnoreFlag"] = true; isSelected = true; deleteAction = true; } else { if (GetTestPlanDeleteAuthority(testTestplanList[i].ID)) { mydt.Rows[i]["IgnoreFlag"] = true; isSelected = true; deleteAction = true; } else { isSelected = true; noAuthorityIDStr += testTestplanList[i].TestplanSelfText + ";"; } } } } else { Response.Write("<script>alert('can not find user control!');</script>"); return(false); } } if (isSelected == false) { //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('Did not choose any one!');return false;</script>"); this.Page.RegisterStartupScript("", "<script>alert('Did not choose any one!');</script>"); //Response.Write("<script>alert('Did not choose any one!');</script>"); return(false); } if (deleteAction) { int result = pDataIO.UpdateWithProc("TopoTestPlan", mydt, deletStr, logTracingString); if (result > 0) { mydt.AcceptChanges(); } else { pDataIO.AlertMsgShow("Update data fail!"); } } if (noAuthorityIDStr != "") { noAuthorityIDStr += "you have no authority!"; noAuthorityIDStr = noAuthorityIDStr.Replace("'", @"""").Replace("\r", "").Replace("\n", "\\n").Replace("\t", "\\t"); string tempurl = Request.Url.ToString(); string myscript = @"alert('" + noAuthorityIDStr + "');window.location.href='" + tempurl + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", myscript, true); } else { Response.Redirect(Request.Url.ToString()); } return(true); } catch (System.Exception ex) { pDataIO.WriteErrorLogs(ex.ToString()); throw ex; } }