protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            int intResourceParent = Int32.Parse(lblResourceParent.Text);

            ds = oResourceRequest.Get(intResourceParent);
            if (ds.Tables[0].Rows.Count > 0)
            {
                int    intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                int    intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                int    intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                int    intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                string strCVT     = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                string strService = oService.GetName(intService);
                if (intService == 0)
                {
                    strService = oRequestItem.GetItemName(intItem);
                }
                int             intApp           = oRequestItem.GetItemApplication(intItem);
                int             intProject       = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                Projects        oProject         = new Projects(intProfile, dsn);
                ProjectsPending oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment);
                Variables       oVariable        = new Variables(intEnvironment);
                RequestFields   oRequestField    = new RequestFields(intProfile, dsn);
                int             intRequester     = Int32.Parse(oRequest.Get(intRequest, "userid"));
                int             intPC            = 0;
                int             intIE            = 0;
                if (intProject > 0)
                {
                    if (oProject.Get(intProject, "lead") != "")
                    {
                        intPC = Int32.Parse(oProject.Get(intProject, "lead"));
                    }
                    if (oProject.Get(intProject, "engineer") != "")
                    {
                        intIE = Int32.Parse(oProject.Get(intProject, "engineer"));
                    }
                }
                else
                {
                    try
                    {
                        intPC = Int32.Parse(oProjectsPending.GetRequest(intRequest, "lead"));
                        intIE = Int32.Parse(oProjectsPending.GetRequest(intRequest, "engineer"));
                    }
                    catch { }
                }
                string strCC = "";
                if (intPC > 0)
                {
                    strCC += oUser.GetName(intPC) + ";";
                }
                if (intIE > 0)
                {
                    strCC += oUser.GetName(intIE) + ";";
                }
                int intEnhancement = 0;
                if (panEnhancement.Visible)
                {
                    DataSet dsEnhancement = oEnhancement.GetRequest(intRequest);
                    if (dsEnhancement.Tables[0].Rows.Count == 1)
                    {
                        intEnhancement = Int32.Parse(dsEnhancement.Tables[0].Rows[0]["id"].ToString());
                    }
                }
                if (radReject.Checked == true || (panEnhancement.Visible && radEnhancementReject.Checked))
                {
                    string strComments = txtEnhancementReject.Text.Trim();
                    if (strComments == "" && txtReject.Text.Trim() != "")
                    {
                        strComments = "<p>The following comments were added:<br/>" + oFunction.FormatText(txtReject.Text) + "</p>";
                    }
                    string strDefault     = oUser.GetApplicationUrl(intRequester, intAssignPage);
                    string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS");
                    if (strDefault == "" || oApplication.Get(intApp, "tpm") != "1")
                    {
                        oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p>The following request has been rejected by <b>" + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments, true, false);
                    }
                    else
                    {
                        oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p>The following request has been rejected by <b>" + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments + "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intAssignPage) + "?rrid=" + intResourceParent.ToString() + "\" target=\"_blank\">Click here to assign a new project manager to your request.</a></p>", true, false);
                    }
                    oResourceRequest.UpdateAccepted(intResourceParent, -1);
                    oResourceRequest.UpdateReason(intResourceParent, txtReject.Text);
                    if (panEnhancement.Visible)
                    {
                        oResourceRequest.UpdateStatusOverall(intResourceParent, (int)EnhancementStatus.Denied);
                        oResourceRequest.UpdateReason(intResourceParent, txtEnhancementReject.Text);
                        oEnhancement.AddLog(intEnhancement, 0, "Rejected", intProfile, "");
                    }
                }
                else if (radHold.Checked == true)
                {
                    oResourceRequest.UpdateStatusOverall(intResourceParent, 5);
                    oResourceRequest.UpdateReason(intResourceParent, txtHold.Text);
                }
                else
                {
                    if (panEnhancement.Visible && radEnhancementLong.Checked)
                    {
                        oResourceRequest.UpdateStatusOverall(intResourceParent, (int)EnhancementStatus.AwaitingLongDocument);
                        oEnhancement.AddLog(intEnhancement, 0, "Sent Back to Client for Additonal Requirements", intProfile, "");
                    }
                    else if (panEnhancement.Visible && radEnhancementDuplicate.Checked)
                    {
                        oResourceRequest.UpdateStatusOverall(intResourceParent, (int)EnhancementStatus.Duplicate);
                        oEnhancement.AddLog(intEnhancement, 0, "Duplicate", intProfile, "");
                    }
                    else
                    {
                        if (oResourceRequest.Get(intResourceParent, "assigned") == "") // hasn't already been assigned.
                        {
                            string strComments = "";
                            if (txtComments.Text != "")
                            {
                                strComments = "<p>The following comments were added:<br/>" + oFunction.FormatText(txtComments.Text) + "</p>";
                            }

                            if (panEnhancement.Visible)
                            {
                                oEnhancement.UpdateModuleID(intResourceParent, Int32.Parse(ddlModule.SelectedItem.Value));
                                oEnhancement.AddLog(intEnhancement, 0, "Assigned", intProfile, "");
                            }
                            bool boolSolo     = (oResourceRequest.Get(intResourceParent, "solo") == "1");
                            int  intAssigned  = 0;
                            bool boolRejected = (oResourceRequest.Get(intResourceParent, "accepted") == "-1");
                            if (boolRejected == true)
                            {
                                oResourceRequest.UpdateRejected(intResourceParent, 1);
                                intAssigned = Int32.Parse(Request.Form[hdnManager.UniqueID]);
                            }
                            else
                            {
                                intAssigned = Int32.Parse(ddlUser.SelectedItem.Value);
                                oResourceRequest.UpdateAccepted(intResourceParent, 1);
                            }
                            # region "Send Service Center Notification"
                            // intAssigned = USERID
                            //if (intService = Configuration.AppSettings["DECOMMISSION_SERVER_NEW"]
                            //     get serverid from cv_WM_server_decommission based on requestid, itemid, number
                            //     generate SC email with attachment in HTML format with "Assign TO: USER" at the top (only for non-vmware)

                            //int intServerDecommServiceID = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_SERVER_DECOMMISSION"]);
                            //if (intService == intServerDecommServiceID)
                            //{
                            //    SendServiceCenterNotification(intRequest, intItem, intNumber, intAssigned);
                            //}
                            #endregion

                            oProject.Update(intProject, 2);
                            int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, oResourceRequest.Get(intResourceParent, "name"), intAssigned, Int32.Parse(txtQuantity.Text), double.Parse(txtHours.Text), 2, 0);
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug);
                            oResourceRequest.UpdateComments(intResourceParent, txtComments.Text);
                            oResourceRequest.UpdateAssignedBy(intResourceParent, intProfile);
                            ProjectRequest oProjectRequest = new ProjectRequest(intProfile, dsn);
                            string         strDefault      = oUser.GetApplicationUrl(intAssigned, intViewPage);
                            string         strNotify       = "";
                            string         strSpacerRow    = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>";
                            if (txtHours.Enabled == true)
                            {
                                oResourceRequest.UpdateDevices(intResourceParent, Int32.Parse(txtQuantity.Text), double.Parse(txtHours.Text));
                            }
                            if (boolSolo == true)
                            {
                                oResourceRequest.UpdateStatusOverall(intResourceParent, 2);
                                if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "")
                                {
                                    oProject.Update(intProject, oProjectNumber.New());
                                }
                                if (intItem != intImplementorDistributed && intItem != intImplementorMidrange)
                                {
                                    string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                                    //if (oProject.Get(intProject, "number").StartsWith("CV") == false)
                                    //    strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>";
                                    if (strDefault == "")
                                    {
                                        oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                                    }
                                    else
                                    {
                                        if (intProject > 0)
                                        {
                                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<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 new assignment.</a></p>", true, false);
                                        }
                                        else
                                        {
                                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<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 new assignment.</a></p>", true, false);
                                        }
                                    }
                                    string strActivity = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                                    strActivity += strSpacerRow;
                                    strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + strService + "</td></tr>";
                                    strActivity  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                                    string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                                    if (strDeliverable.Trim() != "")
                                    {
                                        strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                                    }
                                    if (oService.Get(intService, "notify_client") != "0")
                                    {
                                        oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>A resource has been assigned to the following request...</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                                    }
                                }
                            }
                            else
                            {
                                // ADD PM
                                string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                                if (strDefault == "")
                                {
                                    oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p>", true, false);
                                }
                                else
                                {
                                    if (intProject > 0)
                                    {
                                        oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false);
                                    }
                                    else
                                    {
                                        oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false);
                                    }
                                }
                                string strExecutive = oProject.Get(intProject, "executive");
                                string strWorking   = oProject.Get(intProject, "working");
                                string strActivity  = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                                strActivity += strSpacerRow;
                                strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>Project Coordinator</td></tr>";
                                strActivity  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                                string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                                if (strDeliverable.Trim() != "")
                                {
                                    strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                                }
                                if (oService.Get(intService, "notify_client") != "0")
                                {
                                    oFunction.SendEmail("Request Assignment", oUser.GetName(intRequester), strExecutive + ";" + strWorking + ";" + strCC, strEMailIdsBCC, "Request Assignment", "<p><b>A resource has been assigned to the following project...</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                                }
                            }
                        }
                    }
                }
            }
