Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage      = new Pages(intProfile, dsn);
            oService   = new Services(intProfile, dsn);
            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);
            }
            int intRequest = 0;

            Int32.TryParse(Request.QueryString["rid"], out intRequest);
            int intService = 0;

            Int32.TryParse(Request.QueryString["cid"], out intService);
            int intNumber = 0;

            Int32.TryParse(Request.QueryString["num"], out intNumber);
            int intItem = oService.GetItemId(intService);
            // *****************************************************************************
            // ********* Additional Cancel Functionality to be performed here **************
            // *****************************************************************************
            int        intServer     = 0;
            DateTime   datNow        = DateTime.Now;
            DateTime   datOff        = datNow;
            Customized oCustomized   = new Customized(intProfile, dsn);
            Asset      oAsset        = new Asset(intProfile, dsnAsset);
            bool       boolAutoFound = false;

            // Get from automated table
            DataSet dsDecomServer = oAsset.GetDecommission(intRequest, intNumber, 2);

            if (dsDecomServer.Tables[0].Rows.Count > 0)
            {
                DateTime.TryParse(dsDecomServer.Tables[0].Rows[0]["decom"].ToString(), out datOff);
                boolAutoFound = true;
            }

            // Get from manaul table
            dsDecomServer = oCustomized.GetDecommissionServer(intRequest, intItem, intNumber);
            if (dsDecomServer.Tables[0].Rows.Count > 0)
            {
                Int32.TryParse(dsDecomServer.Tables[0].Rows[0]["serverid"].ToString(), out intServer);
                if (boolAutoFound == false)
                {
                    if (dsDecomServer.Tables[0].Rows[0]["poweroff_new"].ToString() != "")
                    {
                        DateTime.TryParse(dsDecomServer.Tables[0].Rows[0]["poweroff_new"].ToString(), out datOff);
                    }
                    else
                    {
                        DateTime.TryParse(dsDecomServer.Tables[0].Rows[0]["poweroff"].ToString(), out datOff);
                    }
                }
            }

            if (intServer > 0)
            {
                Servers oServer = new Servers(intProfile, dsn);
                oServer.UpdateDecommissioned(intServer, "");
                DataSet dsAssets = oServer.GetAssets(intServer);
                foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                {
                    if (drAsset["latest"].ToString() == "1" || drAsset["dr"].ToString() == "1")
                    {
                        int intAsset = Int32.Parse(drAsset["assetid"].ToString());
                        oServer.UpdateAssetDecom(intServer, intAsset, "");
                    }
                }
            }
            if (datOff > datNow)
            {
                // Cancel automated table
                oAsset.UpdateDecommission(intRequest, intItem, intNumber, -2);
            }
            // *****************************************************************************
            // ********* END of Additional Cancel Functionality  ***************************
            // *****************************************************************************
            Page.ClientScript.RegisterStartupScript(typeof(Page), "cancelled", "<script type=\"text/javascript\">ExecuteCancel('" + oService.GetName(intService) + "','" + oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString() + "');<" + "/" + "script>");
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oServer          = new Servers(intProfile, dsn);
            oCustomized      = new Customized(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                // Start Workflow Change
                lblResourceWorkflow.Text = Request.QueryString["rrid"];
                int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]);
                int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
                ds = oResourceRequest.Get(intResourceParent);
                // End Workflow Change
                intRequest          = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest));
                lblRequestedOn.Text = DateTime.Parse(oResourceRequest.Get(intResourceParent, "created")).ToString();
                lblDescription.Text = oRequest.Get(intRequest, "description");
                if (lblDescription.Text == "")
                {
                    lblDescription.Text = "<i>No information</i>";
                }
                intItem   = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                // Start Workflow Change
                bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3");
                int  intUser      = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name");
                double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                boolJoined = (oResourceRequest.GetWorkflow(intResourceWorkflow, "joined") == "1");
                // End Workflow Change
                intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                // Add in amount panel for reclaiming of storage
                string strRequired = "true";
                string strAmount   = "0";
                if (intServiceStorage == intService || intServiceBackup == intService)
                {
                    lblStorageAmt.Text         = "0.00";
                    lblStorageTier.Text        = "0";
                    lblStorageEnvironment.Text = "";
                    DataSet dsDecommission = oCustomized.GetDecommissionServer(intRequest, intItem, intNumber);
                    if (dsDecommission.Tables[0].Rows.Count > 0)
                    {
                        intServer = Int32.Parse(dsDecommission.Tables[0].Rows[0]["serverid"].ToString());
                        if (intServiceStorage == intService)
                        {
                            panStorage.Visible = true;
                            strRequired        = "ValidateStorage('" + txtPreCooldown.ClientID + "','" + txtCooldown.ClientID + "','" + txtCR2.ClientID + "','" + txtStorage.ClientID + "','" + radClassificationM.ClientID + "','" + radClassificationL.ClientID + "','" + radVendorE.ClientID + "','" + radVendorH.ClientID + "','" + ddlLocation.ClientID + "','" + txtSerial.ClientID + "')";
                            radClassificationM.Attributes.Add("onclick", "ShowHideDiv('" + trMainstream1.ClientID + "','inline');ShowHideDiv('" + trMainstream2.ClientID + "','inline');ShowHideDiv('" + trMainstream3.ClientID + "','inline');");
                            radClassificationL.Attributes.Add("onclick", "ShowHideDiv('" + trMainstream1.ClientID + "','none');ShowHideDiv('" + trMainstream2.ClientID + "','none');ShowHideDiv('" + trMainstream3.ClientID + "','none');");
                            imgPreCooldown.Attributes.Add("onclick", "return ShowCalendar('" + txtPreCooldown.ClientID + "');");
                            imgCooldown.Attributes.Add("onclick", "return ShowCalendar('" + txtCooldown.ClientID + "');");
                            strAmount = dsDecommission.Tables[0].Rows[0]["reclaimed_storage"].ToString();
                        }
                        if (intServiceBackup == intService)
                        {
                            panBackup.Visible = true;
                            strRequired       = "ValidateNumber0('" + txtBackup.ClientID + "', 'Please enter a valid amount')";
                            strAmount         = dsDecommission.Tables[0].Rows[0]["reclaimed_backup"].ToString();
                        }
                        Storage oStorage = new Storage(0, dsn);
                        DataSet dsDW     = oStorage.GetStorageDW(dsDecommission.Tables[0].Rows[0]["servername"].ToString());
                        if (dsDW.Tables[0].Rows.Count > 0)
                        {
                            lblStorageAmt.Text         = dsDW.Tables[0].Rows[0]["StorageAmt"].ToString();
                            lblStorageTier.Text        = dsDW.Tables[0].Rows[0]["Tier"].ToString();
                            lblStorageEnvironment.Text = dsDW.Tables[0].Rows[0]["Environment"].ToString();
                            if (intServiceStorage == intService)
                            {
                                lblStorage.Text = " of " + dsDW.Tables[0].Rows[0]["StorageAmt"].ToString() + " GB on <b>" + dsDW.Tables[0].Rows[0]["Environment"].ToString() + "</b>";
                            }
                            if (intServiceBackup == intService)
                            {
                                lblBackup.Text = " of " + dsDW.Tables[0].Rows[0]["StorageAmt"].ToString() + " GB on <b>" + dsDW.Tables[0].Rows[0]["Environment"].ToString() + "</b>";
                            }
                        }
                        DateTime datPreCooldown = DateTime.MinValue;
                        DateTime.TryParse(dsDecommission.Tables[0].Rows[0]["reclaimed_storage_precooldown"].ToString(), out datPreCooldown);
                        if (datPreCooldown != DateTime.MinValue)
                        {
                            txtPreCooldown.Text = datPreCooldown.ToShortDateString();
                        }
                        DateTime datCooldown = DateTime.MinValue;
                        DateTime.TryParse(dsDecommission.Tables[0].Rows[0]["reclaimed_storage_cooldown"].ToString(), out datCooldown);
                        if (datCooldown != DateTime.MinValue)
                        {
                            txtCooldown.Text = datCooldown.ToShortDateString();
                        }
                        txtCR2.Text = dsDecommission.Tables[0].Rows[0]["reclaimed_storage_cr2"].ToString();
                        radClassificationM.Checked = (dsDecommission.Tables[0].Rows[0]["reclaimed_storage_classification"].ToString() == "M");
                        radClassificationL.Checked = (dsDecommission.Tables[0].Rows[0]["reclaimed_storage_classification"].ToString() == "L");
                        if (radClassificationM.Checked)
                        {
                            trMainstream1.Style["display"] = trMainstream2.Style["display"] = trMainstream3.Style["display"] = "inline";
                            radVendorE.Checked             = (dsDecommission.Tables[0].Rows[0]["reclaimed_storage_vendor"].ToString() == "E");
                            radVendorH.Checked             = (dsDecommission.Tables[0].Rows[0]["reclaimed_storage_vendor"].ToString() == "H");
                            ddlLocation.SelectedValue      = dsDecommission.Tables[0].Rows[0]["reclaimed_storage_location"].ToString();
                            txtSerial.Text = dsDecommission.Tables[0].Rows[0]["reclaimed_storage_array"].ToString();
                        }
                        txtNotes.Text = dsDecommission.Tables[0].Rows[0]["reclaimed_storage_notes"].ToString();
                    }
                }
                lblService.Text = oService.Get(intService, "name");
                int intApp = oRequestItem.GetItemApplication(intItem);

                if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>");
                }
                if (Request.QueryString["status"] != null && Request.QueryString["status"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Updates has been Added');<" + "/" + "script>");
                }
                if (!IsPostBack)
                {
                    if (intServiceStorage == intService || intServiceBackup == intService)
                    {
                        if (intServer > 0)
                        {
                            txtStorage.Text = txtBackup.Text = oServer.Get(intServer, (intServiceStorage == intService ? "reclaimed_storage" : "reclaimed_backup"));
                        }
                        else
                        {
                            txtStorage.Text = txtBackup.Text = strAmount;
                        }
                    }
                    double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                    lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent);
                    if (dblAllocated == dblUsed)
                    {
                        if (boolComplete == false)
                        {
                            oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                            btnComplete.Attributes.Add("onclick", "return " + strRequired + " && confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();");
                        }
                        else
                        {
                            oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                            btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;");
                        }
                    }
                    else
                    {
                        btnComplete.ImageUrl = "/images/tool_complete_dbl.gif";
                        btnComplete.Enabled  = false;
                    }
                    bool boolSLABreached = false;
                    if (oService.Get(intService, "sla") != "")
                    {
                        oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");
                        int intDays = oResourceRequest.GetSLA(intResourceParent);
                        if (intDays > -99999)
                        {
                            if (intDays < 1)
                            {
                                btnSLA.Style["border"] = "solid 2px #FF0000";
                            }
                            else if (intDays < 3)
                            {
                                btnSLA.Style["border"] = "solid 2px #FF9999";
                            }
                            boolSLABreached = (intDays < 0);
                            btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');");
                        }
                        else
                        {
                            btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                            btnSLA.Enabled  = false;
                        }
                    }
                    else
                    {
                        btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                        btnSLA.Enabled  = false;
                    }
                    oFunction.ConfigureToolButton(btnEmail, "/images/tool_email");
                    btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=GENERIC');");
                    dblUsed       = (dblUsed / dblAllocated) * 100;
                    strCheckboxes = oServiceDetail.LoadCheckboxes(intRequest, intItem, intNumber, intResourceWorkflow, intService);
                    if (oService.Get(intService, "tasks") != "1" || strCheckboxes == "")
                    {
                        if (oService.Get(intService, "no_slider") == "1")
                        {
                            panNoSlider.Visible  = true;
                            btnComplete.ImageUrl = "/images/tool_complete.gif";
                            btnComplete.Enabled  = true;
                            btnComplete.Attributes.Add("onclick", "return " + strRequired + " && confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();");
                            btnComplete.CommandArgument = "FAST";
                        }
                        else
                        {
                            panSlider.Visible      = true;
                            sldHours._StartPercent = dblUsed.ToString();
                            sldHours._TotalHours   = dblAllocated.ToString();
                        }
                    }
                    else
                    {
                        panCheckboxes.Visible = true;
                    }
                    intProject          = oRequest.GetProjectNumber(intRequest);
                    hdnTab.Value        = "D";
                    panWorkload.Visible = true;
                    bool boolRed = LoadStatus(intResourceWorkflow);
                    if (boolRed == false && boolSLABreached == true)
                    {
                        btnComplete.Attributes.Add("onclick", "alert('NOTE: Your Service Level Agreement (SLA) has been breached!\\n\\nYou must provide a RED STATUS update with an explanation of why your SLA was breached for this request.\\n\\nOnce a RED STATUS update has been provided, you will be able to complete this request.');return false;");
                    }
                    LoadChange(intResourceWorkflow);
                    LoadInformation(intResourceWorkflow);
                    chkDescription.Checked = (Request.QueryString["doc"] != null);
                    lblDocuments.Text      = oDocument.GetDocuments_Service(intRequest, intService, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null));
                    // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                    //lblDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, 0, intRequest, 0, 1, (Request.QueryString["doc"] != null), false);

                    btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                    oFunction.ConfigureToolButton(btnSave, "/images/tool_save");
                    oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                    btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                    oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                    btnClose.Attributes.Add("onclick", "return ExitWindow();");
                    btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "') && ProcessControlButton();");
                    btnChange.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter a change control number')" +
                                             " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid implementation date')" +
                                             " && ValidateTime('" + txtTime.ClientID + "','Please enter a valid implementation time')" +
                                             " && ProcessControlButton()" +
                                             ";");
                    imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
                    // 6/1/2009 - Load ReadOnly View
                    if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false)
                    {
                        oFunction.ConfigureToolButtonRO(btnSave, btnComplete);
                        //panDenied.Visible = true;
                    }
                }
            }
            else
            {
                panDenied.Visible = true;
            }
        }
        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));
                    }
                }
            }
        private void LoadValues()
        {
            //int intRequest = Int32.Parse(Request.QueryString["rid"]);
            //DataSet dsItems = oRequestItem.GetForms(intRequest);
            //if (dsItems.Tables[0].Rows.Count > 0)
            //{
            //    foreach (DataRow drItem in dsItems.Tables[0].Rows)
            //    {
            //        if (drItem["done"].ToString() == "-1")
            //        {
            //            lblItem.Text = drItem["itemid"].ToString();
            //            lblNumber.Text = drItem["number"].ToString();
            //            break;
            //        }
            //    }
            //}
            int     intRequest = Int32.Parse(Request.QueryString["rid"]);
            DataSet dsItems;
            int     intForm = 0;

            if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "")
            {
                intForm = Int32.Parse(Request.QueryString["formid"]);
                dsItems = oRequestItem.GetForm(intRequest, intForm);
            }
            else
            {
                dsItems = oRequestItem.GetForms(intRequest);
            }
            if (dsItems.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (drItem["done"].ToString() == "-1" || intForm > 0)
                    {
                        lblItem.Text = drItem["itemid"].ToString();
                        if (intForm > 0 && Request.QueryString["num"] != null && Request.QueryString["num"] != "")
                        {
                            lblNumber.Text = Request.QueryString["num"];
                        }
                        else
                        {
                            lblNumber.Text = drItem["number"].ToString();
                        }
                        break;
                    }
                }
            }
            // Load Data
            if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "")
            {
                int     intItem   = Int32.Parse(lblItem.Text);
                int     intNumber = Int32.Parse(lblNumber.Text);
                DataSet dsEdit    = oCustomized.GetDecommissionServer(intRequest, intItem, intNumber);
                if (dsEdit.Tables[0].Rows.Count > 0)
                {
                    DataRow drEdit = dsEdit.Tables[0].Rows[0];
                    panEdit.Visible     = true;
                    txtName.Text        = drEdit["servername"].ToString();
                    btnContinue.Enabled = false;
                    //btnBack.Enabled = false;
                    strEdit       = oCustomized.GetDecommissionServerBody(intRequest, intItem, intNumber, dsnAsset);
                    txtPower.Text = drEdit["poweroff_new"].ToString();
                    if (drEdit["poweroff_new"].ToString() == "")
                    {
                        txtPower.Text = DateTime.Parse(drEdit["poweroff"].ToString()).ToShortDateString();
                    }
                    else
                    {
                        txtPower.Text = DateTime.Parse(drEdit["poweroff_new"].ToString()).ToShortDateString();
                    }
                }
                btnNext.Text = "Update";
                btnBack.Text = "Cancel";
                btnNext.Attributes.Add("onclick", "return ValidateDate('" + txtPower.ClientID + "','Please enter a valid date')" +
                                       " && ValidateDateToday('" + txtPower.ClientID + "','The date must occur after today')" +
                                       " && ProcessButton(this)" +
                                       ";");
                btnCancel1.Visible = false;
            }
        }