Esempio n. 1
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            int intRequest          = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Parse(txtStart.Text), DateTime.Parse(txtEnd.Text));
            int intWorkflowParent   = oResourceRequest.Add(intRequest, -1, 0, 0, txtName.Text, 0, double.Parse(txtHours.Text), 2, 1, 1, 1);
            int intWorkflowResource = oResourceRequest.AddWorkflow(intWorkflowParent, 0, txtName.Text, Int32.Parse(ddlUser.SelectedItem.Value), 0, double.Parse(txtHours.Text), 2, 0);

            Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString());
        }
Esempio n. 2
0
        protected void btnNext_Click(Object Sender, EventArgs e)
        {
            int           intDone        = Save();
            OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn);

            if (intDone == 1)
            {
                if (oForecast.CanAutoProvision(intID) == false && oOnDemandTasks.GetPending(intID).Tables[0].Rows.Count == 0)
                {
                    // Add Resource Request
                    int             intForecast      = Int32.Parse(oForecast.GetAnswer(intID, "forecastid"));
                    int             intRequest       = Int32.Parse(oForecast.Get(intForecast, "requestid"));
                    Requests        oRequest         = new Requests(0, dsn);
                    int             intProject       = oRequest.GetProjectNumber(intRequest);
                    ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                    int             intImplementor   = 0;
                    string          strType          = "Distributed";
                    DataSet         dsResource       = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                    if (oForecast.GetPlatformDistributed(intID, intWorkstationPlatform) == false)
                    {
                        dsResource = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                        strType    = "Midrange";
                    }
                    if (dsResource.Tables[0].Rows.Count > 0)
                    {
                        intImplementor = (dsResource.Tables[0].Rows[0]["userid"].ToString() == "" ? 0 : Int32.Parse(dsResource.Tables[0].Rows[0]["userid"].ToString()));
                    }
                    if (intImplementor > 0)
                    {
                        int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                        int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (" + strType + ")", 0, 6.00, 2, 1, 1, 1);
                        int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (" + strType + ")", intImplementor, 0, 6.00, 2, 0);
                        oOnDemandTasks.AddPending(intID, intResourceWorkflow);
                        oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                    }
                }
            }
            oForecast.UpdateAnswerStep(intID, 1, intDone);
            Response.Redirect(Request.Path + "?id=" + intID.ToString() + "&save=true");
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/projects_pending.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oProject        = new Projects(intProfile, dsn);
     oProjectNumber  = new ProjectNumber(intProfile, dsn);
     oRequest        = new Requests(intProfile, dsn);
     oRequestItem    = new RequestItems(intProfile, dsn);
     oService        = new Services(intProfile, dsn);
     oProjectPending = new ProjectsPending(intProfile, dsn, intEnvironment);
     oOrganization   = new Organizations(intProfile, dsn);
     oDocument       = new Documents(intProfile, dsn);
     oUser           = new Users(intProfile, dsn);
     oForecast       = new Forecast(intProfile, dsn);
     oServiceRequest = new ServiceRequests(intProfile, dsn);
     if (!IsPostBack)
     {
         if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
         {
             // Process Service Requests
             int     intRequest = Int32.Parse(Request.QueryString["rid"]);
             DataSet dsForm     = oRequestItem.GetForms(intRequest);
             foreach (DataRow drForm in dsForm.Tables[0].Rows)
             {
                 if (drForm["done"].ToString() == "0")
                 {
                     int    intItem    = Int32.Parse(drForm["itemid"].ToString());
                     int    intNumber  = Int32.Parse(drForm["number"].ToString());
                     int    intService = Int32.Parse(drForm["serviceid"].ToString());
                     string strPath    = oService.Get(intService, "cp_path");
                     if (strPath.Trim() == "")
                     {
                         // For now, bypass
                         oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                     }
                     else
                     {
                         Control oControl = (Control)LoadControl(strPath);
                         PHcp.Controls.Add(oControl);
                     }
                 }
             }
             panPH.Visible = true;
         }
         else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             DataSet ds         = oProjectPending.Get(Int32.Parse(Request.QueryString["id"]));
             int     intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
             if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
             {
                 int intProject = Int32.Parse(Request.QueryString["pid"]);
                 if (intProject > 0)
                 {
                     // Process Design Builder
                     DataSet dsForecast = oForecast.GetRequest(intRequest);
                     if (dsForecast.Tables[0].Rows.Count > 0)
                     {
                         int             intForecast      = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                         DataSet         dsDesigns        = oForecast.GetAnswers(intForecast);
                         OnDemandTasks   oOnDemandTasks   = new OnDemandTasks(0, dsn);
                         ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                         foreach (DataRow drDesign in dsDesigns.Tables[0].Rows)
                         {
                             int intDesign        = Int32.Parse(drDesign["id"].ToString());
                             int intDesignRequest = 0;
                             if (Int32.TryParse(oForecast.GetAnswer(intDesign, "requestid"), out intDesignRequest) == true)
                             {
                                 if (intDesignRequest > 0)
                                 {
                                     // Update the REQUESTID in CV_FORECAST_ANSWERS with the new project correlation
                                     oRequest.Update(intDesignRequest, intProject);
                                 }
                             }
                             if (oForecast.CanAutoProvision(intDesign) == false)
                             {
                                 // Need to add a builder
                                 int     intImplementorD = 0;
                                 DataSet dsResourceD     = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                                 if (dsResourceD.Tables[0].Rows.Count > 0)
                                 {
                                     intImplementorD = Int32.Parse(dsResourceD.Tables[0].Rows[0]["userid"].ToString());
                                 }
                                 int     intImplementorM = 0;
                                 DataSet dsResourceM     = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                                 if (dsResourceM.Tables[0].Rows.Count > 0)
                                 {
                                     intImplementorM = Int32.Parse(dsResourceM.Tables[0].Rows[0]["userid"].ToString());
                                 }
                                 if (oForecast.GetPlatformDistributedForecast(intDesign, intWorkstationPlatform) == true)
                                 {
                                     if (intImplementorD > 0)
                                     {
                                         int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                                         int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (Distributed)", 0, 6.00, 2, 1, 1, 1);
                                         int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (Distributed)", intImplementorD, 0, 6.00, 2, 0);
                                         oOnDemandTasks.AddPending(intDesign, intResourceWorkflow);
                                         oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                                     }
                                     else
                                     {
                                         // Submit for assignment
                                         if (oServiceRequest.Get(intRequest, "requestid") == "")
                                         {
                                             oServiceRequest.Add(intRequest, 1, 1);
                                         }
                                         int intResource = oServiceRequest.AddRequest(intRequest, intImplementorDistributed, intImplementorDistributedService, 0, 0.00, 2, 1, dsnServiceEditor);
                                         if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                         {
                                             oServiceRequest.NotifyTeamLead(intImplementorDistributed, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                         }
                                     }
                                 }
                                 if (oForecast.GetPlatformMidrangeForecast(intDesign) == true)
                                 {
                                     if (intImplementorM > 0)
                                     {
                                         int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                                         int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (Midrange)", 0, 6.00, 2, 1, 1, 1);
                                         int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (Midrange)", intImplementorM, 0, 6.00, 2, 0);
                                         oOnDemandTasks.AddPending(intDesign, intResourceWorkflow);
                                         oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                                     }
                                     else
                                     {
                                         // Submit for assignment
                                         if (oServiceRequest.Get(intRequest, "requestid") == "")
                                         {
                                             oServiceRequest.Add(intRequest, 1, 1);
                                         }
                                         int intResource = oServiceRequest.AddRequest(intRequest, intImplementorMidrange, intImplementorMidrangeService, 0, 0.00, 2, 1, dsnServiceEditor);
                                         if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                         {
                                             oServiceRequest.NotifyTeamLead(intImplementorMidrange, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 oRequest.Update(intRequest, intProject);
                 oDocument.Update(intRequest, intProject);
                 oProjectPending.Approve(Int32.Parse(Request.QueryString["id"]));
                 if (intProject == 0)
                 {
                     oServiceRequest.Update(intRequest, ds.Tables[0].Rows[0]["name"].ToString());
                 }
                 Response.Redirect(Request.Path + "?rid=" + intRequest.ToString());
             }
             else
             {
                 if (Request.QueryString["reject"] != null)
                 {
                     panReject.Visible = true;
                 }
                 else
                 {
                     strProject = LoadProject(0, ds.Tables[0].Rows[0], intRequest, true);
                     btnView.Attributes.Add("onclick", "return ShowServiceRequests('" + intRequest.ToString() + "');");
                     btnViewDesigns.Attributes.Add("onclick", "return ShowDesigns('" + intRequest.ToString() + "');");
                     if (Request.QueryString["c"] != null && Request.QueryString["c"] != "")
                     {
                         panCompare.Visible = true;
                         string[] strProjects;
                         char[]   strSplit = { ' ' };
                         strProjects = Request.QueryString["c"].Split(strSplit);
                         bool boolOther = false;
                         for (int jj = 0; jj < strProjects.Length; jj++)
                         {
                             if (strProjects[jj].Trim() != "")
                             {
                                 TableRow  oRow  = new TableRow();
                                 TableCell oCell = new TableCell();
                                 oCell.Text = strProject;
                                 oRow.Cells.Add(oCell);
                                 oCell = new TableCell();
                                 HyperLink oCheck = new HyperLink();
                                 oCheck.ImageUrl    = "/images/bigCheck.gif";
                                 oCheck.ToolTip     = "Click to Assign";
                                 oCheck.NavigateUrl = Request.Path + "?id=" + Request.QueryString["id"] + "&pid=" + strProjects[jj];
                                 oCheck.Attributes.Add("onclick", "return confirm('Are you sure you want to assign this project?');");
                                 oCell.Controls.Add(oCheck);
                                 oRow.Cells.Add(oCell);
                                 oCell      = new TableCell();
                                 oCell.Text = LoadProject(Int32.Parse(strProjects[jj]), null, 0, false);
                                 if (boolOther == true)
                                 {
                                     oRow.Attributes.Add("bgcolor", "#EFEFEF");
                                 }
                                 boolOther = !boolOther;
                                 oRow.Cells.Add(oCell);
                                 tblCompare.Rows.Add(oRow);
                             }
                         }
                     }
                     else
                     {
                         panView.Visible = true;
                         LoadList();
                     }
                 }
             }
         }
         else
         {
             panAll.Visible = true;
             DataSet ds = oProjectPending.Gets();
             rptView.DataSource = ds;
             rptView.DataBind();
         }
     }
     btnCreateProject.Attributes.Add("onclick", "return confirm('Are you sure you want to create this PROJECT?');");
     btnCreateTask.Attributes.Add("onclick", "return confirm('Are you sure you want to create this TASK?');");
     btnCreateTask.Enabled = false;
     btnRejectConfirm.Attributes.Add("onclick", "return confirm('Are you sure you want to reject this project / task?');");
 }
        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);
                                }
                            }
                        }
                    }
                }
            }
