Ejemplo n.º 1
0
        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>&nbsp;&nbsp;[" + 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");
        }