protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); oUser = new Users(intProfile, dsn); oWMServiceTasks = new WMServiceTasks(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oService = new Services(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oServiceDetail = new ServiceDetails(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oDataPoint = new DataPoint(intProfile, dsn); if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); } if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } if ( (Request.QueryString["requestid"] != null && Request.QueryString["requestid"] != "") && (Request.QueryString["serviceid"] != null && Request.QueryString["serviceid"] != "") && (Request.QueryString["itemid"] != null && Request.QueryString["itemid"] != "") && (Request.QueryString["number"] != null && Request.QueryString["number"] != "") && (Request.QueryString["assetid"] != null && Request.QueryString["assetid"] != "")) { hdnRequestId.Value = oFunction.decryptQueryString(Request.QueryString["requestid"]); hdnServiceId.Value = oFunction.decryptQueryString(Request.QueryString["serviceid"]); hdnItemId.Value = oFunction.decryptQueryString(Request.QueryString["itemid"]); hdnNumber.Value = oFunction.decryptQueryString(Request.QueryString["number"]); hdnAssetId.Value = oFunction.decryptQueryString(Request.QueryString["assetid"]); if (!IsPostBack) { LoadWMServiceTasks(); } btnSave.Attributes.Add("onclick", "return ProcessControlButton();"); btnSaveAndClose.Attributes.Add("onclick", "return ProcessControlButton();"); } else { pnlAllow.Visible = false; pnlDenied.Visible = true; } }
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); oStatusLevel = new StatusLevels(intProfile, dsn); oAsset = new Asset(0, dsnAsset, dsn); oAssetOrder = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment); oAssetSharedEnvOrder = new AssetSharedEnvOrder(intProfile, dsn, dsnAsset, intEnvironment); oWMServiceTasks = new WMServiceTasks(intProfile, dsn); oVariable = new Variables(intEnvironment); 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"] != "") { //Load Attributes if (!IsPostBack) { 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 Added Successfully');<" + "/" + "script>"); } oFunction.ConfigureToolButton(btnEmail, "/images/tool_email"); oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla"); btnDenied.Attributes.Add("onclick", "return CloseWindow();"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); //btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" + // ";"); btnAddDataStoreSelection.Attributes.Add("onclick", "return ValidateText('" + txtDataStoreName.ClientID + "','Please enter datastore')" + ";"); btnStatus.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" + ";"); imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');"); } LoadRequest(); } else { panDenied.Visible = true; } }
protected void btnComplete_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); string strInvalid = ""; if (panForm.Visible == true) { strInvalid = oServiceEditor.SaveForm(Request, intRequest, intService, intNumber, true, intEnvironment, dsn); } if (strInvalid == "") { // All Required Fields have been completed int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); if (oResourceRequest.Get(intResourceParent, "status") == ((int)ResourceRequestStatus.Closed).ToString() || oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == ((int)ResourceRequestStatus.Closed).ToString()) { // already completed - nothing to do except close the window. } else { if (panNoSlider.Visible == true) { double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); oResourceRequest.UpdateWorkflowHoursOverwrite(intResourceWorkflow, dblAllocated); } // 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, (int)ResourceRequestStatus.Closed, "Completed", intProfile); } oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, (int)ResourceRequestStatus.Closed, true); string strCVT = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(); oLog.AddEvent(intRequest.ToString(), strCVT, "Closed WM_Generic by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Debug); oResourceRequest.CloseWorkflow(intResourceWorkflow, intEnvironment, 0, dsnServiceEditor, true, intResourceRequestApprove, intAssignPage, intViewPage, dsnAsset, dsnIP, boolServiceReturned); // Send notification to list of completion users string strCompletion = oService.Get(intService, "notify_complete"); if (strCompletion != "") { string strLink = "<a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResourceParent.ToString()) + "\" target=\"_blank\">Click here to view this request.</a>"; oFunction.SendEmail("Service Request #CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + " Complete", strCompletion, "", "", "Service Request #CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + " Complete", "<p>This message is to notify you that the following service request has been completed...</p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>You are receiving this message because you have been configured to receive a notification for all completed requests for the service <b>" + oService.GetName(intService) + "</b><p>" + strLink + "</p>", true, false); } //Send notification to users of associated tasks WMServiceTasks oWMServiceTasks = new WMServiceTasks(intProfile, dsn); DataSet DsWMAssociatedTasks = oWMServiceTasks.getWMServiceTasksStatusRequestWithRequest(intRequest); Customized oCustomized = new Customized(intProfile, dsn); if (DsWMAssociatedTasks.Tables[0].Rows.Count > 0) { foreach (DataRow drWMAssoicatedTasks in DsWMAssociatedTasks.Tables[0].Rows) { string strWMAssoicatedTasksUser = oUser.GetName(Int32.Parse(drWMAssoicatedTasks["createdBy"].ToString())); string strComment = ""; string strLink = "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResourceParent.ToString()) + "\" target=\"_blank\">Click here to view this request.</a></p>"; oFunction.SendEmail("Associated Request Completed CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(), strWMAssoicatedTasksUser, "", "", "Associated Request Completed CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(), "<p><b>The following associated service request has been completed!</b></br>" + strComment + "</p>" + strLink + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } } //End of Send notification to users of associated tasks if (intService == Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_DECOMMISSION_SUPPORT"]) || intService == Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_DESTROY_SUPPORT"]) || intService == Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_DECOMMISSION_SUPPORT_WORKSTATION"]) || intService == Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_DESTROY_SUPPORT_WORKSTATION"])) { Asset oAsset = new Asset(0, dsnAsset); oAsset.UpdateDecommissionFixed(intRequest, intNumber); } //If this service was returned then update the status of next service if (boolServiceReturned == true) { DataSet dsRR = oResourceRequest.GetRequestService(intRequest, intService, intNumber); if (dsRR.Tables[0].Rows.Count > 0) { int intRRId = Int32.Parse(dsRR.Tables[0].Rows[0]["parent"].ToString()); DataSet dsRRReturn = oResourceRequest.getResourceRequestReturn(intRRId, intService, intNumber, 1, 0); if (dsRRReturn.Tables[0].Rows.Count > 0) { int intNextRRId = Int32.Parse(dsRRReturn.Tables[0].Rows[0]["NextRRId"].ToString()); int intNextServiceId = Int32.Parse(dsRRReturn.Tables[0].Rows[0]["NextServiceId"].ToString()); int intNextNumber = Int32.Parse(dsRRReturn.Tables[0].Rows[0]["NextNumber"].ToString());; // Get all at that level to resume DataSet dsWorkflow = oServiceEditor.GetWorkflow(intRequest); // Get leveling int intLevel = 0; foreach (DataRow drWorkflow in dsWorkflow.Tables[0].Rows) { if (Int32.Parse(drWorkflow["serviceid"].ToString()) == intNextServiceId) { intLevel = Int32.Parse(drWorkflow["leveling"].ToString()); break; } } foreach (DataRow drWorkflow in dsWorkflow.Tables[0].Rows) { if (Int32.Parse(drWorkflow["leveling"].ToString()) == intLevel) { string strService = oService.GetName(Int32.Parse(drWorkflow["ServiceID"].ToString())); int intResourceRequestID = 0; if (Int32.TryParse(drWorkflow["ResourceID"].ToString(), out intResourceRequestID)) { oResourceRequest.UpdateStatusRequest(intResourceRequestID, 2); DataSet dsRRWF = oResourceRequest.GetWorkflowsParent(intResourceRequestID); foreach (DataRow dr in dsRRWF.Tables[0].Rows) { int intRRWFId = Int32.Parse(dr["id"].ToString()); int intRRWFUserId = Int32.Parse(dr["userid"].ToString()); oResourceRequest.UpdateWorkflowStatus(intRRWFId, 2, true); // Notify string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); string strDefault = oUser.GetApplicationUrl(intRRWFUserId, intViewPage); if (strDefault == "") { oFunction.SendEmail("Returned Request Completed: " + strService, oUser.GetName(intRRWFUserId), "", strEMailIdsBCC, "Returned Request Completed: " + strService, "<p><b>The following returned request has been completed by " + oUser.GetFullName(intProfile) + " and is now in your queue.</b></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } else { if (intProject > 0) { oFunction.SendEmail("Returned Request Completed: " + strService, oUser.GetName(intRRWFUserId), "", strEMailIdsBCC, "Returned Request Completed: " + strService, "<p><b>The following returned request has been completed by " + oUser.GetFullName(intProfile) + " and is now in your queue.</b></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your assignment.</a></p>", true, false); } else { oFunction.SendEmail("Returned Request Completed: " + strService, oUser.GetName(intRRWFUserId), "", strEMailIdsBCC, "Returned Request Completed: " + strService, "<p><b>The following returned request has been completed by " + oUser.GetFullName(intProfile) + " and is now in your queue.</b></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your assignment.</a></p>", true, false); } } } } } } //oResourceRequest.UpdateStatusRequest(intNextRRId, 2); //DataSet dsRRWF = oResourceRequest.GetWorkflowsParent(intNextRRId); //foreach (DataRow dr in dsRRWF.Tables[0].Rows) //{ // int intRRWFId = Int32.Parse(dr["id"].ToString()); // oResourceRequest.UpdateWorkflowStatus(intRRWFId, 2, true); //} } } oResourceRequest.updateResourceRequestReturnCompleted(Int32.Parse(lblReqReturnedId.Text)); } } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>"); } else { Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&div=E&require=true&required=" + oFunction.encryptQueryString(strInvalid)); } }
protected void btnStatus_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); int intStatusLatest = 0; DataSet dsLatest = oResourceRequest.GetStatusLatest(intResourceWorkflow); if (dsLatest.Tables[0].Rows.Count > 0) { Int32.TryParse(dsLatest.Tables[0].Rows[0]["status"].ToString(), out intStatusLatest); } int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); if (ddlStatus.SelectedIndex > -1 && txtComments.Text.Trim() != "") { oResourceRequest.AddStatus(intResourceWorkflow, Int32.Parse(ddlStatus.SelectedItem.Value), txtComments.Text, intProfile); string strNotifyClient = ""; //CVT62149 Workload Manager Red Light Status =Hold if (ddlStatus.SelectedValue == "1") // Red { oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 5, true); strNotifyClient = (oService.Get(intService, "notify_red") == "1" ? "On Hold" : ""); } else { oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 2, true); if (ddlStatus.SelectedValue == "2") // Yellow { strNotifyClient = (oService.Get(intService, "notify_yellow") == "1" ? "Alert" : ""); } else { strNotifyClient = ((intStatusLatest == 1 || intStatusLatest == 2) && oService.Get(intService, "notify_green") == "1" ? "Resume" : ""); } } if (strNotifyClient != "") { // Notify the client of the status change. int intRequestor = oRequest.GetUser(intRequest); string strComment = txtComments.Text.Trim(); if (strComment != "") { string strBodyComment = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\" border=\"0\" align=\"center\" style=\"border:solid 1px #CCCCCC;" + oVariable.DefaultFontStyle() + "\">"; strBodyComment += "<tr bgcolor=\"#EEEEEE\"><td><span style=\"" + oVariable.DefaultFontStyleHeader() + "\">" + oUser.GetFullName(intProfile) + "</span> [" + DateTime.Now.ToString() + "]:</td></tr>"; strBodyComment += "<tr><td>" + oFunction.FormatText(strComment) + "</td></tr>"; strBodyComment += "</table>"; strComment = strBodyComment; } string strLink = "<a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResourceParent.ToString()) + "\" target=\"_blank\">Click here to view this request.</a>"; string strHeading = "Great news! All previous issues have been resolved and the progression of this task has resumed."; if (strNotifyClient == "On Hold") { strHeading = "An issue has been encountered that is preventing this task from being completed. The request has been placed <b>ON HOLD</b>."; } else if (strNotifyClient == "Alert") { strHeading = "Minor issues have been encountered that are slowing down the progression of this task. Although still being processed, the service level agreement (SLA) may be exceeded."; } oFunction.SendEmail("Service Request #CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + " Notification", oUser.GetName(intRequestor), "", oUser.GetName(intProfile), "Service Request #CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + " Notification *" + strNotifyClient + "*", "<p>" + strHeading + "</p><p>" + strComment + "</p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>" + strLink + "</p>", true, false); } //Send notification to users of associated tasks WMServiceTasks oWMServiceTasks = new WMServiceTasks(intProfile, dsn); DataSet DsWMAssociatedTasks = oWMServiceTasks.getWMServiceTasksStatusRequestWithRequest(intRequest); Customized oCustomized = new Customized(intProfile, dsn); if (DsWMAssociatedTasks.Tables[0].Rows.Count > 0) { foreach (DataRow drWMAssoicatedTasks in DsWMAssociatedTasks.Tables[0].Rows) { string strWMAssoicatedTasksUser = oUser.GetName(Int32.Parse(drWMAssoicatedTasks["createdBy"].ToString())); string strComment = txtComments.Text.Trim(); string strLink = "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResourceParent.ToString()) + "\" target=\"_blank\">Click here to view this request.</a></p>"; oFunction.SendEmail("Associated Request Updated CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(), strWMAssoicatedTasksUser, "", "", "Associated Request Updated CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(), "<p><b>The following associated service request has been updated with following comments...</b></br>" + strComment + "</p>" + strLink + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } } //End of Send notification to users of associated tasks } Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&div=S&status=true"); }