Esempio n. 5
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");
        }
Esempio n. 6
0
        protected void btnComplete_Click(Object Sender, EventArgs e)
        {
            int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text);
            int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
            //oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 3, true);
            //oResourceRequest.CloseWorkflow(intResourceWorkflow, intEnvironment, strBCC, 0, dsnServiceEditor, true, intResourceRequestApprove, intAssignPage, intViewPage, dsnAsset, dsnIP);

            int     intAnswer = 0;
            int     intModel  = 0;
            DataSet ds        = oOnDemandTasks.GetServerOther(intRequest, intService, intNumber);

            if (ds.Tables[0].Rows.Count > 0)
            {
                intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                intModel  = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
            }

            bool boolComplete = true;

            //Check for all the service are complete and kick of the other services
            int     intService1 = 0;
            DataSet dsRR;

            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_SAV_ESM"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }

            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_HIDS"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);

            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_ECM"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_NETIQ"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_AUDIT"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            if (boolComplete == true)
            {
                // Send next 3 services

                Forecast oForecast = new Forecast(0, dsn);

                bool boolCluster = false;

                if (oForecast.IsHACluster(intAnswer) == true)
                {
                    boolCluster = true;
                }

                if (boolCluster == true)
                {
                    // send Cluster
                    int intImplementorUser     = 0;
                    int intImplementorResource = 0;

                    DataSet dsImplementor = oOnDemandTasks.GetPending(intAnswer);
                    if (dsImplementor.Tables[0].Rows.Count > 0)
                    {
                        intImplementorResource = Int32.Parse(dsImplementor.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementorUser     = Int32.Parse(oResourceRequest.GetWorkflow(intImplementorResource, "userid"));
                    }

                    if (intImplementorUser > 0)
                    {
                        Variables oVariable        = new Variables(intEnvironment);
                        int       intServiceId     = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_CLUSTER"]);
                        int       intServiceItemId = oService.GetItemId(intServiceId);
                        int       intServiceNumber = 1;
                        oOnDemandTasks.AddServerOther(intRequest, intServiceId, intServiceNumber, intAnswer, intModel);
                        double dblServiceHours = oServiceDetail.GetHours(intServiceId, 1);
                        int    intResource     = oServiceRequest.AddRequest(intRequest, intServiceItemId, intServiceId, 1, dblServiceHours, 2, intServiceNumber, dsnServiceEditor);
                        // Comment the following...
                        //oServiceRequest.NotifyTeamLead(intServiceItemId, intResource, intAssignPage, intViewPage, intEnvironment, strBCC, "", dsnServiceEditor, dsnAsset, dsnIP);
                        // Include the following...
                        int    intResourceWorkflowNEW = oResourceRequest.AddWorkflow(intResource, 0, oResourceRequest.Get(intResource, "name"), intImplementorUser, Int32.Parse(oResourceRequest.Get(intResource, "devices")), double.Parse(oResourceRequest.Get(intResource, "allocated")), 2, 1);
                        string strService             = oService.GetName(intServiceId);
                        if (intServiceId == 0)
                        {
                            strService = oRequestItem.GetItemName(intServiceItemId);
                        }
                        int    intApp     = oRequestItem.GetItemApplication(intServiceItemId);
                        string strDefault = oUser.GetApplicationUrl(intImplementorUser, intViewPage);
                        if (strDefault == "")
                        {
                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intImplementorUser), "", strBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflowNEW, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                        }
                        else
                        {
                            if (intProject > 0)
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intImplementorUser), "", strBCC, "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(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflowNEW, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + oVariable.EmailFooter(), true, false);
                            }
                            else
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intImplementorUser), "", strBCC, "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=" + intResourceWorkflowNEW.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflowNEW, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + oVariable.EmailFooter(), true, false);
                            }
                        }
                        oProject.Update(intProject, 2);
                        oResourceRequest.UpdateAccepted(intResource, 1);
                        oResourceRequest.UpdateAssignedBy(intResource, -1000);
                    }
                }

                //Send SQL Task
                bool boolSQL = false;

                Servers oServer = new Servers(0, dsn);

                DataSet dsServers = oServer.GetAnswer(intAnswer);

                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                {
                    int intServer = Int32.Parse(drServer["id"].ToString());

                    DataSet dsComponents = oServer.GetComponents(intServer);

                    foreach (DataRow drComponent in dsComponents.Tables[0].Rows)
                    {
                        boolSQL = (drComponent["code"].ToString() == "SQL");

                        if (boolSQL == true)
                        {
                            break;
                        }
                    }

                    if (boolSQL == true)
                    {
                        break;
                    }
                }

                if (boolSQL == true)
                {
                    // send SQL
                    //Generate HIDS Task
                    int intServiceId     = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_SQL"]);
                    int intServiceItemId = oService.GetItemId(intServiceId);
                    int intServiceNumber = 1;
                    oOnDemandTasks.AddServerOther(intRequest, intServiceId, intServiceNumber, intAnswer, intModel);
                    double dblServiceHours = oServiceDetail.GetHours(intServiceId, 1);
                    int    intResource     = oServiceRequest.AddRequest(intRequest, intServiceItemId, intServiceId, 1, dblServiceHours, 2, intServiceNumber, dsnServiceEditor);
                    oServiceRequest.NotifyTeamLead(intServiceItemId, intResource, intAssignPage, intViewPage, intEnvironment, strBCC, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                }

                //Lotus notes task generation
            }



            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">if(window.opener!=null)window.opener.navigate('" + oPage.GetFullLink(intMyWork) + "');window.close();<" + "/" + "script>");
        }