Beispiel #2
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            int intResourceParent = Int32.Parse(lblResourceParent.Text);

            ds = oResourceRequest.Get(intResourceParent);
            if (ds.Tables[0].Rows.Count > 0)
            {
                int    intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                int    intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                int    intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                int    intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                string strCVT     = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                string strService = oService.GetName(intService);
                if (intService == 0)
                {
                    strService = oRequestItem.GetItemName(intItem);
                }
                int             intApp           = oRequestItem.GetItemApplication(intItem);
                int             intProject       = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                Projects        oProject         = new Projects(intProfile, dsn);
                ProjectsPending oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment);
                Functions       oFunction        = new Functions(intProfile, dsn, intEnvironment);
                Variables       oVariable        = new Variables(intEnvironment);
                RequestFields   oRequestField    = new RequestFields(intProfile, dsn);
                int             intRequester     = Int32.Parse(oRequest.Get(intRequest, "userid"));
                int             intPC            = 0;
                int             intIE            = 0;
                if (intProject > 0)
                {
                    if (oProject.Get(intProject, "lead") != "")
                    {
                        intPC = Int32.Parse(oProject.Get(intProject, "lead"));
                    }
                    if (oProject.Get(intProject, "engineer") != "")
                    {
                        intIE = Int32.Parse(oProject.Get(intProject, "engineer"));
                    }
                }
                else
                {
                    try
                    {
                        intPC = Int32.Parse(oProjectsPending.GetRequest(intRequest, "lead"));
                        intIE = Int32.Parse(oProjectsPending.GetRequest(intRequest, "engineer"));
                    }
                    catch { }
                }
                string strCC = "";
                if (intPC > 0)
                {
                    strCC += oUser.GetName(intPC) + ";";
                }
                if (intIE > 0)
                {
                    strCC += oUser.GetName(intIE) + ";";
                }
                if (radReject.Checked == true)
                {
                    string strComments = "";
                    if (txtComments.Text.Trim() != "")
                    {
                        strComments = "<p>The following comments were added:<br/>" + txtComments.Text + "</p>";
                    }
                    string strDefault = oUser.GetApplicationUrl(intRequester, intAssignPage);
                    strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS");
                    if (strDefault == "" || oApplication.Get(intApp, "tpm") != "1")
                    {
                        oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p><b>The following request has been rejected by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments, true, false);
                    }
                    else
                    {
                        oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p><b>The following request has been rejected by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments + "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intAssignPage) + "?rrid=" + intResourceParent.ToString() + "\" target=\"_blank\">Click here to assign a new project manager to your request.</a></p>", true, false);
                    }
                    oResourceRequest.UpdateAccepted(intResourceParent, -1);
                    oResourceRequest.UpdateReason(intResourceParent, txtComments.Text);
                }
                else if (radHold.Checked == true)
                {
                    oResourceRequest.UpdateStatusOverall(intResourceParent, 5);
                    oResourceRequest.UpdateReason(intResourceParent, txtHold.Text);
                }
                else
                {
                    if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "")
                    {
                        oProject.Update(intProject, oProjectNumber.New());
                    }
                    oProject.Update(intProject, 2);
                    bool           boolSolo        = (oResourceRequest.Get(intResourceParent, "solo") == "1");
                    int            intAssigned     = 0;
                    bool           boolRejected    = (oResourceRequest.Get(intResourceParent, "accepted") == "-1");
                    ProjectRequest oProjectRequest = new ProjectRequest(intProfile, dsn);
                    string         strNotify       = "";
                    string         strSpacerRow    = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>";
                    if (boolRejected == true)
                    {
                        oResourceRequest.UpdateRejected(intResourceParent, 1);
                        intAssigned = Int32.Parse(Request.Form[hdnManager.UniqueID]);
                        int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, oResourceRequest.Get(intResourceParent, "name"), intAssigned, Int32.Parse(txtQuantity.Text), double.Parse(txtHours.Text), 2, 0);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug);
                        string strDefault = oUser.GetApplicationUrl(intAssigned, intViewPage);
                        if (boolSolo == false)
                        {
                            strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                            // ADD PM
                            if (strDefault == "")
                            {
                                oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p>", true, false);
                            }
                            else
                            {
                                if (intProject > 0)
                                {
                                    oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false);
                                }
                                else
                                {
                                    oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false);
                                }
                            }
                            string strExecutive = oProject.Get(intProject, "executive");
                            string strWorking   = oProject.Get(intProject, "working");
                            string strActivity  = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                            strActivity += strSpacerRow;
                            strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>Project Coordinator</td></tr>";
                            strActivity  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                            string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                            if (strDeliverable.Trim() != "")
                            {
                                strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                            }
                            if (oService.Get(intService, "notify_client") != "0")
                            {
                                strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                                oFunction.SendEmail("Request Assignment", oUser.GetName(intRequester), strExecutive + ";" + strWorking + ";" + strCC, strEMailIdsBCC, "Request Assignment", "<p><b>A resource has been assigned to the following project...</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                            }
                        }
                        else
                        {
                            strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ERROR");
                            oFunction.SendEmail("ERROR: Request Assignment", strEMailIdsBCC, "", "", "ERROR: Request Assignment", "<p><b>A REJECTED resource request with a SOLO status of 1 has been assigned to " + oUser.GetName(intAssigned) + "...</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p>", true, false);
                        }
                    }
                    else
                    {
                        oResourceRequest.UpdateAccepted(intResourceParent, 1);
                        if (boolSolo == true)
                        {
                            string  strResources = "";
                            DataSet dsAssigned   = oResourceRequest.GetWorkflowsAssign(intResourceParent);
                            foreach (DataRow drAssigned in dsAssigned.Tables[0].Rows)
                            {
                                intAssigned = Int32.Parse(drAssigned["userid"].ToString());
                                int    intQuantity         = Int32.Parse(drAssigned["devices"].ToString());
                                double dblHours            = double.Parse(drAssigned["allocated"].ToString());
                                int    intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, oResourceRequest.Get(intResourceParent, "name"), intAssigned, intQuantity, dblHours, 2, 0);
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug);
                                oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 2, true);
                                if (intItem != intImplementorDistributed && intItem != intImplementorMidrange)
                                {
                                    //if (oProject.Get(intProject, "number").StartsWith("CV") == false)
                                    //    strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>";
                                    string strDefault = oUser.GetApplicationUrl(intAssigned, intViewPage);
                                    strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                                    if (strDefault == "")
                                    {
                                        oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                                    }
                                    else
                                    {
                                        if (intProject > 0)
                                        {
                                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</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 new assignment.</a></p>", true, false);
                                        }
                                        else
                                        {
                                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</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 new assignment.</a></p>", true, false);
                                        }
                                    }
                                    if (strResources != "")
                                    {
                                        strResources += ", ";
                                    }
                                    strResources += oUser.GetFullName(intAssigned);
                                }
                            }
                            string strActivity = "<tr><td><b>Resource(s):</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + strResources + "</td></tr>";
                            strActivity += strSpacerRow;
                            strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + strService + "</td></tr>";
                            strActivity  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                            string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                            strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                            if (strDeliverable.Trim() != "")
                            {
                                strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                            }
                            if (oService.Get(intService, "notify_client") != "0")
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned...</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                            }
                        }
                        else
                        {
                            strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ERROR");
                            oFunction.SendEmail("ERROR: Request Assignment", strEMailIdsBCC, "", "", "ERROR: Request Assignment", "<p><b>An ACCEPTED resource request with a SOLO status of 0 has been assigned... RRID = " + intResourceParent.ToString() + "</b></p>", true, false);
                        }
                    }
                    oResourceRequest.UpdateStatusOverall(intResourceParent, 2);
                    oResourceRequest.UpdateAssignedBy(intResourceParent, intProfile);
                }
            }
            Response.Redirect(oPage.GetFullLink(intPage) + "?action=finish");
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            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);
            }
            oDataPoint       = new DataPoint(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oStatusLevel     = new StatusLevels();
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "SERVICE") == true || intDataPointAvailableService == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["clear"] != null)
                {
                    panClear.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                }
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    string strID = oFunction.decryptQueryString(Request.QueryString["id"]);
                    intResource = Int32.Parse(strID);
                    DataSet ds = oDataPoint.GetServiceRequestResource(intResource);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information

                        //string strHeader = intResource.ToString();
                        string strHeader = ds.Tables[0].Rows[0]["requestid"].ToString()
                                           + "-" + (ds.Tables[0].Rows[0]["ServiceId"] != DBNull.Value?ds.Tables[0].Rows[0]["ServiceId"].ToString():"0")
                                           + "-" + (ds.Tables[0].Rows[0]["number"] != DBNull.Value ? ds.Tables[0].Rows[0]["number"].ToString() : "0");

                        lblRequestID.Text    = strHeader;
                        lblRequestID.ToolTip = "Resource Request :" + intResource.ToString();

                        lblHeader.Text    = "&quot;" + strHeader + "&quot;";
                        Master.Page.Title = "DataPoint | Request (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about a resource request...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);

                        oTab.AddTab("Submitted Information", "");
                        oTab.AddTab("Workflow / History", "");
                        oTab.AddTab("Resource(s) Involvement", "");
                        if (oUser.IsAdmin(intProfile) == true)
                        {
                            trAdmin.Visible = true;
                            Variables oVariable = new Variables(intEnvironment);
                            txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divUser.ClientID + "','" + lstUser.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                            lstUser.Attributes.Add("ondblclick", "AJAXClickRow();");
                            oTab.AddTab("Resource Detail", "");
                            divDetail.Visible = true;
                        }

                        if (!IsPostBack)
                        {
                            strOriginal = oResourceRequest.GetSummary(intResource, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP);

                            bool boolDeleted = (ds.Tables[0].Rows[0]["deleted"].ToString() != "0");
                            panDeleted.Visible = boolDeleted;
                            int intRequest   = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                            int intRequestor = oRequest.GetUser(intRequest);
                            strRequestor = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intRequestor.ToString() + "');\">" + oUser.GetFullName(intRequestor) + " [" + oUser.GetName(intRequestor) + "]</a>";
                            int intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                            int intApp     = oRequestItem.GetItemApplication(intItem);
                            int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                            int intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                            // General Information
                            oDataPoint.LoadTextBox(txtRequest, intProfile, null, "/datapoint/service/request.aspx?t=id&q=" + oFunction.encryptQueryString("CVT" + intRequest.ToString()) + "&id=" + oFunction.encryptQueryString(intRequest.ToString()), lblRequest, fldRequest, "RESOURCE_REQUEST", "CVT" + ds.Tables[0].Rows[0]["requestid"].ToString(), "", true, false);
                            oDataPoint.LoadTextBox(txtCreated, intProfile, null, "", lblCreated, fldCreated, "RESOURCE_CREATED", ds.Tables[0].Rows[0]["created"].ToString(), "", true, false);
                            oDataPoint.LoadTextBox(txtDepartment, intProfile, null, "", lblDepartment, fldDepartment, "RESOURCE_DEPARTMENT", ds.Tables[0].Rows[0]["department"].ToString(), "", true, false);
                            oDataPoint.LoadTextBox(txtService, intProfile, null, "", lblService, fldService, "RESOURCE_SERVICE", oService.GetName(intService), "", true, false);
                            string  strOwner = "";
                            DataSet dsOwner  = oService.GetUser(intService, -1); // Service Owners
                            foreach (DataRow drOwner in dsOwner.Tables[0].Rows)
                            {
                                if (strOwner != "")
                                {
                                    strOwner += ", ";
                                }
                                int intOwner = Int32.Parse(drOwner["userid"].ToString());
                                strOwner += "<span class=\"required\">*</span> <a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intOwner.ToString() + "');\">" + oUser.GetFullName(intOwner) + " [" + oUser.GetName(intOwner) + "]</a>";
                            }
                            //strOwner = "<b>" + strOwner + "</b>";
                            DataSet dsManager = oService.GetUser(intService, 1);  // Managers
                            foreach (DataRow drManager in dsManager.Tables[0].Rows)
                            {
                                if (strOwner != "")
                                {
                                    strOwner += ", ";
                                }
                                int intManager = Int32.Parse(drManager["userid"].ToString());
                                strOwner += "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]</a>";
                            }
                            oDataPoint.LoadTextBox(txtOwner, intProfile, null, "", lblOwner, fldOwner, "RESOURCE_OWNER", strOwner, "", true, false);
                            oDataPoint.LoadTextBox(txtName, intProfile, null, "", lblName, fldName, "RESOURCE_NAME", ds.Tables[0].Rows[0]["name"].ToString(), "", false, true);
                            oDataPoint.LoadTextBox(txtDevices, intProfile, null, "", lblDevices, fldDevices, "RESOURCE_DEVICES", ds.Tables[0].Rows[0]["devices"].ToString(), "", false, true);
                            oDataPoint.LoadTextBox(txtAllocated, intProfile, null, "", lblAllocated, fldAllocated, "RESOURCE_ALLOCATED", ds.Tables[0].Rows[0]["allocated"].ToString(), "", false, true);
                            if (txtDevices.Visible == true && oService.Get(intService, "disable_hours") != "1")
                            {
                                txtAllocated.Enabled = false;
                                txtAllocated.ToolTip = intService.ToString();
                                panDynamic.Visible   = true;
                            }
                            int intAccepted = Int32.Parse(ds.Tables[0].Rows[0]["accepted"].ToString());
                            oDataPoint.LoadDropDown(ddlAccepted, intProfile, null, "", lblAccepted, fldAccepted, "REQUEST_ACCEPTED", "name", "id", SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT -1 AS id, 'No' AS name UNION ALL SELECT 0 AS id, 'Pending' AS name UNION ALL SELECT 1 AS id, 'Yes' AS name"), intAccepted, false, false, true);
                            oDataPoint.LoadDropDown(ddlStatus, intProfile, null, "", lblStatus, fldStatus, "REQUEST_STATUS", "name", "id", SqlHelper.ExecuteDataset(dsn, CommandType.Text, oStatusLevel.List()), Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()), false, false, true);
                            oDataPoint.LoadTextBox(txtReason, intProfile, null, "", lblReason, fldReason, "RESOURCE_REASON", ds.Tables[0].Rows[0]["reason"].ToString(), "", false, false);
                            int intAssigned = Int32.Parse(ds.Tables[0].Rows[0]["assignedby"].ToString());
                            oDataPoint.LoadDropDownAJAX(txtAssignedBy, hdnAssignedBy, divAssignedBy, lstAssignedBy, intEnvironment, intProfile, null, "", lblAssignedBy, fldAssignedBy, "RESOURCE_ASSIGNED", intAssigned, (intAssigned > 0 ? oUser.GetFullName(intAssigned) + " (" + oUser.GetName(intAssigned) + ")" : ""), "/frame/users.aspx", "", false, false);
                            oDataPoint.LoadTextBox(txtAssignedOn, intProfile, null, "", lblAssignedOn, fldAssignedOn, "RESOURCE_ASSIGNED", ds.Tables[0].Rows[0]["assigned"].ToString(), "", true, false);
                            btnAssign.Visible = oUser.IsAdmin(intProfile);
                            btnAssign.Enabled = (intAssigned > 0);

                            ucWorkflow.RequestID = intRequest;
                            ucWorkflow.ServiceID = intService;
                            ucWorkflow.Number    = intNumber;

                            ucResourceInvolvement.ResourceRequestId = intResource;
                            //if (ds.Tables[1].Rows.Count > 0)
                            //{
                            //    // Resource Assignment(s)
                            //    if (ds.Tables[2].Rows.Count > 0)
                            //        ds.Relations.Add("relationship", ds.Tables[1].Columns["id"], ds.Tables[2].Columns["id"]);
                            //    rptAssignments.DataSource = ds.Tables[1];
                            //    rptAssignments.DataBind();
                            //    foreach (RepeaterItem ri in rptAssignments.Items)
                            //    {
                            //        Label lblStatusR = (Label)ri.FindControl("lblStatusR");
                            //        int intStatus = Int32.Parse(lblStatusR.Text);
                            //        lblStatusR.Text = oStatusLevel.HTML(intStatus);
                            //        Label lblProgress = (Label)ri.FindControl("lblProgress");
                            //        double dblProgress = double.Parse(lblProgress.Text);
                            //        if (intStatus == 3)
                            //            dblProgress = 100.00;
                            //        if (intStatus < 1 || intStatus > 2)
                            //            lblProgress.Text = "---";
                            //        else
                            //        {
                            //            try
                            //            {
                            //                lblProgress.Text = oServiceRequest.GetStatusBar(dblProgress, "100", "12", true);
                            //            }
                            //            catch
                            //            {
                            //                lblProgress.Text = oServiceRequest.GetStatusBar(0.00, "100", "12", true);
                            //            }
                            //        }

                            //        Panel panDelete = (Panel)ri.FindControl("panDelete");
                            //        if (panDelete.ToolTip == "1")
                            //            panDelete.Visible = true;
                            //        else
                            //        {
                            //            Panel panEdit = (Panel)ri.FindControl("panEdit");
                            //            panEdit.Visible = true;
                            //            Button btnLogin = (Button)ri.FindControl("btnLogin");
                            //            btnLogin.Attributes.Add("onclick", "return OpenNewWindowMenu('/frame/resource_request.aspx?rrid=" + btnLogin.CommandArgument + "', '800', '600');");
                            //            Button btnEdit = (Button)ri.FindControl("btnEdit");
                            //            if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile))
                            //                btnEdit.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/manager.aspx?id=" + btnEdit.CommandArgument + "', '800', '600');");
                            //            else
                            //                btnEdit.Enabled = false;
                            //            LinkButton btnMore = (LinkButton)ri.FindControl("btnMore");
                            //            btnMore.Attributes.Add("onclick", "ShowHideDiv2('div_" + btnMore.CommandArgument + "');return false;");
                            //            if (ds.Tables[2].Rows.Count > 0)
                            //                btnMore.Visible = true;
                            //        }
                            //    }
                            //}
                            //lblAssignments.Visible = (rptAssignments.Items.Count == 0);


                            // This should be the last tab to load
                            DataSet dsResults = oRequest.GetResult(intRequest, intItem, intNumber);
                            if (dsResults.Tables[0].Rows.Count > 0)
                            {
                                // Request Results
                                oTab.AddTab("Request Results", "");
                                divResults.Visible    = true;
                                rptResults.DataSource = dsResults;
                                rptResults.DataBind();
                            }
                            lblResults.Visible = (rptResults.Items.Count == 0);

                            strMenuTab1 = oTab.GetTabs();
                        }
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/service/datapoint_service_search.aspx");
                }
                btnAssign.Attributes.Add("onclick", "return confirm('Are you sure you want to put this request back in queue for assignment?');");
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation());
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation());
            }
            else
            {
                panDenied.Visible = true;
            }
        }
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            bool    boolSent = false;
            DataSet dsWF     = oResourceRequest.GetWorkflow(intResource);
            int     intTo    = 0;

            if (dsWF.Tables[0].Rows.Count > 0 && Int32.TryParse(Request.Form[hdnEmployee.UniqueID], out intTo) == true)
            {
                int     intParent = Int32.Parse(dsWF.Tables[0].Rows[0]["parent"].ToString());
                DataSet ds        = oResourceRequest.Get(intParent);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                    int intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                    oFunction.SendEmail("Service Request [CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + "]", oUser.GetName(intTo), "", oUser.GetName(intProfile), "Service Request [CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + "]", "<p>The following service request information has been sent to you by <b>" + oUser.GetFullName(intProfile) + "</b>.</p>" + (txtComments.Text == "" ? "" : "<p>" + txtComments.Text + "</p>") + "<p>" + oResourceRequest.GetSummary(intParent, intResource, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                    boolSent = true;
                }
            }

            if (boolSent)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">alert('An email was successfully sent.');window.parent.location.reload();window.close();<" + "/" + "script>");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">alert('There was a problem sending the email.');window.parent.location.reload();window.close();<" + "/" + "script>");
            }
        }
