Beispiel #1
0
        protected void btnSave_Click(Object Sender, EventArgs e)
        {
            oVariables = new Variables(intEnvironment);
            string strVirtualPath = "";

            if (fileUpload.FileName != "" && fileUpload.PostedFile != null)
            {
                string strExtension = fileUpload.FileName;
                string strType      = strExtension.Substring(0, 3);
                strExtension = strExtension.Substring(strExtension.LastIndexOf("."));
                string strFile = DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "_" + intProfile.ToString() + strExtension;
                strVirtualPath = oVariables.UploadsFolder() + strFile;
                string strPath = oVariables.UploadsFolder() + strFile;
                fileUpload.PostedFile.SaveAs(strPath);
            }

            intRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Now, DateTime.Now);
            intItemID  = oService.GetItemId(intService);
            int intResource = oServiceRequest.AddRequest(intRequest, intItemID, intService, 0, 0.00, 2, 2, dsnServiceEditor);

            oServiceRequest.Update(intRequest, txtTitle.Text);
            oResourceRequest.UpdateName(intResource, txtTitle.Text);
            oServiceRequest.Add(intRequest, 1, 1);

            oCustomized.AddIssue(intRequest, txtTitle.Text, txtDescription.Text, Int32.Parse(drpModules.SelectedValue), Int32.Parse(txtNumUsers.Text == "" ? "0" : txtNumUsers.Text), txtURL.Text, strVirtualPath, intProfile, 0);
            if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
            {
                oServiceRequest.NotifyTeamLead(intItemID, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
            }
            Response.Redirect(oPage.GetFullLinkRelated(intPage));
        }
