protected void btnUpdate_Click(Object Sender, EventArgs e) { int intStep = Int32.Parse(Request.QueryString["step"]); string strAlert = oForecast.AddStepDone(intID, intStep, 1); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">" + strAlert + "window.navigate('" + Request.Path + "?id=" + intID.ToString() + "&save=true');<" + "/" + "script>"); }
protected void btnUpdate_Click(Object Sender, EventArgs e) { bool boolError = Save(); string strStep = ""; if (Request.QueryString["step"] != null && Request.QueryString["step"] != "") { strStep = "&step=" + Request.QueryString["step"]; } if (boolError == false) { Response.Redirect(Request.Path + "?id=" + intID.ToString() + strStep + "&code=true"); } else { int intStep = Int32.Parse(Request.QueryString["step"]); oForecast.AddStepDone(intID, intStep, 1); CheckBlade(); } }
private bool Save() { if (intID == 0) { intPlatform = Int32.Parse(ddlPlatform.SelectedItem.Value); intID = oForecast.AddAnswer(Int32.Parse(Request.QueryString["parent"]), intPlatform, 0, intProfile); } bool boolOverride = false; bool boolAlready = false; if (radYes.Checked && oForecast.GetAnswer(intID, "override") == "1") { boolAlready = true; } else if (radYes.Checked) { boolOverride = true; } int intApplicationID = Int32.Parse(ddlApplications.SelectedItem.Value); ServerName oServerName = new ServerName(0, dsn); int intSubApplicationID = 0; if (oServerName.GetSubApplications(intApplicationID, 1).Tables[0].Rows.Count > 0 && Request.Form[hdnSubApplication.UniqueID] != "") { intSubApplicationID = Int32.Parse(Request.Form[hdnSubApplication.UniqueID]); } int intOverride = (boolAlready == true ? 1 : (boolOverride == true ? (radBreakYes.Checked ? 1 : -1) : 0)); int intClass = Int32.Parse(ddlClass.SelectedItem.Value); bool boolName = true; if (intOverride == 1) { if (radBreakYes.Checked == true) { int intName = 0; if (oClass.Get(intClass, "pnc") == "1") { intName = oServerName.GetNameFactory(txtDeviceName.Text); } else { intName = oServerName.GetName(txtDeviceName.Text); } if (intName == 0) { boolName = false; } else { oForecast.UpdateAnswer(intID, intOverride, 1, txtChange.Text, intName, Request.ServerVariables["REMOTE_HOST"], "", txtName.Text, Int32.Parse(Request.Form[hdnLocation.UniqueID]), intClass, (chkTest.Checked ? 1 : 0), Int32.Parse(Request.Form[hdnEnvironment.UniqueID]), Int32.Parse(ddlMaintenance.SelectedItem.Value), intApplicationID, intSubApplicationID, Int32.Parse(txtQuantity.Text), (radResiliencyYes.Checked ? 1 : 0)); } } else { oForecast.UpdateAnswer(intID, intOverride, 0, "", 0, Request.ServerVariables["REMOTE_HOST"], "", txtName.Text, Int32.Parse(Request.Form[hdnLocation.UniqueID]), intClass, (chkTest.Checked ? 1 : 0), Int32.Parse(Request.Form[hdnEnvironment.UniqueID]), Int32.Parse(ddlMaintenance.SelectedItem.Value), intApplicationID, intSubApplicationID, Int32.Parse(txtQuantity.Text), (radResiliencyYes.Checked ? 1 : 0)); } } else { oForecast.UpdateAnswer(intID, intOverride, 0, "", 0, Request.ServerVariables["REMOTE_HOST"], "", txtName.Text, Int32.Parse(Request.Form[hdnLocation.UniqueID]), intClass, (chkTest.Checked ? 1 : 0), Int32.Parse(Request.Form[hdnEnvironment.UniqueID]), Int32.Parse(ddlMaintenance.SelectedItem.Value), intApplicationID, intSubApplicationID, Int32.Parse(txtQuantity.Text), (radResiliencyYes.Checked ? 1 : 0)); } if (boolName == true) { // Set up the forecast steps done table to check if a certain step of a forecast is done. DataSet dsSteps = oForecast.GetSteps(intPlatform, 1); DataSet dsStepsDone = oForecast.GetStepsDone(intID, 0); if (dsSteps.Tables[0].Rows.Count != dsStepsDone.Tables[0].Rows.Count) { int intCount = 0; foreach (DataRow drStep in dsSteps.Tables[0].Rows) { intCount++; oForecast.AddStepDone(intID, intCount, 0); } } } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">alert('Please enter a valid device name!\\n\\nThe device name you entered was not found\\n\\nIf you think this device exists, please contact your ClearView administrator');<" + "/" + "script>"); } return(boolName); }