Beispiel #5
0
        public void NotifyTeamLead(int _itemid, int _rrid, int _assignpage, int _viewpage, int _environment, string _cc, string _se_dsn, string _dsn_asset, string _dsn_ip, int _userid_assigned)
        {
            RequestItems    oRequestItem     = new RequestItems(user, dsn);
            Users           oUser            = new Users(user, dsn);
            Applications    oApplication     = new Applications(user, dsn);
            Pages           oPage            = new Pages(user, dsn);
            Functions       oFunction        = new Functions(user, dsn, _environment);
            Variables       oVariable        = new Variables(_environment);
            Services        oService         = new Services(user, dsn);
            ResourceRequest oResourceRequest = new ResourceRequest(user, dsn);
            Log             oLog             = new Log(user, dsn);
            int             intService       = Int32.Parse(oResourceRequest.Get(_rrid, "serviceid"));
            string          strService       = oService.GetName(intService);

            if (intService == 0)
            {
                strService = oRequestItem.GetItemName(_itemid);
            }
            int      intApp         = oRequestItem.GetItemApplication(_itemid);
            int      intRequest     = Int32.Parse(oResourceRequest.Get(_rrid, "requestid"));
            int      intNumber      = Int32.Parse(oResourceRequest.Get(_rrid, "number"));
            Requests oRequest       = new Requests(user, dsn);
            int      intProject     = oRequest.GetProjectNumber(intRequest);
            Projects oProject       = new Projects(user, dsn);
            int      intRequester   = oRequest.GetUser(intRequest);
            string   strSpacerRow   = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>";
            string   strEmail       = oService.Get(intService, "email");
            string   strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
            string   strCVT         = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();

            int  intUser  = _userid_assigned;
            bool boolTech = false;

            if (intUser > 0)
            {
                boolTech = true;
                string strNotify = "";
                //if (oProject.Get(intProject, "number").StartsWith("CV") == false)
                //    strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>";
                // Add Workflow
                int intResourceWorkflow = oResourceRequest.AddWorkflow(_rrid, 0, oResourceRequest.Get(_rrid, "name"), intUser, Int32.Parse(oResourceRequest.Get(_rrid, "devices")), double.Parse(oResourceRequest.Get(_rrid, "allocated")), 2, 0);
                oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned to " + oUser.GetFullNameWithLanID(intUser) + " by the system", LoggingType.Debug);
                string strDefault = oUser.GetApplicationUrl(intUser, _viewpage);
                if (strDefault == "")
                {
                    oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intUser), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                }
                else
                {
                    if (intProject > 0)
                    {
                        oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intUser), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(_viewpage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                    }
                    else
                    {
                        oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intUser), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                    }
                }
                string strActivity = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intUser) + "</td></tr>";
                strActivity += strSpacerRow;
                strActivity += "<tr><td><b>Activity Type:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oRequestItem.GetItemName(_itemid) + "</td></tr>";
                strActivity  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                if (strDeliverable.Trim() != "")
                {
                    strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                }
                if (oService.Get(intService, "notify_client") != "0")
                {
                    oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intRequester), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>A resource has been assigned to the following request...</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                }
                oProject.Update(intProject, 2);
                oResourceRequest.UpdateAccepted(_rrid, 1);
                oResourceRequest.UpdateAssignedBy(_rrid, -1000);
            }
            else
            {
                DataSet dsTechnicians = oService.GetUser(intService, 0);
                foreach (DataRow drTechnician in dsTechnicians.Tables[0].Rows)
                {
                    boolTech = true;
                    intUser  = Int32.Parse(drTechnician["userid"].ToString());
                    string strNotify = "";
                    //if (oProject.Get(intProject, "number").StartsWith("CV") == false)
                    //    strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>";
                    // Add Workflow
                    int intResourceWorkflow = oResourceRequest.AddWorkflow(_rrid, 0, oResourceRequest.Get(_rrid, "name"), intUser, Int32.Parse(oResourceRequest.Get(_rrid, "devices")), double.Parse(oResourceRequest.Get(_rrid, "allocated")), 2, 1);
                    oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned to " + oUser.GetFullNameWithLanID(intUser) + " from service techician configuration", LoggingType.Debug);
                    // NOTIFY
                    if (strEmail != "" && strEmail != "0")
                    {
                        string strDefault = oApplication.GetUrl(intApp, _viewpage);
                        if (strDefault == "")
                        {
                            oFunction.SendEmail("Request Assignment: " + strService, strEmail, oUser.GetEmail(_cc, _environment), strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", false, false);
                        }
                        else
                        {
                            if (intProject > 0)
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, strEmail, oUser.GetEmail(_cc, _environment), strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(_viewpage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", false, false);
                            }
                            else
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, strEmail, oUser.GetEmail(_cc, _environment), strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", false, false);
                            }
                        }
                    }
                    else
                    {
                        string strDefault = oUser.GetApplicationUrl(intUser, _viewpage);
                        if (strDefault == "")
                        {
                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intUser), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                        }
                        else
                        {
                            if (intProject > 0)
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intUser), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(_viewpage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                            }
                            else
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intUser), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                            }
                        }
                        string strActivity = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intUser) + "</td></tr>";
                        strActivity += strSpacerRow;
                        strActivity += "<tr><td><b>Activity Type:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oRequestItem.GetItemName(_itemid) + "</td></tr>";
                        strActivity  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                        string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                        if (strDeliverable.Trim() != "")
                        {
                            strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                        }
                        if (oService.Get(intService, "notify_client") != "0")
                        {
                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intRequester), _cc, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>A resource has been assigned to the following request...</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                        }
                    }
                    oProject.Update(intProject, 2);
                    oResourceRequest.UpdateAccepted(_rrid, 1);
                    oResourceRequest.UpdateAssignedBy(_rrid, -1000);
                }
            }
            if (boolTech == false)
            {
                oLog.AddEvent(intRequest.ToString(), strCVT, "Sending request to service manager(s) for assignment", LoggingType.Debug);
                // If no technicians assigned
                if (strEmail != "" && strEmail != "0")
                {
                    // If group mailbox
                    string strDefault = oApplication.GetUrl(intApp, _assignpage);
                    oLog.AddEvent(intRequest.ToString(), strCVT, "Request sent to " + strEmail + " (group mailbox) for assignment", LoggingType.Debug);
                    if (strDefault == "")
                    {
                        oFunction.SendEmail("Request Submitted: " + strService, strEmail, "", strEMailIdsBCC, "Request Submitted: " + strService, "<p><b>A resource from your department has been requested; you are required to assign a resource to this initiative.</b></p><p>" + oResourceRequest.GetSummary(_rrid, 0, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", false, false);
                    }
                    else
                    {
                        oFunction.SendEmail("Request Submitted: " + strService, strEmail, "", strEMailIdsBCC, "Request Submitted: " + strService, "<p><b>A resource from your department has been requested; you are required to assign a resource to this initiative.</b></p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(_assignpage) + "?rrid=" + _rrid.ToString() + "\" target=\"_blank\">Click here to assign a resource.</a></p><p>" + oResourceRequest.GetSummary(_rrid, 0, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", false, false);
                    }
                }
                else
                {
                    // If no group mailbox, notify team leads
                    DataSet dsManagers = oService.GetUser(intService, 1);
                    foreach (DataRow drManager in dsManagers.Tables[0].Rows)
                    {
                        intUser = Int32.Parse(drManager["userid"].ToString());
                        oLog.AddEvent(intRequest.ToString(), strCVT, "Request sent to " + oUser.GetFullNameWithLanID(intUser) + " for assignment", LoggingType.Debug);
                        string strDefault = oUser.GetApplicationUrl(intUser, _assignpage);
                        if (strDefault == "")
                        {
                            oFunction.SendEmail("Request Submitted: " + strService, oUser.GetName(intUser), "", strEMailIdsBCC, "Request Submitted: " + strService, "<p><b>A resource from your department has been requested; you are required to assign a resource to this initiative.</b></p><p>" + oResourceRequest.GetSummary(_rrid, 0, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                        }
                        else
                        {
                            oFunction.SendEmail("Request Submitted: " + strService, oUser.GetName(intUser), "", strEMailIdsBCC, "Request Submitted: " + strService, "<p><b>A resource from your department has been requested; you are required to assign a resource to this initiative.</b></p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(_assignpage) + "?rrid=" + _rrid.ToString() + "\" target=\"_blank\">Click here to assign a resource.</a></p><p>" + oResourceRequest.GetSummary(_rrid, 0, _environment, _se_dsn, _dsn_asset, _dsn_ip) + "</p>", true, false);
                        }
                    }
                }
            }
        }
Beispiel #6
0
        private void sendMailNotification(string strService, string strComments)
        {
            string strNotify   = "";
            string strDefault  = "";
            int    intAssigned = 0;
            //int intApp = 0;
            int    intPage        = 0;
            string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
            string strSpacerRow   = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>";


            if (txtComments.Text.Trim() != "")
            {
                strComments = "<p>" + txtComments.Text + "</p>";
            }

            string strBody = oFunction.EmailComments(oUser.GetFullNameWithLanID(intProfile), strComments);

            int intReturnedTo = Int32.Parse(ddlReturnTo.SelectedItem.Value);

            if (intReturnedTo > 0)
            {
                //Get all workflow users
                DataSet dsPrevRRWF = oResourceRequest.GetWorkflowsParent(intReturnedTo);
                //intApp = oRequestItem.GetItemApplication(intPreRRItem);
                foreach (DataRow dr in dsPrevRRWF.Tables[0].Rows)
                {
                    int    intResourceWorkflow = Int32.Parse(dr["id"].ToString());
                    string strRequestAssigedTo = "";
                    intAssigned         = Int32.Parse(dr["userid"].ToString());
                    strRequestAssigedTo = oUser.GetName(intAssigned);

                    strDefault = oUser.GetApplicationUrl(intAssigned, intViewPage);


                    //if (oProject.Get(intProject, "number").StartsWith("CV") == false)
                    //    strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>";
                    if (strDefault == "")
                    {
                        oFunction.SendEmail("Service Request Returned: " + strService, strRequestAssigedTo, "", strEMailIdsBCC, "Service Request Returned: " + strService, "<p><b>The following request has been returned to you by " + oUser.GetFullName(intProfile) + "</b></p>" + (strBody == "" ? "" : "<p>" + strBody + "</p>") + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                    }
                    else
                    {
                        if (intProject > 0)
                        {
                            oFunction.SendEmail("Service Request Returned: " + strService, strRequestAssigedTo, "", strEMailIdsBCC, "Service Request Returned: " + strService, "<p><b>The following request has been returned to you by " + oUser.GetFullName(intProfile) + "</b></p>" + (strBody == "" ? "" : "<p>" + strBody + "</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 new assignment.</a></p>", true, false);
                        }
                        else
                        {
                            oFunction.SendEmail("Service Request Returned: " + strService, strRequestAssigedTo, "", strEMailIdsBCC, "Service Request Returned: " + strService, "<p><b>The following request has been returned to you by " + oUser.GetFullName(intProfile) + "</b></p>" + (strBody == "" ? "" : "<p>" + strBody + "</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 new assignment.</a></p>", true, false);
                        }
                    }
                    //string strActivity = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                    //strActivity += strSpacerRow;
                    //strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + strService + "</td></tr>";
                    //strActivity = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>";
                    //string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                    //if (strDeliverable.Trim() != "")
                    //    strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>";
                    //if (oService.Get(intService, "notify_client") != "0")
                    //    oFunction.SendEmail("Request Assignment: " + strService, strRequestAssigedTo, strEmailIdsCC, strEMailIdsBCC, "Request Returned: " + strService, "<p><b>The following request has been returned...</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false);
                }
            }
            else
            {
                //Send Mail Alerts
                //intApp = oRequestItem.GetItemApplication(intItem);
                strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS");
                string strPath = oPage.GetFullLink(intViewResourceRequest) + "?rid=" + intRequest.ToString() + "&returned=true";

                if (strPath == "")
                {
                    oFunction.SendEmail("Service Request Returned: " + strService, oUser.GetName(intRequester), strEmailIdsCC, strEMailIdsBCC, "Service Request Returned: " + strService, "<p><b>The following request has been returned by " + oUser.GetFullName(intProfile) + "</b></p>" + (strBody == "" ? "" : "<p>" + strBody + "</p>") + "<p>" + oResourceRequest.GetSummary(intRRId, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments, true, false);
                }
                else
                {
                    oFunction.SendEmail("Service Request Returned: " + strService, oUser.GetName(intRequester), "", strEMailIdsBCC, "Service Request Returned: " + strService, "<p><b>The following request has been returned to you by " + oUser.GetFullName(intProfile) + "</b></p>" + (strBody == "" ? "" : "<p>" + strBody + "</p>") + "<p>" + oResourceRequest.GetSummary(intRRId, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments + "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=" + strPath + "\" target=\"_blank\">Click here to review your request.</a></p>", true, false);
                }
            }
        }