protected void btnComplete_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 3, true); oResourceRequest.CloseWorkflow(intResourceWorkflow, intEnvironment, 0, dsnServiceEditor, true, intResourceRequestApprove, intAssignPage, intViewPage, dsnAsset, dsnIP); oOnDemandTasks.UpdateServerStorageComplete(intRequest, intItem, intNumber); // Add a green / completed status if there are no updates, OR the last status is not green DataSet dsStatus = oResourceRequest.GetStatuss(intResourceWorkflow); if (dsStatus.Tables[0].Rows.Count == 0 || dsStatus.Tables[0].Rows[0]["status"].ToString() != "3") { oResourceRequest.AddStatus(intResourceWorkflow, 3, "Completed", intProfile); } // Update II OnDemand Task int intAnswer = Int32.Parse(lblAnswer.Text); int intModel = Int32.Parse(lblModel.Text); oOnDemandTasks.UpdateStorage(intAnswer, intModel); // Initiate PNC Workflow (if applicable) PNCTasks oPNCTask = new PNCTasks(0, dsn); strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DESIGN_BUILDER"); //oPNCTask.InitiateNextStep(intRequest, intService, intNumber, intAnswer, intModel, intEnvironment, intApplicationCitrix, intAssignPage, intViewPage, dsnAsset, dsnIP, dsnServiceEditor, false, 0); oPNCTask.InitiateNextStep(intRequest, intAnswer, intModel, intEnvironment, intAssignPage, intViewPage, dsnAsset, dsnIP, dsnServiceEditor); // Notify Builder bool boolProd = (lblProd.Text == "1"); Forecast oForecast = new Forecast(0, dsn); int intBuilder = 0; DataSet dsTasks = oOnDemandTasks.GetPending(intAnswer); if (dsTasks.Tables[0].Rows.Count > 0) { intBuilder = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString()); intBuilder = Int32.Parse(oResourceRequest.GetWorkflow(intBuilder, "userid")); } if (intBuilder > 0) { oFunction.SendEmail("Storage Completed!", oUser.GetName(intBuilder), "", strEMailIdsBCC, "Storage Completed!", "<p><b>This message is to notify you that " + (boolProd ? "PRODUCTION" : "TEST") + " storage has been configured for the following design...</b></p><p>" + oForecast.GetAnswerBody(intAnswer, intEnvironment, dsnAsset, dsnIP) + "</p>", true, false); } else { oFunction.SendEmail("Storage Completed!", strEMailIdsBCC, "", "", "Storage Completed!", "<p><b>This message is to notify you that " + (boolProd ? "PRODUCTION" : "QA / TEST") + " storage has been configured for the following design...</b> (No Builder for ANSWERID " + intAnswer.ToString() + ")</p><p>" + oForecast.GetAnswerBody(intAnswer, intEnvironment, dsnAsset, dsnIP) + "</p>", true, false); } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>"); }
protected void btnComplete_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); int intAnswer = 0; int intModel = 0; DataSet ds = oOnDemandTasks.GetServerOther(intRequest, intService, intNumber); if (ds.Tables[0].Rows.Count > 0) { intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); } string strSaveError = SaveConfigs(intAnswer, true); if (strSaveError == "") { // Add a green / completed status if there are no updates, OR the last status is not green DataSet dsStatus = oResourceRequest.GetStatuss(intResourceWorkflow); if (dsStatus.Tables[0].Rows.Count == 0 || dsStatus.Tables[0].Rows[0]["status"].ToString() != "3") { oResourceRequest.AddStatus(intResourceWorkflow, 3, "Completed", intProfile); } oOnDemandTasks.UpdateServerOtherComplete(intRequest, intService, intNumber); oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 3, true); PNCTasks oPNCTask = new PNCTasks(0, dsn); //oPNCTask.InitiateNextStep(intRequest, intService, intNumber, intAnswer, intModel, intEnvironment, intApplicationCitrix, intAssignPage, intViewPage, dsnAsset, dsnIP, dsnServiceEditor, false, 50); oPNCTask.InitiateNextStep(intRequest, intAnswer, intModel, intEnvironment, intAssignPage, intViewPage, dsnAsset, dsnIP, dsnServiceEditor); oResourceRequest.CloseWorkflow(intResourceWorkflow, intEnvironment, 0, dsnServiceEditor, true, intResourceRequestApprove, intAssignPage, intViewPage, dsnAsset, dsnIP); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>"); } else { GetError(strSaveError); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/pnc_tasks.aspx"; Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30); if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); } else { Response.Redirect("/admin/login.aspx"); } oPNCTask = new PNCTasks(intProfile, dsn); oService = new Services(intProfile, dsn); if (Request.QueryString["id"] == null) { if (Request.QueryString["add"] == null) { LoopRepeater(); } else { panAdd.Visible = true; } } else { panAdd.Visible = true; intID = Int32.Parse(Request.QueryString["id"]); if (intID > 0 && !IsPostBack) { DataSet ds = oPNCTask.Get(intID); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); hdnParent.Value = intService.ToString(); lblParent.Text = oService.Get(intService, "name"); chkIfCluster.Checked = (ds.Tables[0].Rows[0]["if_cluster"].ToString() == "1"); chkIfSQL.Checked = (ds.Tables[0].Rows[0]["if_sql"].ToString() == "1"); chkIfCitrix.Checked = (ds.Tables[0].Rows[0]["if_citrix"].ToString() == "1"); chkIfLTMcfg.Checked = (ds.Tables[0].Rows[0]["if_ltm_config"].ToString() == "1"); chkIfLTMins.Checked = (ds.Tables[0].Rows[0]["if_ltm_install"].ToString() == "1"); chkVirtual.Checked = (ds.Tables[0].Rows[0]["if_virtual"].ToString() == "1"); chkPhysical.Checked = (ds.Tables[0].Rows[0]["if_physical"].ToString() == "1"); chkStorage.Checked = (ds.Tables[0].Rows[0]["storage"].ToString() == "1"); chkDNS.Checked = (ds.Tables[0].Rows[0]["dns"].ToString() == "1"); chkTSM.Checked = (ds.Tables[0].Rows[0]["tsm"].ToString() == "1"); chkLegato.Checked = (ds.Tables[0].Rows[0]["legato"].ToString() == "1"); chkPNC.Checked = (ds.Tables[0].Rows[0]["pnc"].ToString() == "1"); chkNCB.Checked = (ds.Tables[0].Rows[0]["ncb"].ToString() == "1"); chkDistributed.Checked = (ds.Tables[0].Rows[0]["distributed"].ToString() == "1"); chkMidrange.Checked = (ds.Tables[0].Rows[0]["midrange"].ToString() == "1"); chkOffsite.Checked = (ds.Tables[0].Rows[0]["offsite"].ToString() == "1"); chkImplementor.Checked = (ds.Tables[0].Rows[0]["implementor"].ToString() == "1"); chkNetworkEngineer.Checked = (ds.Tables[0].Rows[0]["network_engineer"].ToString() == "1"); chkDBA.Checked = (ds.Tables[0].Rows[0]["dba"].ToString() == "1"); chkProjectManager.Checked = (ds.Tables[0].Rows[0]["project_manager"].ToString() == "1"); chkDepartmentalManager.Checked = (ds.Tables[0].Rows[0]["departmental_manager"].ToString() == "1"); chkApplicationLead.Checked = (ds.Tables[0].Rows[0]["application_lead"].ToString() == "1"); chkAdministrativeContact.Checked = (ds.Tables[0].Rows[0]["administrative_contact"].ToString() == "1"); chkApplicationOwner.Checked = (ds.Tables[0].Rows[0]["application_owner"].ToString() == "1"); chkRequestor.Checked = (ds.Tables[0].Rows[0]["requestor"].ToString() == "1"); chkService.Checked = (chkImplementor.Checked == false && chkNetworkEngineer.Checked == false && chkDBA.Checked == false && chkProjectManager.Checked == false && chkDepartmentalManager.Checked == false && chkApplicationLead.Checked == false && chkAdministrativeContact.Checked == false && chkApplicationOwner.Checked == false && chkRequestor.Checked == false); chkDecom.Checked = (ds.Tables[0].Rows[0]["decom"].ToString() == "1"); txtStep.Text = ds.Tables[0].Rows[0]["step"].ToString(); txtSubStep.Text = ds.Tables[0].Rows[0]["substep"].ToString(); chkNonTransparent.Checked = (ds.Tables[0].Rows[0]["non_transparent"].ToString() == "1"); chkClient.Checked = (ds.Tables[0].Rows[0]["client"].ToString() == "1"); chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1"); } } btnParent.Attributes.Add("onclick", "return OpenWindow('SERVICEBROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oProject = new Projects(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oService = new Services(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oRequestField = new RequestFields(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oServiceDetail = new ServiceDetails(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oDocument = new Documents(intProfile, dsn); oOnDemandTasks = new OnDemandTasks(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oVariable = new Variables(intEnvironment); oLTM = new LTM(intProfile, dsn); oServer = new Servers(intProfile, dsn); oCluster = new Cluster(intProfile, dsn); oPNCTask = new PNCTasks(intProfile, dsn); oDesign = new Design(intProfile, dsn); if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "") { // Start Workflow Change lblResourceWorkflow.Text = Request.QueryString["rrid"]; int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); ds = oResourceRequest.Get(intResourceParent); // End Workflow Change intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest)); lblRequestedOn.Text = DateTime.Parse(oResourceRequest.Get(intResourceParent, "created")).ToString(); lblDescription.Text = oRequest.Get(intRequest, "description"); if (lblDescription.Text == "") { lblDescription.Text = "<i>No information</i>"; } intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); // Start Workflow Change bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); boolJoined = (oResourceRequest.GetWorkflow(intResourceWorkflow, "joined") == "1"); // End Workflow Change intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); lblService.Text = oService.Get(intService, "name"); int intApp = oRequestItem.GetItemApplication(intItem); if (Request.QueryString["save"] != null && Request.QueryString["save"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>"); } if (Request.QueryString["status"] != null && Request.QueryString["status"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Updates has been Added');<" + "/" + "script>"); } if (!IsPostBack) { double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent); bool boolSaved = false; if (dblAllocated == dblUsed) { boolSaved = true; if (boolComplete == false) { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();"); } else { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;"); } } else { btnComplete.ImageUrl = "/images/tool_complete_dbl.gif"; btnComplete.Enabled = false; } bool boolSLABreached = false; if (oService.Get(intService, "sla") != "") { oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla"); int intDays = oResourceRequest.GetSLA(intResourceParent); if (intDays > -99999) { if (intDays < 1) { btnSLA.Style["border"] = "solid 2px #FF0000"; } else if (intDays < 3) { btnSLA.Style["border"] = "solid 2px #FF9999"; } boolSLABreached = (intDays < 0); btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');"); } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } oFunction.ConfigureToolButton(btnEmail, "/images/tool_email"); btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=GENERIC');"); dblUsed = (dblUsed / dblAllocated) * 100; strCheckboxes = oServiceDetail.LoadCheckboxes(intRequest, intItem, intNumber, intResourceWorkflow, intService); if (oService.Get(intService, "tasks") != "1" || strCheckboxes == "") { if (oService.Get(intService, "no_slider") == "1") { panNoSlider.Visible = true; btnComplete.ImageUrl = "/images/tool_complete.gif"; btnComplete.Enabled = true; btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();"); btnComplete.CommandArgument = "FAST"; } else { panSlider.Visible = true; sldHours._StartPercent = dblUsed.ToString(); sldHours._TotalHours = dblAllocated.ToString(); } } else { panCheckboxes.Visible = true; } if (intService == intSecurityServiceID) { LoadSecurity(); } if (intService == intServiceCSM) { LoadLTM(boolSaved); } if (intService == intServiceCluster) { LoadCluster(); } LoadMIS(boolComplete, intResourceWorkflow); intProject = oRequest.GetProjectNumber(intRequest); hdnTab.Value = "D"; panWorkload.Visible = true; bool boolRed = LoadStatus(intResourceWorkflow); if (boolRed == false && boolSLABreached == true) { btnComplete.Attributes.Add("onclick", "alert('NOTE: Your Service Level Agreement (SLA) has been breached!\\n\\nYou must provide a RED STATUS update with an explanation of why your SLA was breached for this request.\\n\\nOnce a RED STATUS update has been provided, you will be able to complete this request.');return false;"); } LoadChange(intResourceWorkflow); LoadInformation(intResourceWorkflow); chkDescription.Checked = (Request.QueryString["doc"] != null); lblDocuments.Text = oDocument.GetDocuments_Service(intRequest, intService, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null)); btnDenied.Attributes.Add("onclick", "return CloseWindow();"); oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); //btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "');"); btnSave.Attributes.Add("onclick", "return ProcessControlButton();"); btnChange.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter a change control number')" + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid implementation date')" + " && ValidateTime('" + txtTime.ClientID + "','Please enter a valid implementation time')" + " && ProcessControlButton()" + ";"); imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');"); // 6/1/2009 - Load ReadOnly View if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) { oFunction.ConfigureToolButtonRO(btnSave, btnComplete); //panDenied.Visible = true; } } } else { panDenied.Visible = true; } }
protected void btnGo_Click(Object Sender, EventArgs e) { Design oDesign = new Design(0, dsn); Log oLog = new Log(0, dsn); Forecast oForecast = new Forecast(0, dsn); Users oUser = new Users(0, dsn); int intID = Int32.Parse(txtID.Text); DataSet dsDesign = oDesign.Get(intID); if (dsDesign.Tables[0].Rows.Count > 0) { Int32.TryParse(dsDesign.Tables[0].Rows[0]["answerid"].ToString(), out intID); } if (oForecast.GetAnswer(intID).Tables[0].Rows.Count > 0) { ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); int intForecast = Int32.Parse(oForecast.GetAnswer(intID, "forecastid")); int intRequestExecute = oForecast.GetRequestID(intID, true); int intRequest = Int32.Parse(oForecast.Get(intForecast, "requestid")); Requests oRequest = new Requests(0, dsn); ServiceRequests oServiceRequest = new ServiceRequests(0, dsn); int intProject = oRequest.GetProjectNumber(intRequest); Variables oVariable = new Variables(intEnvironment); Functions oFunction = new Functions(0, dsn, intEnvironment); Projects oProject = new Projects(0, dsn); Pages oPage = new Pages(0, dsn); Servers oServer = new Servers(0, dsn); Cluster oCluster = new Cluster(0, dsn); ServerName oServerName = new ServerName(0, dsn); Asset oAsset = new Asset(0, dsnAsset); IPAddresses oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn); OnDemand oOnDemand = new OnDemand(0, dsn); ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); Types oType = new Types(0, dsn); Storage oStorage = new Storage(0, dsn); OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn); VMWare oVMWare = new VMWare(0, dsn); PNCTasks oPNCTasks = new PNCTasks(0, dsn); Zeus oZeus = new Zeus(intProfile, dsnZeus); DataSet dsServers = oServer.GetRequests(intRequestExecute, 0); if (chkTimes.Checked == true && (chkExitAP.Checked == true || chkConfig.Checked == true || chkUnlock.Checked == true)) { strError = "You can not and should not reset times and alter the design at the same time. RESET PROVISIONING TIMES can not be selected with any other selections."; } else { oLog.AddEvent(intID, "", "", "Design " + intID.ToString() + " reset by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Information); oForecast.AddReset(intID, -999); if (chkTimes.Checked == true) { DateTime datTimes = DateTime.Today; if (DateTime.TryParse(txtTimes.Text, out datTimes) == true) { // Update Design Dates int intExecutedBy = 0; Int32.TryParse(oForecast.GetAnswer(intID, "executed_by"), out intExecutedBy); if (intExecutedBy > 0) { if (chkTimesForecastExecuted.Checked == true) { oForecast.UpdateAnswerExecuted(intID, datTimes.ToString(), intExecutedBy); } if (chkTimesForecastCompleted.Checked == true) { oForecast.UpdateAnswerCompleted(intID, datTimes.ToString()); } if (chkTimesTasksStart.Checked == true) { // Reset all pre-production online tasks (including storage, backup, etc...) DataSet dsTasks = oPNCTasks.GetStepsDesign(intID, 0, 0); foreach (DataRow drTask in dsTasks.Tables[0].Rows) { int intRRID = 0; if (Int32.TryParse(drTask["id"].ToString(), out intRRID) == true) { // Reset the started and completed (if not null) oOnDemandTasks.UpdateTime(intRRID, datTimes, chkTimesTasksCompleted.Checked); } } } DataSet dsAnswer = oServer.GetAnswer(intID); foreach (DataRow drServer in dsAnswer.Tables[0].Rows) { int intServer = Int32.Parse(drServer["id"].ToString()); int intModel = Int32.Parse(drServer["modelid"].ToString()); int intType = oModelsProperties.GetType(intModel); DataSet dsSteps = oOnDemand.GetSteps(intType, 1); // Update Server Dates if (oServer.Get(intServer, "build_started") != "") { if (chkTimesServerStart.Checked == true) { oServer.UpdateBuildStarted(intServer, datTimes.ToString(), true); } if (chkTimesServerSteps.Checked == true) { int intStep = 0; foreach (DataRow drStep in dsSteps.Tables[0].Rows) { intStep++; oOnDemand.UpdateStepDoneServer(intServer, intStep, datTimes); } } } if (chkTimesServerComplete.Checked == true) { oServer.UpdateBuildCompleted(intServer, datTimes.ToString()); } if (chkTimesServerReady.Checked == true) { oServer.UpdateBuildReady(intServer, datTimes.ToString(), true); } } } else { strError = "The design has not been executed"; } } else { strError = "Invalid DateTime"; } } if (chkExitAP.Checked == true) { // Delete the Manual Build Task DataSet dsManual = oOnDemandTasks.GetGenericII(intID); if (dsManual.Tables[0].Rows.Count > 0) { int intRequestID = Int32.Parse(dsManual.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(dsManual.Tables[0].Rows[0]["itemid"].ToString()); int intNumber = Int32.Parse(dsManual.Tables[0].Rows[0]["number"].ToString()); oOnDemandTasks.DeleteGenericII(intID); DataSet dsParent = oResourceRequest.Get(intRequestID, intItem, intNumber); if (dsParent.Tables[0].Rows.Count > 0) { int intRRID = Int32.Parse(dsParent.Tables[0].Rows[0]["parent"].ToString()); oResourceRequest.Delete(intRRID); int intRRWID = Int32.Parse(dsParent.Tables[0].Rows[0]["id"].ToString()); oResourceRequest.DeleteWorkflow(intRRWID); } } // Reset automated servers foreach (DataRow drServer in dsServers.Tables[0].Rows) { int intServer = Int32.Parse(drServer["id"].ToString()); int intAsset = 0; Int32.TryParse(drServer["assetid"].ToString(), out intAsset); // Clear MDT / Altiris oServer.ClearMDT(intServer, dsnAsset, dsnZeus, intEnvironment); // Clear ZEUS if (intAsset > 0) { oZeus.DeleteBuild(oAsset.Get(intAsset, "serial")); } // Clear Steps oServer.UpdateStep(intServer, 0); oOnDemand.DeleteStepDoneServers(intServer, 1); // Clear Dates oServer.UpdateBuildStarted(intServer, "", true); oServer.UpdateBuildCompleted(intServer, ""); oServer.UpdateBuildReady(intServer, "", true); // Clear Errors DataSet dsError = oServer.GetErrors(intServer); foreach (DataRow drError in dsError.Tables[0].Rows) { if (drError["fixed"].ToString() == "") { oServer.UpdateError(intServer, Int32.Parse(drError["step"].ToString()), 0, 0, true, dsnAsset); } } // Clear VMware oVMWare.DeleteGuest(oServer.GetName(intServer, true)); oServiceRequest.Delete(intRequestExecute); if (chkExitAP_Name.Checked == true && drServer["nameid"].ToString() != "") { int intName = Int32.Parse(drServer["nameid"].ToString()); oServer.UpdateServerNamed(intServer, 0); oServerName.UpdateFactory(intName, 1); } if (chkExitAP_IP.Checked == true) { oServer.DeleteIP(intServer, 0, 0, 0, 0, dsnIP); } if (chkExitAP_Asset.Checked == true && intAsset > 0) { oServer.DeleteAsset(intServer); oAsset.AddStatus(intAsset, "", (int)AssetStatus.Available, -100, DateTime.Now); } } // Clear the execution and completion dates oForecast.UpdateAnswerExecution(intID, ""); oForecast.UpdateAnswerExecuted(intID, "", 0); oForecast.UpdateAnswerCompleted(intID, ""); // Clear the new design builder. if (dsDesign.Tables[0].Rows.Count > 0) { int intDesign = Int32.Parse(dsDesign.Tables[0].Rows[0]["id"].ToString()); oForecast.DeleteAnswer(intID); foreach (DataRow drServer in dsServers.Tables[0].Rows) { int intServer = Int32.Parse(drServer["id"].ToString()); oServer.Delete(intServer); } oDesign.UpdateAnswerId(intDesign, 0); if (chkExitAP_Approvals.Checked == true) { oDesign.DeleteApproverFieldWorkflow(intDesign); oDesign.DeleteApproverGroupWorkflow(intDesign, 0); oDesign.DeleteApproverGroupWorkflow(intDesign, 1); oDesign.DeleteSoftwareComponents(intDesign, true); if (chkExitAP_Submissions.Checked == false) { // Reset back to original requestor. oDesign.Approve(intDesign, 0, (oDesign.Get(intDesign, "is_exception") == "1"), intEnvironment, intImplementorDistributedService, intWorkstationPlatform, intImplementorMidrangeService, dsnAsset, dsnIP, dsnServiceEditor, intAssignPage, intResourceRequestApprove, intViewPage); } } if (chkExitAP_Submissions.Checked == true) { oDesign.DeleteSubmitted(intDesign); } } } if (chkConfig.Checked == true) { int intModel = oForecast.GetModel(intID); int intType = oModelsProperties.GetType(intModel); string strExecute = oType.Get(intType, "forecast_execution_path"); int intCount = 0; DataSet dsWizard = oOnDemand.GetWizardStepsDoneBack(intID); foreach (DataRow drWizard in dsWizard.Tables[0].Rows) { intCount++; if (intCount != dsWizard.Tables[0].Rows.Count) { oOnDemand.DeleteWizardStepDone(intID, Int32.Parse(drWizard["step"].ToString())); } } if (chkConfig_Reset.Checked == true) { oForecast.UpdateAnswer(intID, "", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } if (chkConfig_Device.Checked == true) { foreach (DataRow drServer in dsServers.Tables[0].Rows) { int intServer = Int32.Parse(drServer["id"].ToString()); int intCluster = Int32.Parse(drServer["clusterid"].ToString()); oCluster.Delete(intCluster, intID); oServer.Delete(intServer); } } if (chkConfig_Storage.Checked == true) { oStorage.DeleteLuns(intID); } } if (chkUnlock.Checked == true) { if (chkUnlock_80.Checked == true) { if (oForecast.GetAnswer(intID, "override") == "-1") { // Send Email to iARB stating that they do not have to approve the design string[] strEmail; char[] strSplit = { ';' }; strEmail = strIARB.Split(strSplit); for (int ii = 0; ii < strEmail.Length; ii++) { if (strEmail[ii].Trim() != "") { string strAddress = strEmail[ii]; string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DESIGN_BUILDER"); oFunction.SendEmail("Review Board Approval UNLOCKED", strAddress, "", strEMailIdsBCC, "Review Board Approval UNLOCKED", "<p><b>An overridden design has been unlocked and no longer requires your approval.</b><p><p>" + oForecast.GetAnswerBody(intID, intEnvironment, dsnAsset, dsnIP) + "</p>", true, false); } } } oForecast.AddAnswerUnlock(intID, 0, "Reset by administrator at client's request"); oForecast.UpdateAnswerConfidence(intID, intConfidenceUnlock); } oForecast.DeleteReset(intID); oForecast.AddReset(intID, intRequestExecute); oForecast.UpdateAnswer(intID, 0); DataSet dsPending = oOnDemandTasks.GetPending(intID); if (dsPending.Tables[0].Rows.Count > 0) { int intResourceWorkflow = Int32.Parse(dsPending.Tables[0].Rows[0]["resourceid"].ToString()); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); int intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); oResourceRequest.UpdateItemAndService(intResourceParent, -1, -1); oResourceRequest.UpdateWorkflowName(intResourceWorkflow, "Auto-Provisioning Task [Reset]", 0); oOnDemandTasks.DeleteAll(intID); if (intImplementor > 0) { string strDefault = oUser.GetApplicationUrl(intImplementor, intViewPage); string strSpacerRow = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>"; string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DESIGN_BUILDER"); if (strDefault == "") { oFunction.SendEmail("RESET: ClearView Auto-Provisioning Reset", oUser.GetName(intImplementor), "", strEMailIdsBCC, "RESET: ClearView Auto-Provisioning Reset", "<p><b>An auto-provisioning request has been reset. This request no longer requires immediate attention.</b><p><p>" + oForecast.GetAnswerBody(intID, intEnvironment, dsnAsset, dsnIP) + "</p>", true, false); } else { oFunction.SendEmail("RESET: ClearView Auto-Provisioning Reset", oUser.GetName(intImplementor), "", strEMailIdsBCC, "RESET: ClearView Auto-Provisioning Reset", "<p><b>An auto-provisioning request has been reset. This request no longer requires immediate attention.</b><p><p>" + oForecast.GetAnswerBody(intID, intEnvironment, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review this project.</a></p>", true, false); } } } } } if (strError == "") { lblDone.Text = "<img src='/images/bigcheck.gif' border='0' align='absmiddle'/> <b>Finished!</b> ClearView reset the design"; } else { lblDone.Text = "<img src='/images/bigerror.gif' border='0' align='absmiddle'/> <b>Error!</b> " + strError; } } else if (dsDesign.Tables[0].Rows.Count > 0) { int intDesign = Int32.Parse(dsDesign.Tables[0].Rows[0]["id"].ToString()); oLog.AddEvent(intDesign, "", "", "Design " + intDesign.ToString() + " reset by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Information); oDesign.UpdateAnswerId(intDesign, 0); if (chkExitAP_Approvals.Checked == true) { oDesign.DeleteApproverFieldWorkflow(intDesign); oDesign.DeleteApproverGroupWorkflow(intDesign, 0); oDesign.DeleteApproverGroupWorkflow(intDesign, 1); oDesign.DeleteSoftwareComponents(intDesign, true); if (chkExitAP_Submissions.Checked == false) { // Reset back to original requestor. oDesign.Approve(intDesign, 0, (oDesign.Get(intDesign, "is_exception") == "1"), intEnvironment, intImplementorDistributedService, intWorkstationPlatform, intImplementorMidrangeService, dsnAsset, dsnIP, dsnServiceEditor, intAssignPage, intResourceRequestApprove, intViewPage); } } if (chkExitAP_Submissions.Checked == true) { oDesign.DeleteSubmitted(intDesign); } lblDone.Text = "<img src='/images/bigAlert.gif' border='0' align='absmiddle'/> <b>Done!</b> ClearView reset the new design builder"; } else { lblDone.Text = "<img src='/images/bigerror.gif' border='0' align='absmiddle'/> <b>Error!</b> ClearView could not find the design"; } }