Esempio n. 7
0
        protected int Save()
        {
            int intReturn = 1;

            oResourceRequest.UpdateName(intResource, txtName.Text);
            double dblAllocated = 0.00;

            if (panDynamic.Visible == false)
            {
                dblAllocated = double.Parse(txtAllocated.Text);
            }
            else
            {
                double dblQuantity = double.Parse(txtDevices.Text);
                dblAllocated = oServiceDetail.GetHours(Int32.Parse(txtAllocated.ToolTip), dblQuantity);
            }
            oResourceRequest.UpdateDevices(intResource, Int32.Parse(txtDevices.Text), dblAllocated);
            oResourceRequest.UpdateAccepted(intResource, Int32.Parse(ddlAccepted.SelectedItem.Value));
            oResourceRequest.UpdateStatusOverall(intResource, Int32.Parse(ddlStatus.SelectedItem.Value));
            oResourceRequest.UpdateReason(intResource, txtReason.Text);
            if (Request.Form[hdnAssignedBy.UniqueID] != "" && Request.Form[hdnAssignedBy.UniqueID] != "0")
            {
                oResourceRequest.UpdateAssignedBy(intResource, Int32.Parse(Request.Form[hdnAssignedBy.UniqueID]));
            }

            if (trAdmin.Visible == true)
            {
                int intUser = 0;
                if (Int32.TryParse(Request.Form[hdnUser.UniqueID], out intUser) == true)
                {
                    // Assign resource
                    DataSet ds = oResourceRequest.Get(intResource);
                    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"));
                        Variables oVariable  = new Variables(intEnvironment);

                        DataSet dsWorkflow = oResourceRequest.GetWorkflowsParent(intResource);
                        if (dsWorkflow.Tables[0].Rows.Count == 0)
                        {
                            // New Assignment
                            Projects        oProject         = new Projects(intProfile, dsn);
                            ProjectsPending oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment);
                            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) + ";";
                            }

                            bool boolSolo     = (oResourceRequest.Get(intResource, "solo") == "1");
                            int  intAssigned  = 0;
                            bool boolRejected = (oResourceRequest.Get(intResource, "accepted") == "-1");
                            intAssigned = intUser;
                            oResourceRequest.UpdateAccepted(intResource, 1);

                            oProject.Update(intProject, 2);
                            int intResourceWorkflow = oResourceRequest.AddWorkflow(intResource, 0, oResourceRequest.Get(intResource, "name"), intAssigned, 1, 1.00, 2, 0);
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " (ADMIN) to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug);
                            oResourceRequest.UpdateAssignedBy(intResource, 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>";
                            oResourceRequest.UpdateDevices(intResource, 1, 1.00);
                            if (boolSolo == true)
                            {
                                oResourceRequest.UpdateStatusOverall(intResource, 2);
                                if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "")
                                {
                                    oProject.Update(intProject, oProjectNumber.New());
                                }
                                if (chkEmail.Checked == false)
                                {
                                    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><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);
                                            }
                                        }
                                        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
                                if (chkEmail.Checked == false)
                                {
                                    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><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")
                                    {
                                        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
                        {
                            // Update Assignee
                            int intResourceWorkflow = Int32.Parse(dsWorkflow.Tables[0].Rows[0]["id"].ToString());
                            int intOldUser          = Int32.Parse(dsWorkflow.Tables[0].Rows[0]["userid"].ToString());
                            if (chkEmail.Checked == false)
                            {
                                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>";
                                string strDefault     = oUser.GetApplicationUrl(intUser, intViewPage);
                                // Notify Old User
                                // NOTIFICATION
                                oFunction.SendEmail("Request Assignment", oUser.GetName(intOldUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been removed from your workload</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                                // Notify New User
                                if (strDefault == "")
                                {
                                    oFunction.SendEmail("Request Assignment", oUser.GetName(intUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been re-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", oUser.GetName(intUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been re-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", oUser.GetName(intUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been re-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);
                                    }
                                }
                                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>" + oService.GetName(intService) + "</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>";
                                }
                            }
                            oResourceRequest.UpdateWorkflowAssigned(intResourceWorkflow, intUser);
                        }
                    }
                }
            }
            return(intReturn);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title        = "ClearView Auto-Provisioning";
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oServiceRequest   = new ServiceRequests(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOnDemandTasks    = new OnDemandTasks(intProfile, dsn);
            oResourceRequest  = new ResourceRequest(intProfile, dsn);
            oProject          = new Projects(intProfile, dsn);
            oSetting          = new Settings(intProfile, dsn);

            //Menu
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, true);

            //End Menu

            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["id"] != null && Request.QueryString["id"] != "")
            {
                intID      = Int32.Parse(Request.QueryString["id"]);
                intRequest = oForecast.GetRequestID(intID, true);
                DataSet dsRequest = oServiceRequest.Get(intRequest);
                if (dsRequest.Tables[0].Rows.Count > 0)
                {
                    Response.Redirect(Request.Path + "?rid=" + intRequest);
                }
            }
            if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
            }
            if (Request.QueryString["notify"] != null)
            {
                string strRedirect = Request.Url.PathAndQuery;
                strRedirect = strRedirect.Substring(0, strRedirect.IndexOf("&notify"));
                if (Request.QueryString["notify"] == "none")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "true")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has been successfully notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "false")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has ALREADY been notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('There was a problem notifying your design implementor\\n\\nPlease contact your ClearView administrator\\n\\nRequestID: " + intRequest.ToString() + "');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
            }
            if (intID > 0)
            {
                Page.Title = "ClearView Auto-Provisioning | Design # " + intID.ToString();
                btnPrint.Attributes.Add("onclick", "return OpenWindow('DESIGN_PRINT', '?id=" + intID.ToString() + "');");
                bool    boolApproveNeeded = false;
                bool    boolApproved      = false;
                bool    boolPending       = false;
                bool    boolDenied        = false;
                Tab     oTabServer        = new Tab("", 0, "divMenuApprove", true, false);
                DataSet dsServers         = oServer.GetAnswer(intID);
                int     intServerCount    = 0;
                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                {
                    int intServer = Int32.Parse(drServer["id"].ToString());
                    intServerCount++;
                    DataSet dsApprove = oServerName.GetComponentDetailUserApprovalsByServer(intServer);
                    if (dsApprove.Tables[0].Rows.Count > 0)
                    {
                        boolApproveNeeded = true;
                        oTabServer.AddTab("Device # " + intServerCount.ToString(), "");
                        string strApproveItem = "";
                        bool   boolOther      = true;
                        foreach (DataRow drApprove in dsApprove.Tables[0].Rows)
                        {
                            boolOther = (boolOther == false);
                            int      intDetail           = Int32.Parse(drApprove["detailid"].ToString());
                            int      intApprover         = 0;
                            string   strApproverComments = "";
                            int      intApproverApproved = -1;
                            DateTime datApproved         = DateTime.Now;
                            DataSet  dsApprovals         = oServerName.GetComponentDetailUserApprovals(intServer, intDetail);
                            if (dsApprovals.Tables[0].Rows.Count == 0)
                            {
                                boolPending = true;
                            }
                            else
                            {
                                intApprover         = Int32.Parse(dsApprovals.Tables[0].Rows[0]["userid"].ToString());
                                strApproverComments = dsApprovals.Tables[0].Rows[0]["comments"].ToString();
                                intApproverApproved = Int32.Parse(dsApprovals.Tables[0].Rows[0]["approved"].ToString());
                                datApproved         = DateTime.Parse(dsApprovals.Tables[0].Rows[0]["modified"].ToString());
                                if (intApproverApproved == 0)
                                {
                                    boolDenied = true;
                                }
                            }
                            string  strApprovers = "";
                            DataSet dsApprovers  = oServerName.GetComponentDetailUsers(intDetail, 1);
                            foreach (DataRow drApprover in dsApprovers.Tables[0].Rows)
                            {
                                int intUser = Int32.Parse(drApprover["userid"].ToString());
                                strApprovers += "<tr><td><a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + intUser.ToString() + "');\"><img src=\"/images/" + (intApprover == 0 ? "pending" : (intUser == intApprover ? (intApproverApproved == 1 ? "check" : "cancel") : "user")) + ".gif\" border=\"0\" align=\"absmiddle\"/> " + oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")</a></td></tr>";
                            }
                            strApprovers    = "<table>" + strApprovers + "</table>";
                            strApproveItem += "<tr" + (boolOther ? " bgcolor=\"#F6F6F6\"" : "") + ">";
                            string strLabel = drApprove["name"].ToString();
                            if (intApproverApproved > -1)
                            {
                                strLabel = "<a href=\"javascript:void(0);\" onclick=\"ShowHideDiv2('trApproval" + intServerCount.ToString() + "_" + intDetail.ToString() + "');\">" + strLabel + "</a>";
                            }
                            strApproveItem += "<td valign=\"top\" width=\"45%\" class=\"biggerbold\">" + strLabel + "</td>";
                            strApproveItem += "<td valign=\"top\" width=\"10%\">" + (intApproverApproved == -1 ? "Pending" : (intApproverApproved == 0 ? "Denied" : "Approved")) + "</td>";
                            strApproveItem += "<td valign=\"top\" width=\"45%\" align=\"right\">" + strApprovers + "</td>";
                            strApproveItem += "</tr>";
                            if (intApproverApproved > -1)
                            {
                                string strApproveTable = "<tr><td colspan=\"2\"><span style=\"width:100%;border-bottom:1 dotted #CCCCCC;\"/></td></tr>";
                                strApproveTable += "<tr>";
                                strApproveTable += "<td nowrap valign=\"top\"><img src=\"/images/" + (intApproverApproved == 0 ? "cancel" : "check") + ".gif\" border=\"0\" align=\"absmiddle\"/></td>";
                                strApproveTable += "<td width=\"100%\" valign=\"top\">" + oUser.GetFullName(intApprover) + " " + (intApproverApproved == 0 ? "DENIED" : "APPROVED") + " this request on " + datApproved.ToString() + "</td>";
                                strApproveTable += "</tr>";
                                if (strApproverComments != "")
                                {
                                    strApproveTable += "<tr>";
                                    strApproveTable += "<td colspan=\"2\">The following comments were added...</td>";
                                    strApproveTable += "</tr>";
                                    strApproveTable += "<tr>";
                                    strApproveTable += "<td nowrap valign=\"top\"><img src=\"/images/comment.gif\" border=\"0\" align=\"absmiddle\"/></td>";
                                    strApproveTable += "<td width=\"100%\" valign=\"top\" class=\"comment\">" + strApproverComments + "</td>";
                                    strApproveTable += "</tr>";
                                }
                                strApproveTable = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\" border=\"0\">" + strApproveTable + "</table>";
                                strApproveItem += "<tr id=\"trApproval" + intServerCount.ToString() + "_" + intDetail.ToString() + "\" style=\"display:none\"" + (boolOther ? " bgcolor=\"#F6F6F6\"" : "") + "><td colspan=\"3\">" + strApproveTable + "</td></tr>";
                            }
                        }
                        strApproveItem = "<tr bgcolor=\"#EEEEEE\"><td class=\"header\">Component</td><td class=\"header\">Status</td><td class=\"header\" align=\"right\">Approver(s)</td></tr>" + strApproveItem;
                        strApproveItem = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\">" + strApproveItem + "</table>";
                        strApprove    += "<div id=\"divTab" + intServerCount.ToString() + "\" style=\"display:none\">" + strApproveItem + "</div>";
                    }
                }
                if (boolApproveNeeded == true)
                {
                    trApprove.Visible = true;
                    if (boolDenied == true)
                    {
                        btnSoftwareBack.Visible = true;
                        imgApproved.ImageUrl    = "/images/ico_error.gif";
                        lblApprovedHeader.Text  = "Software Component(s) Denied";
                        lblApproved.Text        = "One or more of the software components you requested have been denied. You cannot continue until all components have been approved.<br/>You will need to make changes to this design - please click <b>Make Changes</b> to change your software component requirements.<br/>All questions and status inquiries should be sent to the approver(s) listed below.";
                    }
                    else if (boolPending == true)
                    {
                        imgApproved.ImageUrl   = "/images/ico_hourglass.gif";
                        lblApprovedHeader.Text = "Software Component(s) Pending";
                        lblApproved.Text       = "One or more of the software components you requested are awaiting approval. You cannot continue until all components have been approved.<br/>All questions and status inquiries should be sent to the approver(s) listed below.";
                    }
                    else
                    {
                        boolApproved           = true;
                        lblApprovedHeader.Text = "Software Component(s) Approved";
                        lblApproved.Text       = "All of the software components you requested have been approved!";
                    }
                    btnApproved.Attributes.Add("onclick", "ShowHideDiv2('" + trApprove.ClientID + "');return false;");
                    strMenuTabApprove = oTabServer.GetTabs();
                }
                else
                {
                    boolApproved           = true;
                    lblApprovedHeader.Text = "No Approval Required";
                    lblApproved.Text       = "There are no approvals required for your software components";
                    btnApproved.Enabled    = false;
                }

                string strSchedule = oForecast.GetAnswer(intID, "execution");
                if (strSchedule != "")
                {
                    DateTime datSchedule = DateTime.Parse(strSchedule);
                    txtScheduleDate.Text = datSchedule.ToShortDateString();
                    txtScheduleTime.Text = datSchedule.ToShortTimeString();
                    btnSchedule.Text     = "Update the Build";
                }
                panBegin.Visible = true;
                bool boolAssigned = false;

                int intModel = oForecast.GetModelAsset(intID);
                if (intModel == 0)
                {
                    intModel = oForecast.GetModel(intID);
                }

                string strChange = "true";
                string strFreeze = "";
                // Check Freeze Dates
                bool boolFreeze = false;
                strFreezeStart = oSetting.Get("freeze_start");
                strFreezeEnd   = oSetting.Get("freeze_end");
                if (strFreezeStart != "" && strFreezeEnd != "" && DateTime.Parse(strFreezeStart) <= DateTime.Now && DateTime.Parse(strFreezeEnd) > DateTime.Now)
                {
                    boolFreeze = true;
                    divChange.Style["display"] = "inline";
                    if (!IsPostBack)
                    {
                        txtChange.Text = oForecast.GetAnswer(intID, "change");
                    }
                    strChange = "ValidateTextLength('" + txtChange.ClientID + "', 'Please enter a valid change control number\\n\\n - Must start with \"CHG\" or \"PTM\"\\n - Must be exactly 10 characters in length', 10, 'CHG', 'PTM')";
                }
                int intClass = Int32.Parse(oForecast.GetAnswer(intID, "classid"));

                int intForecast = 0;
                Int32.TryParse(oForecast.GetAnswer(intID, "forecastid"), out intForecast);
                int intRequestID = 0;
                Int32.TryParse(oForecast.Get(intForecast, "requestid"), out intRequestID);
                int intProject = 0;
                if (intRequestID > 0)
                {
                    intProject = oRequest.GetProjectNumber(intRequestID);
                }
                int intProjectStatus = 0;
                if (intProject > 0)
                {
                    Int32.TryParse(oProject.Get(intProject, "status"), out intProjectStatus);
                }

                if (oForecast.CanAutoProvision(intID) == true)
                {
                    boolAssigned = true;
                }
                else
                {
                    if (oOnDemandTasks.GetPending(intID).Tables[0].Rows.Count > 0)
                    {
                        boolAssigned = true;
                    }
                    else
                    {
                        // Add Resource Request
                        int     intImplementor = 0;
                        string  strType        = "Distributed";
                        DataSet dsResource     = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                        if (oForecast.GetPlatformDistributed(intID, intWorkstationPlatform) == false)
                        {
                            dsResource = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                            strType    = "Midrange";
                        }
                        if (dsResource.Tables[0].Rows.Count > 0)
                        {
                            intImplementor = (dsResource.Tables[0].Rows[0]["userid"].ToString() == "" ? 0 : Int32.Parse(dsResource.Tables[0].Rows[0]["userid"].ToString()));
                        }
                        if (intImplementor > 0)
                        {
                            int intNextNumber       = oResourceRequest.GetNumber(intRequestID);
                            int intResourceParent   = oResourceRequest.Add(intRequestID, -1, -1, intNextNumber, "Provisioning Task (" + strType + ")", 0, 6.00, 2, 1, 1, 1);
                            int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (" + strType + ")", intImplementor, 0, 6.00, 2, 0);
                            oOnDemandTasks.AddPending(intID, intResourceWorkflow);
                            oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                        }
                    }
                }

                lblNotify.Visible = boolBurnIn;

                bool boolOKtoExecute = false;
                if (intProject == -100)
                {
                    // Pending project approval
                    btnStart.Attributes.Add("onclick", "alert('This design cannot be executed because the associated project is currently pending approval.\\n\\nMost likely, this is because you just entered a new project into the system\\n\\nPlease contact your ClearView administrator or check back later.');return false;");
                    btnSchedule.Attributes.Add("onclick", "alert('This design cannot be scheduled because the associated project is currently pending approval.\\n\\nMost likely, this is because you just entered a new project into the system\\n\\nPlease contact your ClearView administrator or check back later.');return false;");
                }
                else
                {
                    if (oForecast.CanAutoProvision(intID) == true)
                    {
                        btnSchedule.Enabled = true;
                        boolOKtoExecute     = true;
                    }
                    else
                    {
                        if (boolAssigned == false)
                        {
                            btnStart.Attributes.Add("onclick", "alert('You cannot execute a design until a design implementor has been assigned.');return false;");
                            btnSchedule.Attributes.Add("onclick", "alert('You cannot schedule the execution of a design until a design implementor has been assigned.');return false;");
                        }
                        else
                        {
                            boolOKtoExecute = true;
                        }
                    }
                }

                imgScheduleDate.Attributes.Add("onclick", "return ShowCalendar('" + txtScheduleDate.ClientID + "');");
                if (boolOKtoExecute == true)
                {
                    btnStart.Attributes.Add("onclick", "return " + strChange + " && confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?');");
                    btnSchedule.Attributes.Add("onclick", "return ValidateDate('" + txtScheduleDate.ClientID + "','Please enter a valid schedule date')" +
                                               " && ValidateDateToday('" + txtScheduleDate.ClientID + "','The scheduled date must occur after today')" +
                                               " && ValidateFreeze('" + txtScheduleDate.ClientID + "','" + divChange.ClientID + "','" + txtChange.ClientID + "'," + (boolFreeze ? "true" : "false") + ")" +
                                               " && ValidateTime('" + txtScheduleTime.ClientID + "','Please enter a valid start time')" +
                                               " && confirm('NOTE: Billing will begin: ' + document.getElementById('" + txtScheduleDate.ClientID + "').value + '\\n\\nAre you sure you want to continue?')" +
                                               " && ProcessButton(this)" +
                                               ";");
                }

                if (oModelsProperties.IsInventory(intModel) == true)
                {
                    panInventoryYes.Visible = true;
                    if (boolApproved == false)
                    {
                        divSoftware.Style["display"] = "inline";
                        divDefault.Style["display"]  = "none";
                        radStart.Enabled             = false;
                        btnStart.Enabled             = false;
                        radSchedule.Enabled          = false;
                        btnSchedule.Enabled          = false;
                        radApproval.Enabled          = false;
                        btnApprovals.Enabled         = false;
                    }
                }
                else
                {
                    lblInventory.Text            = oModelsProperties.Get(intModel, "name");
                    panInventoryNo.Visible       = true;
                    divSoftware.Style["display"] = "none";
                    divDefault.Style["display"]  = "none";
                    radStart.Enabled             = false;
                    btnStart.Enabled             = false;
                    radSchedule.Enabled          = false;
                    btnSchedule.Enabled          = false;
                    radApproval.Enabled          = false;
                    btnApprovals.Enabled         = false;
                }
            }
            else if (intRequest > 0)
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
                DateTime datSchedule = DateTime.Now;
                DataSet  ds          = oServer.GetRequests(intRequest, 1);
                bool     boolPending = false;
                int      intAnswer   = 0;
                int      intModel    = 0;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    intModel  = oForecast.GetModelAsset(intAnswer);
                    if (intModel == 0)
                    {
                        intModel = oForecast.GetModel(intAnswer);
                    }
                    string strSchedule = oForecast.GetAnswer(intAnswer, "execution");
                    if (strSchedule != "")
                    {
                        datSchedule          = DateTime.Parse(strSchedule);
                        lblScheduleDate.Text = datSchedule.ToShortDateString();
                        lblScheduleTime.Text = datSchedule.ToShortTimeString();
                        if (DateTime.Now < datSchedule)
                        {
                            boolPending = true;
                        }
                    }
                }
                Page.Title = "ClearView Auto-Provisioning | Design # " + intAnswer.ToString();
                if (oForecast.CanAutoProvision(intAnswer) == false)
                {
                    panNotExecutable.Visible = true;
                    lblInitiated.Text        = oForecast.GetAnswer(intAnswer, "executed");
                    lblCompleted.Text        = oForecast.GetAnswer(intAnswer, "completed");
                    int     intImplementorUser = 0;
                    DataSet dsImplementor      = oOnDemandTasks.GetPending(intAnswer);
                    if (dsImplementor.Tables[0].Rows.Count > 0)
                    {
                        intImplementorUser = Int32.Parse(dsImplementor.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementorUser = Int32.Parse(oResourceRequest.GetWorkflow(intImplementorUser, "userid"));
                    }
                    strManualImage        = "<img src=\"/frame/picture.aspx?xid=" + oUser.GetName(intImplementorUser) + "\" border=\"0\" align=\"absmiddle\" style=\"height:90px;width:90px;border-width:0px;border:solid 1px #999999;\" />";
                    lblImplementor.Text   = oUser.GetFullName(intImplementorUser) + " (" + oUser.GetName(intImplementorUser) + ")";
                    strManualReason       = oForecast.CanAutoProvisionReason(intAnswer);
                    btnManual.NavigateUrl = "/datapoint/service/design.aspx?t=design&q=" + oFunction.encryptQueryString(intAnswer.ToString());
                    rptServers.DataSource = oServer.GetManual(intAnswer, false);
                    rptServers.DataBind();
                    foreach (RepeaterItem ri in rptServers.Items)
                    {
                        Label lblName = (Label)ri.FindControl("lblName");
                        if (lblName.Text != "--- Pending ---")
                        {
                            lblName.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=name&q=" + oFunction.encryptQueryString(lblName.Text) + "&id=" + oFunction.encryptQueryString(lblName.ToolTip) + "',800,600);\">" + lblName.Text + "</a>";
                        }
                        else
                        {
                            lblName.Text = "<i>" + lblName.Text + "</i>";
                        }
                        Label lblAsset = (Label)ri.FindControl("lblAsset");
                        if (lblAsset.Text != "--- Pending ---")
                        {
                            lblAsset.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(lblAsset.Text) + "',800,600);\">" + lblAsset.Text + "</a>";
                        }
                        else
                        {
                            lblAsset.Text = "<i>" + lblAsset.Text + "</i>";
                        }
                        Label lblAssetDR = (Label)ri.FindControl("lblAssetDR");
                        if (lblAssetDR.Text != "--- None ---")
                        {
                            if (lblAssetDR.Text != "--- Pending ---")
                            {
                                if (lblAssetDR.Text != "Missing!!!")
                                {
                                    lblAssetDR.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(lblAssetDR.Text) + "',800,600);\">" + lblAssetDR.Text + "</a>";
                                }
                                else
                                {
                                    lblAssetDR.Text = "<span class=\"highlight\">" + lblAssetDR.Text + "</span>";
                                }
                            }
                            else
                            {
                                lblAssetDR.Text = "<i>" + lblAssetDR.Text + "</i>";
                            }
                        }
                        else
                        {
                            lblAssetDR.Text = "<i>Not Required</i>";
                        }
                        Label lblIP1 = (Label)ri.FindControl("lblIP1");
                        if (lblIP1.Text == "--- Pending ---")
                        {
                            lblIP1.Text = "<i>" + lblIP1.Text + "</i>";
                        }
                        Label lblIP2 = (Label)ri.FindControl("lblIP2");
                        if (lblIP2.Text == "--- Pending ---")
                        {
                            lblIP2.Text = "<i>" + lblIP2.Text + "</i>";
                        }
                        Label lblIP3 = (Label)ri.FindControl("lblIP3");
                        if (lblIP3.Text == "--- Pending ---")
                        {
                            lblIP3.Text = "<i>" + lblIP3.Text + "</i>";
                        }
                    }
                }
                else
                {
                    if (boolPending == true)
                    {
                        panPending.Visible = true;
                        TimeSpan oSpan = datSchedule.Subtract(DateTime.Now);
                        if (oSpan.Seconds > 0)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "cdown", "<script type=\"text/javascript\">StartClockCountdown('" + lblCountdown.ClientID + "'," + oSpan.TotalMilliseconds.ToString() + ");<" + "/" + "script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "cdown", "<script type=\"text/javascript\">StartClockCountdown('" + lblCountdown.ClientID + "',0);<" + "/" + "script>");
                        }
                    }
                    else
                    {
                        panStart.Visible = true;
                        int   intCount = 0;
                        Types oType    = new Types(intProfile, dsn);

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            intCount++;
                            int intServer = Int32.Parse(dr["id"].ToString());
                            int intAsset  = 0;
                            if (dr["assetid"].ToString() != "")
                            {
                                intAsset = Int32.Parse(dr["assetid"].ToString());
                            }
                            int intType = 0;
                            intModel = 0;
                            if (dr["modelid"].ToString() != "")
                            {
                                intModel = Int32.Parse(dr["modelid"].ToString());
                            }
                            if (intModel > 0)
                            {
                                intType = oModelsProperties.GetType(intModel);
                            }
                            string strName = "Device " + intCount.ToString();
                            if (intAsset > 0)
                            {
                                string strTempName = oAsset.Get(intAsset, "name");
                                if (strTempName != "")
                                {
                                    strName = strTempName;
                                }
                            }
                            if (intCount == 1)
                            {
                                //strTab += "<td><img src=\"/images/TabOnLeftCap.gif\"></td><td nowrap background=\"/images/TabOnBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOnRightCap.gif\"></td>";
                                oTab.AddTab(strName, "");
                                strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:inline\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"" + oType.Get(intType, "ondemand_steps_path") + "?id=" + oFunction.encryptQueryString(intServer.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                            }
                            else
                            {
                                // strTab += "<td><img src=\"/images/TabOffLeftCap.gif\"></td><td nowrap background=\"/images/TabOffBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOffRightCap.gif\"></td>";
                                oTab.AddTab(strName, "");
                                strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:none\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"" + oType.Get(intType, "ondemand_steps_path") + "?id=" + oFunction.encryptQueryString(intServer.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                            }
                        }

                        strMenuTab1 = oTab.GetTabs();
                        //if (strTab != "")
                        //    strMenuTab1 += "<tr>" + strTab + "<td width=\"100%\" background=\"/images/TabEmptyBackground.gif\">&nbsp;</td></tr>";
                        //strMenuTab1 = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" + strMenuTab1 + "</table>";
                    }
                }
            }
            radStart.Attributes.Add("onclick", "ShowBuildDivs('" + divStart.ClientID + "','" + divDefault.ClientID + "','" + divSchedule.ClientID + "','" + divApproval.ClientID + "');");
            radSchedule.Attributes.Add("onclick", "ShowBuildDivs('" + divSchedule.ClientID + "','" + divDefault.ClientID + "','" + divStart.ClientID + "','" + divApproval.ClientID + "');");
            radApproval.Attributes.Add("onclick", "ShowBuildDivs('" + divApproval.ClientID + "','" + divDefault.ClientID + "','" + divStart.ClientID + "','" + divSchedule.ClientID + "');");
            btnApprovals.Attributes.Add("onclick", "return OpenWindow('DESIGN_APPROVERS','?id=" + intID.ToString() + "');");
        }
Esempio n. 9
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);
                        }
                    }
                }
            }
        }