Beispiel #2
0
        private void AddResult(string strError)
        {
            if (strError == "")
            {
                oOnDemand.UpdateStepDoneServer(intServer, intStep, oOnDemand.GetStep(intStep, "done"), 0, false, false);
                oServer.NextStep(intServer);
                intStep++;
            }
            else
            {
                oEventLog.AddEvent(strName, strSerial, strError, LoggingType.Error);
                //Functions oFunction = new Functions(0, dsn, intEnvironment);
                //Variables oVariable = new Variables(intEnvironment);
                oOnDemand.UpdateStepDoneServer(intServer, intStep, strError, 1, false, false);

                // Generic Error Request
                Services        oService                    = new Services(0, dsn);
                ResourceRequest oResourceRequest            = new ResourceRequest(0, dsn);
                ServiceRequests oServiceRequest             = new ServiceRequests(0, dsn);
                int             intProvisioningErrorService = intService;
                int             intProvisioningErrorItem    = oService.GetItemId(intProvisioningErrorService);
                int             intProvisioningErrorNumber  = oResourceRequest.GetNumber(intRequest, intProvisioningErrorItem);
                int             intError                    = oServer.AddError(intRequest, intProvisioningErrorItem, intProvisioningErrorNumber, intServer, intStep, strError);
                int             intProvisioningError        = oResourceRequest.Add(intRequest, intProvisioningErrorItem, intProvisioningErrorService, intProvisioningErrorNumber, "Provisioning Error (" + strName + ")", 1, 0.00, 2, 1, 1, 1);
                if (oServiceRequest.NotifyApproval(intProvisioningError, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                {
                    oServiceRequest.NotifyTeamLead(intProvisioningErrorItem, intProvisioningError, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                }
                if (boolEmailError == true)
                {
                    oFunction.SendEmail("Auto-Provisioning ERROR: " + strName, strTo, strCC, "", "Auto-Provisioning ERROR: " + strName, "<p><b>This message is to inform you that the server " + strName + " has encountered an error and has been stopped!</b><p><p>Serial Number: " + strSerial.ToUpper() + "<br/>Asset Tag: " + strAsset.ToUpper() + "<br/>Model: " + strModel.ToUpper() + "<br/>Step #: " + intStep.ToString() + "<br/>Error: " + strError + "<br/>ILO: <a href=\"https://" + strILO + "\" target=\"_blank\">" + strILO + "</a></p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_server.aspx?id=" + intServer.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                }
            }
        }
Beispiel #3
0
        private void Save(int intRequest)
        {
            int intItem    = Int32.Parse(lblItem.Text);
            int intNumber  = Int32.Parse(lblNumber.Text);
            int intService = Int32.Parse(lblService.Text);
            int intProject = oRequest.GetProjectNumber(intRequest);

            //if (intProject == -1)
            //    oServiceRequest.Update(intRequest, txtTitle.Text);
            oServiceEditor.AddRequest(intRequest, intService, intNumber, txtTitle.Text, Int32.Parse(radPriority.SelectedItem.Value), txtStatement.Text, DateTime.Now, DateTime.Now, (radExpediteYes.Checked ? 1 : 0));
            oServiceEditor.SaveForm(Request, intRequest, intService, intNumber, false, intEnvironment, dsn);

            //Reset the Resource Request and Workflow status for returned requests
            if (boolReqReturned == true)
            {
                int intReturned = 0;
                Int32.TryParse(lblReturned.Text, out intReturned);
                ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                DataSet         dsRR             = oResourceRequest.GetRequestService(intRequest, intReturned, Int32.Parse(lblNumber.Text));
                if (dsRR.Tables[0].Rows.Count > 0)
                {
                    int intRRId = Int32.Parse(dsRR.Tables[0].Rows[0]["parent"].ToString());
                    oResourceRequest.updateResourceRequestReturnCompleted(Int32.Parse(lblReqReturnedId.Text));
                    DataSet dsRRWF = oResourceRequest.GetWorkflowsParent(intRRId);
                    oResourceRequest.UpdateStatusRequest(intRRId, 2);
                    foreach (DataRow dr in dsRRWF.Tables[0].Rows)
                    {
                        int intRRWFId = Int32.Parse(dr["id"].ToString());
                        oResourceRequest.UpdateWorkflowStatus(intRRWFId, 2, true);
                    }
                }
            }
            //Reset the Resource Request and approval process for denied requests
            if (boolReqDenied == true)
            {
                ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                DataSet         dsResource       = oResourceRequest.GetAllService(intRequest, intService, Int32.Parse(lblNumber.Text));
                if (dsResource.Tables[0].Rows.Count > 0)
                {
                    int     intResource = Int32.Parse(dsResource.Tables[0].Rows[0]["rrid"].ToString());
                    DataSet dsRR        = oResourceRequest.Get(intResource);
                    if (dsRR.Tables[0].Rows.Count > 0)
                    {
                        oResourceRequest.UpdateStatusOverall(intResource, 2);
                        oService.UpdateSelectedApprove(intRequest, intService, Int32.Parse(lblNumber.Text), 0, 0, DateTime.Now, "");
                        if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                        {
                            oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                        }
                    }
                }
            }
        }
Beispiel #4
0
        private void AddResult(string strResult, string strError, int intAuditIDError)
        {
            if (strError == "")
            {
                if (boolMIS == false)
                {
                    //oServer.NextStep(intServer);
                    //oOnDemand.UpdateStepDoneServer(intServer, intStep, strResult, 0, false, false);

                    // Update to prevent it being kicked off again
                    oServer.UpdateStep(intServer, intStep + 1);
                    // Set the done status
                    oOnDemand.UpdateStepDoneServer(intServer, intStep, strResult, 0, false, false);
                    // Go back to current step
                    oServer.UpdateStep(intServer, intStep);
                    // Push through to next step
                    oServer.NextStep(intServer);
                    intStep++;
                }
                else
                {
                    oServer.UpdateMISAudits(intServer, DateTime.Now.ToString());
                }
            }
            else
            {
                oLog.AddEvent(strName, strSerial, strError, LoggingType.Error);
                if (boolMIS == false)
                {
                    oOnDemand.UpdateStepDoneServer(intServer, intStep, strError, 1, false, false);
                }
                else
                {
                    oServer.UpdateMISAudits(intServer, DateTime.Now.ToString());
                }

                // Generic Error Request
                Services        oService                   = new Services(0, dsn);
                ResourceRequest oResourceRequest           = new ResourceRequest(0, dsn);
                ServiceRequests oServiceRequest            = new ServiceRequests(0, dsn);
                int             intServerAuditErrorService = intService;
                int             intServerAuditErrorItem    = oService.GetItemId(intServerAuditErrorService);
                int             intServerAuditErrorNumber  = oResourceRequest.GetNumber(intRequest, intServerAuditErrorItem);
                oAudit.AddError(intRequest, intServerAuditErrorService, intServerAuditErrorNumber, intAuditIDError, intStep, boolMIS);
                int intError            = oServer.AddError(intRequest, intServerAuditErrorItem, intServerAuditErrorNumber, intServer, intStep, strError);
                int intServerAuditError = oResourceRequest.Add(intRequest, intServerAuditErrorItem, intServerAuditErrorService, intServerAuditErrorNumber, "Server Audit Exception (" + strName + ")", 1, 0.00, 2, 1, 1, 1);
                if (oServiceRequest.NotifyApproval(intServerAuditError, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                {
                    oServiceRequest.NotifyTeamLead(intServerAuditErrorItem, intServerAuditError, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                }
            }
        }
Beispiel #5
0
        protected void btnSave_Click(Object Sender, EventArgs e)
        {
            intRequest = oRequest.Add(0, intProfile);
            int intItemID   = oService.GetItemId(intService);
            int intResource = oServiceRequest.AddRequest(intRequest, intItemID, intService, 0, 0.00, (int)EnhancementStatus.UnderReview, 1, dsnServiceEditor);

            oServiceRequest.Update(intRequest, txtTitle.Text);
            oResourceRequest.UpdateName(intResource, txtTitle.Text);
            oServiceRequest.Add(intRequest, 1, 1);
            intID = oEnhancement.Add(txtTitle.Text, txtDescription.Text, Int32.Parse(ddlUsers.SelectedItem.Value), txtURL.Text, fileUpload, intEnvironment, Int32.Parse(radRelease1.SelectedItem.Value), Int32.Parse(radRelease2.SelectedItem.Value), intProfile, intResource);
            if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
            {
                oServiceRequest.NotifyTeamLead(intItemID, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
            }
            oEnhancement.AddLog(intID, 0, "Submitted Original Enhancement", intProfile, "");
            Response.Redirect(oPage.GetFullLinkRelated(intPage));
        }
Beispiel #6
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?');");
 }
Beispiel #7
0
        protected void btnApprove_Click(Object Sender, EventArgs e)
        {
            if (Request.QueryString["rrid"] != null)
            {
                // Approved; Send to team lead for assignment
                int    intResource = Int32.Parse(Request.QueryString["rrid"]);
                int    intRequest  = Int32.Parse(oResourceRequest.Get(intResource, "requestid"));
                int    intService  = Int32.Parse(oResourceRequest.Get(intResource, "serviceid"));
                int    intNumber   = Int32.Parse(oResourceRequest.Get(intResource, "number"));
                string strCVT      = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();

                int     ApprovalID = 0;
                DataSet dsApproval = oResourceRequest.GetApprovals(intRequest, intService, intNumber);
                foreach (DataRow drApproval in dsApproval.Tables[0].Rows)
                {
                    if (Int32.Parse(drApproval["userid"].ToString()) == intProfile)
                    {
                        if (String.IsNullOrEmpty(drApproval["approved"].ToString()) == false ||
                            String.IsNullOrEmpty(drApproval["denied"].ToString()) == false)
                        {
                            ApprovalID = Int32.Parse(drApproval["id"].ToString());
                            break;
                        }
                    }
                }

                if (ApprovalID == 0)
                {
                    oLog.AddEvent(intRequest.ToString(), strCVT, "Not already approved for user " + oUser.GetName(intProfile), LoggingType.Debug);
                    oResourceRequest.UpdateStatusOverall(intResource, 2);
                    if (oResourceRequest.Get(intResource, "platform_approval") == "0")
                    {
                        // Platform Approve
                        oResourceRequest.ApprovePlatform(intResource, 1);
                        SendEmail(intRequest, true, "PLATFORM", txtReason.Text);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved PLATFORM", LoggingType.Debug);
                    }
                    else if (oService.GetSelected(intRequest, intService, intNumber, "approved") == "0")
                    {
                        // Service Manager Approve
                        oService.UpdateSelectedApprove(intRequest, intService, intNumber, 1, intProfile, DateTime.Now, "");
                        SendEmail(intRequest, true, "SERVICE MANAGER", txtReason.Text);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved SERVICE MANAGER", LoggingType.Debug);
                    }
                    else
                    {
                        oResourceRequest.UpdateApproval(intRequest, intService, intNumber, intProfile, txtReason.Text, DateTime.Now.ToString(), "");
                        SendEmail(intRequest, true, "3RD PARTY APPROVER", txtReason.Text);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved 3RD PARTY APPROVER", LoggingType.Debug);
                    }
                    int intItem = Int32.Parse(oResourceRequest.Get(intResource, "itemid"));
                    if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                    {
                        oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                    }
                }
                else
                {
                    oLog.AddEvent(intRequest.ToString(), strCVT, "Already approved for user " + oUser.GetName(intProfile), LoggingType.Debug);
                }
            }
            if (Request.QueryString["srid"] != null)
            {
                // Approved; Permit submission
                int     intServiceSelectedID = Int32.Parse(Request.QueryString["srid"]);
                DataSet dsServiceSelected    = oService.GetSelectedById(intServiceSelectedID);
                DataRow drServiceSelected    = dsServiceSelected.Tables[0].Rows[0];
                int     intRequest           = Int32.Parse(drServiceSelected["requestid"].ToString());
                int     intService           = Int32.Parse(drServiceSelected["serviceid"].ToString());
                int     intItem   = oService.GetItemId(intService);
                int     intNumber = Int32.Parse(drServiceSelected["number"].ToString());
                string  strCVT    = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                oService.UpdateSelectedApprove(intRequest, intService, intNumber, 1, intProfile, DateTime.Now, "");
                SendEmail(intRequest, true, "SERVICE MANAGER", txtReason.Text);
                oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved SERVICE MANAGER", LoggingType.Debug);

                // Kick off any automated processing...
                Workstations oWorkstation = new Workstations(intProfile, dsn);
                oWorkstation.ExecuteVMware(intRequest);
            }
            if (Request.QueryString["rid"] != null)
            {
                // Manager Approve
                int intRequest = Int32.Parse(Request.QueryString["rid"]);
                oServiceRequest.UpdateApproval(intRequest, 1);
                oResourceRequest.UpdateStatusRequest(intRequest, 2);
                SendEmail(intRequest, true, "MANAGER", txtReason.Text);
                DataSet dsForm = oRequestItem.GetForms(intRequest);
                foreach (DataRow drForm in dsForm.Tables[0].Rows)
                {
                    int intService = 0;
                    Int32.TryParse(drForm["serviceid"].ToString(), out intService);
                    int intNumber = 0;
                    Int32.TryParse(drForm["number"].ToString(), out intNumber);
                    if (intService > 0 && intNumber > 0)
                    {
                        if (oServiceRequest.NotifyApproval(intRequest, intService, intNumber, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                        {
                            // Send to Team Lead for assignment
                            ds = oResourceRequest.GetUnAssigned(intRequest, 0);
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                int intItem = Int32.Parse(dr["itemid"].ToString());
                                oServiceRequest.NotifyTeamLead(intItem, Int32.Parse(dr["id"].ToString()), intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                            }
                        }
                    }
                }
            }
            Response.Redirect(oPage.GetFullLink(intPage) + "?action=finish");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);
            ServiceDetails  oServiceDetail  = new ServiceDetails(intProfile, dsn);
            int             intRequest      = Int32.Parse(Request.QueryString["rid"]);
            string          strStatus       = oServiceRequest.Get(intRequest, "checkout");
            DataSet         dsItems         = oRequestItem.GetForms(intRequest);
            int             intItem         = 0;
            int             intService      = 0;
            int             intNumber       = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        bool   boolSuccess = true;
                        string strResult   = oService.GetName(intService) + " Completed";
                        string strError    = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        Requests  oRequest  = new Requests(intProfile, dsn);
                        Functions oFunction = new Functions(intProfile, dsn, intEnvironment);
                        Variables oVariable = new Variables(intEnvironment);
                        Users     oUser     = new Users(intProfile, dsn);
                        Pages     oPage     = new Pages(intProfile, dsn);
                        if (oRequest.Get(intRequest, "description") == "")
                        {
                            Customized oCustomized = new Customized(intProfile, dsn);
                            DataSet    dsStatement = oCustomized.GetWorkstation(intRequest, intItem, intNumber);
                            if (dsStatement.Tables[0].Rows.Count > 0)
                            {
                                oRequest.UpdateDescription(intRequest, dsStatement.Tables[0].Rows[0]["statement"].ToString());
                            }
                        }
                        int     intDevices  = 0;
                        double  dblQuantity = 0.00;
                        DataSet ds          = oService.GetSelected(intRequest, intService);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            dblQuantity = double.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
                            intDevices  = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
                        }
                        double dblHours    = oServiceDetail.GetHours(intService, dblQuantity);
                        int    intResource = oServiceRequest.AddRequest(intRequest, intItem, intService, intDevices, dblHours, 2, intNumber, dsnServiceEditor);
                        if (oService.Get(intService, "typeid") == "3")
                        {
                        }
                        else if (oService.Get(intService, "typeid") == "2")
                        {
                        }
                        else
                        {
                            if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                            {
                                oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                            }
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + strResult + "</span></p>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> " + strError + "</span></p>";
                            }
                            else
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + oService.GetName(intService) + " Submitted</span></p>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            RequestItems    oRequestItem     = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField    = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest  = new ServiceRequests(intProfile, dsn);
            Services        oService         = new Services(intProfile, dsn);
            ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
            Log             oLog             = new Log(intProfile, dsn);
            Users           oUser            = new Users(intProfile, dsn);
            int             intRequest       = Int32.Parse(Request.QueryString["rid"]);
            string          strStatus        = oServiceRequest.Get(intRequest, "checkout");
            DataSet         dsItems          = oRequestItem.GetForms(intRequest);
            int             intItem          = 0;
            int             intService       = 0;
            int             intNumber        = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        bool   boolSuccess      = true;
                        string strWorkflowTitle = oService.Get(intService, "workflow_title");
                        string strResult        = (strWorkflowTitle == "" ? oService.GetName(intService) : strWorkflowTitle) + " Completed";
                        string strError         = (strWorkflowTitle == "" ? oService.GetName(intService) : strWorkflowTitle) + " Error";
                        // ********* BEGIN PROCESSING **************
                        double dblHours   = 0.00;
                        int    intDevices = 1;
                        Field  oField     = new Field(intProfile, dsn);
                        string strTable   = oField.GetTableName2(intService);
                        if (strTable != "")
                        {
                            DataSet ds = oField.GetTableServiceRequest(strTable, intRequest.ToString(), intItem.ToString(), intNumber.ToString());
                            if (ds.Tables[0].Columns.Contains("hours") == true)
                            {
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    dblHours += double.Parse(dr["hours"].ToString());
                                }
                            }
                            if (ds.Tables[0].Columns.Contains("devices") == true)
                            {
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    intDevices += Int32.Parse(dr["devices"].ToString());
                                }
                            }
                        }
                        if (oService.Get(intService, "quantity_is_device") == "1")
                        {
                            DataSet dsTemp = oService.GetSelected(intRequest, intService);
                            if (dsTemp.Tables[0].Rows.Count > 0)
                            {
                                intDevices = Int32.Parse(dsTemp.Tables[0].Rows[0]["quantity"].ToString());
                            }
                        }
                        string strCVT      = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                        int    intResource = oServiceRequest.AddRequest(intRequest, intItem, intService, intDevices, dblHours, 2, intNumber, dsnServiceEditor);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been submitted by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Debug);
                        if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                        {
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been fully approved", LoggingType.Debug);
                            oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Service request NotifyTeamLead has completed.", LoggingType.Debug);
                        }
                        else
                        {
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been sent for approval", LoggingType.Debug);
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + strResult + "</span></p>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> " + strError + "</span></p>";
                            }
                            else
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + (strWorkflowTitle == "" ? oService.GetName(intService) : strWorkflowTitle) + " Submitted</span></p>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);

            oFunction = new Functions(intProfile, dsn, intEnvironment);
            oUser     = new Users(intProfile, dsn);
            oRequest  = new Requests(intProfile, dsn);

            int     intRequest = Int32.Parse(Request.QueryString["rid"]);
            string  strStatus  = oServiceRequest.Get(intRequest, "checkout");
            DataSet dsItems    = oRequestItem.GetForms(intRequest);

            int intItem    = 0;
            int intService = 0;
            int intNumber  = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        bool   boolSuccess = true;
                        string strResult   = oService.GetName(intService) + " Completed";
                        string strError    = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        bool boolIsServerVMWare = false;
                        bool boolIsNotManual    = false;
                        int  intServer          = 0;
                        int  intModel           = 0;

                        Customized oCustomized   = new Customized(intProfile, dsn);
                        DataSet    dsDecomServer = oCustomized.GetDecommissionServer(intRequest, intItem, intNumber);
                        if (dsDecomServer.Tables[0].Rows.Count > 0)
                        {
                            intServer = Int32.Parse(dsDecomServer.Tables[0].Rows[0]["serverid"].ToString());
                            DateTime datPower    = DateTime.Parse(dsDecomServer.Tables[0].Rows[0]["poweroff"].ToString());
                            string   strPowerNew = dsDecomServer.Tables[0].Rows[0]["poweroff_new"].ToString();
                            string   strName     = dsDecomServer.Tables[0].Rows[0]["servername"].ToString();
                            Asset    oAsset      = new Asset(intProfile, dsnAsset);
                            Servers  oServers    = new Servers(intProfile, dsn);
                            DataSet  dsAssets    = oServers.GetAssets(intServer);

                            if (intServer > 0)
                            {
                                DataSet          dsServer          = oServers.Get(intServer);
                                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                                if (dsServer.Tables[0].Rows[0]["modelid"] != DBNull.Value)
                                {
                                    intModel = Int32.Parse(dsServer.Tables[0].Rows[0]["modelid"].ToString());
                                }
                                if (intModel > 0 && oModelsProperties.IsTypeVMware(intModel) == true)
                                {
                                    boolIsServerVMWare = true;
                                }
                                boolIsNotManual = true;
                            }
                            // VMWARE
                            if (boolIsNotManual == true)
                            {
                                bool boolUnique = true;
                                foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                                {
                                    if (drAsset["latest"].ToString() == "1" || drAsset["dr"].ToString() == "1")
                                    {
                                        int intAsset = Int32.Parse(drAsset["assetid"].ToString());
                                        boolUnique = oAsset.AddDecommission(intRequest, intItem, intNumber, intAsset, intProfile, dsDecomServer.Tables[0].Rows[0]["reason"].ToString(), datPower, strName + (drAsset["dr"].ToString() == "1" ? "-DR" : ""), (drAsset["dr"].ToString() == "1" ? 1 : 0), strPowerNew);
                                        if (boolUnique == false)
                                        {
                                            break;
                                        }
                                    }
                                }
                                if (boolUnique == true || strPowerNew != "")
                                {
                                    oAsset.UpdateDecommission(intRequest, intItem, intNumber, 1);
                                    strResult += "<p>The server " + strName + " was successfully queued for decommission on " + (strPowerNew != "" ? strPowerNew : datPower.ToShortDateString()) + "</p>";
                                    strError   = "";
                                }
                                else
                                {
                                    strError = "<p>The server " + strName + " has already been queued for decommission</p>";
                                }
                                //Send service center notification
                                //"Assignment: Complete and Close"
                                # region "Send Service Center Notification"
                                ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
                                DataSet         dsRR             = oResourceRequest.GetResourceRequest(intRequest, intItem, intNumber);
                                int             intRRId          = 0;
                                if (dsRR.Tables[0].Rows.Count > 0)
                                {
                                    intRRId = Int32.Parse(dsRR.Tables[0].Rows[0]["id"].ToString());
                                }

                                //int intServerDecommServiceID = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_SERVER_DECOMMISSION"]);
                                //if (intService == intServerDecommServiceID)
                                //{
                                //    SendServiceCenterNotification(intRequest, intItem, intService, intNumber, 0);
                                //}
                                #endregion
                            }
                            else
                            {
                                // MANUAL (non-automated)
                                double dblHours   = 0.00;
                                int    intDevices = 1;
                                Field  oField     = new Field(intProfile, dsn);

                                strResult += "<p>The server decommission request was submitted for " + strName + ".</p>";
                                strError   = "";

                                string strTable = oField.GetTableName2(intService);
                                if (strTable != "")
                                {
                                    DataSet ds = oField.GetTableServiceRequest(strTable, intRequest.ToString(), intItem.ToString(), intNumber.ToString());
                                    if (ds.Tables[0].Columns.Contains("hours") == true)
                                    {
                                        foreach (DataRow dr in ds.Tables[0].Rows)
                                        {
                                            dblHours += double.Parse(dr["hours"].ToString());
                                        }
                                    }
                                    if (ds.Tables[0].Columns.Contains("devices") == true)
                                    {
                                        foreach (DataRow dr in ds.Tables[0].Rows)
                                        {
                                            intDevices += Int32.Parse(dr["devices"].ToString());
                                        }
                                    }
                                }
                                if (oService.Get(intService, "quantity_is_device") == "1")
                                {
                                    DataSet dsTemp = oService.GetSelected(intRequest, intService);
                                    if (dsTemp.Tables[0].Rows.Count > 0)
                                    {
                                        intDevices = Int32.Parse(dsTemp.Tables[0].Rows[0]["quantity"].ToString());
                                    }
                                }
                                int intResource = oServiceRequest.AddRequest(intRequest, intItem, intService, intDevices, dblHours, 2, intNumber, dsnServiceEditor);
                                if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                {
                                    oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                }

                                oRequest.AddResult(intRequest, intItem, intNumber, "Server Decommission", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intProfile));
                            }
                        }
                        else
                        {
                            strResult     = "";
                            dsDecomServer = oCustomized.GetDecommissionServerDeleted(intRequest, intItem, intNumber);
                            string strName = "";
                            if (dsDecomServer.Tables[0].Rows.Count > 0)
                            {
                                strName = dsDecomServer.Tables[0].Rows[0]["servername"].ToString();
                            }
                            if (strName == "")
                            {
                                strError = "<p>One or more of the servers you attempted to decommission have already been queued for decommission</p>";
                            }
                            else
                            {
                                strError = "<p>The server " + strName + " has already been queued for decommission</p>";
                            }
                            oRequestItem.DeleteForms(intRequest, intService, intNumber);
                        }

                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1, (boolIsNotManual?1:0));
                    }
                }
            }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);
            Log             oLog            = new Log(intProfile, dsn);
            Users           oUser           = new Users(intProfile, dsn);
            Functions       oFunction       = new Functions(intProfile, dsn, intEnvironment);
            Pages           oPage           = new Pages(intProfile, dsn);
            Requests        oRequest        = new Requests(intProfile, dsn);
            Variables       oVariable       = new Variables(intEnvironment);
            int             intRequest      = Int32.Parse(Request.QueryString["rid"]);
            string          strStatus       = oServiceRequest.Get(intRequest, "checkout");
            DataSet         dsItems         = oRequestItem.GetForms(intRequest);
            int             intItem         = 0;
            int             intService      = 0;
            int             intNumber       = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        string strResult = oService.GetName(intService) + " Completed";
                        string strError  = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        string           strCVT            = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                        Forecast         oForecast         = new Forecast(intProfile, dsn);
                        ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                        Types            oType             = new Types(intProfile, dsn);
                        DataSet          dsService         = oForecast.GetAnswerService(intRequest);
                        if (dsService.Tables[0].Rows.Count > 0)
                        {
                            int     intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                            int     intModel   = Int32.Parse(dsService.Tables[0].Rows[0]["modelid"].ToString());
                            int     intType    = oModelsProperties.GetType(intModel);
                            string  strExecute = oType.Get(intType, "forecast_execution_path");
                            DataSet dsSelected = oService.GetSelected(intRequest, intService, intNumber);

                            if (oServiceRequest.NotifyApproval(intRequest, intService, intNumber, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                            {
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been fully approved", LoggingType.Debug);
                                Workstations oWorkstation = new Workstations(intProfile, dsn);
                                oWorkstation.ExecuteVMware(intRequest);
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request ExecuteVMware has completed.", LoggingType.Debug);
                            }
                            else
                            {
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been sent for approval", LoggingType.Debug);
                            }
                            //if (strExecute != "")
                            //    btnStart.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                            //else
                            //    btnStart.Attributes.Add("onclick", "alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;");
                            strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                        }
                        // ******** END PROCESSING **************
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }