protected void btnStep_Click(Object Sender, EventArgs e)
        {
            string strError       = "";
            int    intWorkstation = Int32.Parse(lblWorkstation.Text);

            if (chkStep.Checked == true)
            {
                int     intAsset2 = 0;
                int     intStep   = 0;
                DataSet ds        = oWorkstation.GetVirtualErrors(intWorkstation);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr["assetid"].ToString() != "")
                    {
                        intAsset2 = Int32.Parse(dr["assetid"].ToString());
                    }
                    if (dr["fixed"].ToString() == "")
                    {
                        intStep = Int32.Parse(dr["step"].ToString());
                    }
                }
                if (intWorkstation > 0)
                {
                    oWorkstation.UpdateVirtualError(intWorkstation, intStep, 0, 0);
                    if (intAsset2 > 0)
                    {
                        string strSerial = oAsset.Get(intAsset2, "serial");
                        oZeus.UpdateResults(strSerial);
                    }
                    else
                    {
                        strError = "Warning: Invalid AssetID";
                    }
                }
                else
                {
                    strError = "Error: Invalid WorkstationID";
                }
            }
            if (chkStepVMWare.Checked == true)
            {
                VMWare oVMWare            = new VMWare(0, dsn);
                int    intWorkstationName = 0;
                Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "nameid"), out intWorkstationName);
                oVMWare.DeleteGuest(oWorkstation.GetName(intWorkstationName));
            }
            oWorkstation.UpdateVirtualStep(intWorkstation, Int32.Parse(txtStep.Text));
            Response.Redirect(Request.Path + "?q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&admin=true&menu_tab=6&result=" + oFunction.encryptQueryString((strError == "" ? "Success" : strError)));
        }
Esempio n. 2
0
        //decommission Guest
        protected void btnDecommissionGuests_Click(object sender, EventArgs e)
        {
            Asset        oAsset       = new Asset(intProfile, dsnAsset);
            Workstations oRemote      = new Workstations(intProfile, dsnRemote);
            Workstations oWorkstation = new Workstations(intProfile, dsn);
            Domains      oDomain      = new Domains(intProfile, dsn);

            foreach (TreeNode node in tvVirtualHostnGuests.CheckedNodes)
            {
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    if (dr["id"].ToString() == node.Value.ToString())
                    {
                        int     intID         = Int32.Parse(dr["id"].ToString());
                        int     intName       = Int32.Parse(dr["nameid"].ToString());
                        string  strName       = oWorkstation.GetName(intName);
                        int     intHost       = Int32.Parse(dr["virtualhostid"].ToString());
                        int     intAsset      = Int32.Parse(dr["assetid"].ToString());
                        int     intOS         = Int32.Parse(dr["osid"].ToString());
                        string  strHost       = oAsset.GetServerOrBlade(intHost, "name");
                        string  strVirtualDir = "";
                        DataSet dsOS          = oAsset.GetVirtualHostOs(intHost);
                        foreach (DataRow drOS in dsOS.Tables[0].Rows)
                        {
                            if (Int32.Parse(drOS["osid"].ToString()) == intOS)
                            {
                                strVirtualDir = drOS["virtualdir"].ToString();
                                break;
                            }
                        }
                        int intDomain = Int32.Parse(dr["domainid"].ToString());
                        int intEnv    = Int32.Parse(oDomain.Get(intDomain, "environment"));
                        oRemote.AddRemoteVirtualDecom(intEnv, strHost, strVirtualDir, strName);
                        // Clean up database
                        oWorkstation.DeleteVirtual(intID);
                        oWorkstation.UpdateName(intName, 1);
                        oAsset.DeleteGuest(intAsset);
                        oAsset.AddStatus(intAsset, "", (int)AssetStatus.Decommissioned, intProfile, DateTime.Now);
                    }
                }
            }
            Response.Redirect(oPage.GetFullLink(intPage) + "?id=" + intId + "&div=X");
            //LoadControls();
        }
        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();
            //            lblService.Text = drItem["serviceid"].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();
                        lblService.Text = drItem["serviceid"].ToString();
                        if (intForm > 0 && Request.QueryString["num"] != null && Request.QueryString["num"] != "")
                        {
                            lblNumber.Text = Request.QueryString["num"];
                        }
                        else
                        {
                            lblNumber.Text = drItem["number"].ToString();
                        }
                        break;
                    }
                }
            }
            else
            {
                lblService.Text = intForm.ToString();
            }
            // Load Data
            if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "")
            {
                int     intItem   = Int32.Parse(lblItem.Text);
                int     intNumber = Int32.Parse(lblNumber.Text);
                DataSet dsEdit    = oWorkstation.GetVirtualRebuild(intRequest, intForm, intNumber);
                foreach (DataRow drEdit in dsEdit.Tables[0].Rows)
                {
                    if (drEdit["cancelled"].ToString() == "")
                    {
                        int intName = 0;
                        if (Int32.TryParse(drEdit["nameid"].ToString(), out intName) == true)
                        {
                            lblId.Text          = drEdit["workstationid"].ToString();
                            txtDate.Text        = DateTime.Parse(drEdit["scheduled"].ToString()).ToShortDateString();
                            txtName.Text        = lblName.Text = oWorkstation.GetName(intName);
                            btnContinue.Enabled = false;
                            panFound.Visible    = true;
                            btnNext.Text        = "Update";
                            btnBack.Text        = "Cancel";
                            btnNext.Attributes.Add("onclick", "return ValidateDate('" + txtDate.ClientID + "','Please enter a valid date')" +
                                                   " && ValidateDateToday('" + txtDate.ClientID + "','The date must occur after today')" +
                                                   " && ProcessButton(this) && LoadWait()" +
                                                   ";");
                            btnCancel1.Visible = false;
                        }
                        break;
                    }
                }
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            intProfile   = 0;
            oWorkstation = new Workstations(intProfile, dsn);
            oRemote      = new Workstations(intProfile, dsnRemote);
            oUser        = new Users(intProfile, dsn);
            oVariable    = new Variables(intEnvironment);
            oOnDemand    = new OnDemand(intProfile, dsn);
            oForecast    = new Forecast(intProfile, dsn);
            oClass       = new Classes(intProfile, dsn);
            string strUsers = "";

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int     intWorkstation = Int32.Parse(Request.QueryString["id"]);
                DataSet ds             = oWorkstation.GetVirtual(intWorkstation);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intStep   = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
                    intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    intAsset  = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                    intRemote = Int32.Parse(ds.Tables[0].Rows[0]["remoteid"].ToString());
                    int     intClass  = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
                    int     intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString());
                    Domains oDomain   = new Domains(intProfile, dsn);
                    lblDomain.Text = oDomain.Get(intDomain, "name");
                    intDomain      = Int32.Parse(oDomain.Get(intDomain, "environment"));
                    int intName = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString());
                    lblWorkstation.Text = oWorkstation.GetName(intName);
                    txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
                    DataSet dsAccounts = oWorkstation.GetAccountsVirtual(intAsset);
                    rptAccounts.DataSource = dsAccounts;
                    rptAccounts.DataBind();
                    foreach (RepeaterItem ri in rptAccounts.Items)
                    {
                        LinkButton _delete = (LinkButton)ri.FindControl("btnDelete");
                        _delete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this account?');");
                    }
                    foreach (DataRow drAccount in dsAccounts.Tables[0].Rows)
                    {
                        strUsers += oUser.GetName(Int32.Parse(drAccount["userid"].ToString())) + ";";
                    }
                    if (rptAccounts.Items.Count == 0)
                    {
                        lblNone.Visible = true;
                        btnSubmit.Attributes.Add("onclick", "alert('You must add at least one account or select the skip button');return false;");
                    }
                    if (oClass.IsProd(intClass))
                    {
                        panProduction.Visible = true;
                    }
                    else
                    {
                        panAdmin.Visible = true;
                    }
                }
            }
            else
            {
                btnAdd.Enabled    = false;
                btnSubmit.Enabled = false;
                btnSkip.Enabled   = false;
            }
            btnSkip.Enabled = false;
            //btnSkip.Attributes.Add("onclick", "return confirm('Are you sure you want to skip the account configuration process?');");
            btnAdd.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name') && EnsureAccenture('" + hdnUser.ClientID + "','" + strUsers + "');");
            //btnAdd.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name')" + (boolProduction == true ? " && EnsureAccenture('" + hdnUser.ClientID + "','" + strUsers + "')" : "") + ";");
            btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
        }
Esempio n. 5
0
        protected void MakeChange(bool _override)
        {
            // Check to see if new name already exists
            int    intNameID  = Int32.Parse(lblNameID.Text);
            int    intID      = Int32.Parse(lblID.Text);
            bool   boolExists = false;
            string strName    = Request.Form[hdnName.UniqueID];
            string strError   = "";

            switch (ddlType.SelectedValue)
            {
            case "-1":
                // Workstation
                DataSet dsWorkstation = oWorkstation.GetName(strName);
                if (dsWorkstation.Tables[0].Rows.Count > 0 && dsWorkstation.Tables[0].Rows[0]["available"].ToString() == "0" && _override == false)
                {
                    boolExists = true;
                }
                else
                {
                    // Does not exist or is otherwise available for use - update
                    boolExists = false;
                    // Set old name to available
                    oWorkstation.UpdateName(intNameID, 1);
                    if (dsWorkstation.Tables[0].Rows.Count > 0)
                    {
                        // If name already exists (available is marked or _override = true) then use that
                        intNameID = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["id"].ToString());
                    }
                    else
                    {
                        // Create the name
                        string strSequence = txtWorkstationSequence.Text;
                        intNameID = oWorkstation.AddName(ddlWorkstationEnvironment.SelectedItem.Value, ddlWorkstationCode.SelectedItem.Value, lblWorkstationIdentifier.Text, strSequence.Substring(0, 1), strSequence.Substring(1, 1), strSequence.Substring(2, 1), strSequence.Substring(3, 1), strSequence.Substring(4, 1), strSequence.Substring(5, 1), 0);
                    }
                    // Set new name to unavailable
                    oWorkstation.UpdateName(intNameID, 0);
                    // Update workstation record
                    oWorkstation.UpdateVirtualName(intID, intNameID);
                }
                break;

            case "0":
                // Server (National City)
                int     intNameNCB = oServerName.GetName(strName);
                DataSet dsNCB      = oServerName.Get(intNameNCB);
                if (dsNCB.Tables[0].Rows.Count > 0 && dsNCB.Tables[0].Rows[0]["available"].ToString() == "0" && _override == false)
                {
                    boolExists = true;
                }
                else
                {
                    // Does not exist or is otherwise available for use - update
                    boolExists = false;
                    // Set old name to available
                    oServerName.Update(intNameID, 1);
                    if (dsNCB.Tables[0].Rows.Count > 0)
                    {
                        // If name already exists (available is marked or _override = true) then use that
                        intNameID = intNameNCB;
                    }
                    else
                    {
                        // Create the name
                        string strSequence = txtNCBSequence.Text;
                        intNameID = oServerName.Add(0, txtNCBState.Text + txtNCBCity.Text, ddlNCBFunction.SelectedItem.Value, ddlNCBSiteCode.SelectedItem.Value, strSequence.Substring(0, 1), strSequence.Substring(1, 1), intProfile, "CHANGE", 0);
                    }
                    // Set new name to unavailable
                    oServerName.Update(intNameID, 0);
                    // Update server record
                    oServer.UpdateServerNamed(intID, intNameID);
                }
                break;

            case "1":
                // Server (PNC Financial Services)
                int     intNamePNC = oServerName.GetNameFactory(strName);
                DataSet dsPNC      = oServerName.GetFactory(intNamePNC);
                if (dsPNC.Tables[0].Rows.Count > 0 && dsPNC.Tables[0].Rows[0]["available"].ToString() == "0" && _override == false)
                {
                    boolExists = true;
                }
                else
                {
                    // Does not exist or is otherwise available for use - update
                    boolExists = false;
                    // Set old name to available
                    oServerName.UpdateFactory(intNameID, 1);
                    if (dsPNC.Tables[0].Rows.Count > 0)
                    {
                        // If name already exists (available is marked or _override = true) then use that
                        intNameID = intNamePNC;
                    }
                    else
                    {
                        // Create the name
                        string strSequence = txtPNCSequence.Text;
                        intNameID = oServerName.AddFactory(ddlPNCOS.SelectedItem.Value, ddlPNCLocation.SelectedItem.Value, Request.Form["hdnPNCMnemonic"], ddlPNCEnvironment.SelectedItem.Value, strSequence.Substring(0, 1), strSequence.Substring(1, 1), ddlPNCFunction.SelectedItem.Value, ddlPNCSpecific.SelectedItem.Value, intProfile, "CHANGE", 0);
                    }
                    // Set new name to unavailable
                    oServerName.UpdateFactory(intNameID, 0);
                    // Update server record
                    oServer.UpdateServerNamed(intID, intNameID);
                }
                break;
            }

            if (boolExists == true)
            {
                panExists.Visible  = true;
                lblAlready.Text    = strName;
                panChange.Visible  = false;
                panButtons.Visible = false;
                btnAlreadyCancel.Focus();
            }
            else
            {
                if (strError == "")
                {
                    // Update asset
                    oAsset.AddStatus(intAsset, strName, intStatus, intProfile, DateTime.Now);
                    // Redirect
                    Response.Redirect(Request.Path + "?assetid=" + intAsset.ToString() + "&clear=" + radClear.SelectedItem.Value + "&changed=true");
                }
                else
                {
                    // Build Error Message
                    Response.Redirect(Request.Path + "?assetid=" + intAsset.ToString() + "&clear=" + radClear.SelectedItem.Value + "&error=" + strError);
                }
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Int32.TryParse(Request.Cookies["profileid"].Value, out intProfile);
            oServer      = new Servers(intProfile, dsn);
            oServerName  = new ServerName(intProfile, dsn);
            oWorkstation = new Workstations(intProfile, dsn);
            oAsset       = new Asset(intProfile, dsnAsset, dsn);

            Int32.TryParse(Request.QueryString["assetid"], out intAsset);

            bool boolMessage = false;

            if (Request.QueryString["changed"] != null)
            {
                boolMessage = true;
                Page.ClientScript.RegisterStartupScript(typeof(Page), "changed", "<script type=\"text/javascript\">alert('Device Name Changed Successfully!');RefreshOpeningWindow();window.close();<" + "/" + "script>");
            }
            if (Request.QueryString["cleared"] != null)
            {
                boolMessage = true;
                Page.ClientScript.RegisterStartupScript(typeof(Page), "cleared", "<script type=\"text/javascript\">alert('Device Name Cleared Successfully!');RefreshOpeningWindow();window.close();<" + "/" + "script>");
            }
            if (Request.QueryString["error"] != null)
            {
                boolMessage = true;
                Page.ClientScript.RegisterStartupScript(typeof(Page), "bad", "<script type=\"text/javascript\">alert('There was a problem changing the device name...\\n\\n" + Request.QueryString["error"] + "');<" + "/" + "script>");
            }

            if (Int32.TryParse(oAsset.GetStatus(intAsset, "status"), out intStatus) == true)
            {
                if (!IsPostBack)
                {
                    string strAdditional = "";
                    if (intAsset > 0 && Int32.TryParse(oAsset.GetStatus(intAsset, "status"), out intStatus) == true)
                    {
                        if (Request.QueryString["clear"] != null)
                        {
                            if (Request.QueryString["clear"] == "Clear")
                            {
                                radClear.SelectedValue = "Clear";
                                if (intStatus == (int)AssetStatus.InUse)
                                {
                                    lblError.Text = "Can not clear the name of an asset while its Status is &quot;In Use&quot;.";
                                }
                                panClear.Visible = true;
                                panID.Visible    = true;
                            }
                            if (Request.QueryString["clear"] == "Change")
                            {
                                radClear.SelectedValue = "Change";
                                panChange.Visible      = true;
                                panID.Visible          = true;
                            }
                        }
                        DataSet dsWorkstations = oWorkstation.GetVirtualAsset(intAsset);
                        if (dsWorkstations.Tables[0].Rows.Count == 1)
                        {
                            radClear.Items[0].Enabled = false;
                            radClear.Items[0].Text   += " - cannot clear device name for workstations";

                            ddlType.SelectedValue = "-1";
                            int intWorkstation = 0;
                            int intName        = 0;
                            if (Int32.TryParse(dsWorkstations.Tables[0].Rows[0]["id"].ToString(), out intWorkstation) == true)
                            {
                                lblID.Text = intWorkstation.ToString();
                                if (Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "nameid"), out intName) == true)
                                {
                                    lblNameID.Text         = intName.ToString();
                                    lblName.Text           = oWorkstation.GetName(intName);
                                    lblNew.Text            = lblName.Text;
                                    panWorkstation.Visible = true;

                                    DataSet dsWorkstation = oWorkstation.GetNameId(intName);
                                    if (dsWorkstation.Tables[0].Rows.Count == 1)
                                    {
                                        DataRow drWorkstation = dsWorkstation.Tables[0].Rows[0];

                                        #region WORKSTATION NAMING
                                        // Environment
                                        ddlWorkstationEnvironment.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblWorkstationEnvironment.ClientID + "','WORKSTATION');");
                                        lblWorkstationEnvironment.Text          = drWorkstation["environment"].ToString();
                                        ddlWorkstationEnvironment.SelectedValue = lblWorkstationEnvironment.Text;

                                        // Code
                                        ddlWorkstationCode.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblWorkstationCode.ClientID + "','WORKSTATION');");
                                        lblWorkstationCode.Text          = drWorkstation["code"].ToString();
                                        ddlWorkstationCode.SelectedValue = lblWorkstationCode.Text;

                                        //Sequence
                                        txtWorkstationSequence.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblWorkstationSequence.ClientID + "','WORKSTATION');");
                                        lblWorkstationSequence.Text = drWorkstation["prefix1"].ToString() + drWorkstation["prefix2"].ToString() + drWorkstation["prefix3"].ToString() + drWorkstation["prefix4"].ToString() + drWorkstation["prefix5"].ToString() + drWorkstation["prefix6"].ToString();
                                        txtWorkstationSequence.Text = lblWorkstationSequence.Text;

                                        panButtons.Visible = (Request.QueryString["clear"] != null);
                                        lblNew.Text        = lblWorkstationEnvironment.Text + lblWorkstationCode.Text + lblWorkstationIdentifier.Text + lblWorkstationSequence.Text;
                                        strAdditional     += "ValidateTextLength('" + txtWorkstationSequence.ClientID + "', 'Please enter a valid sequence\\n\\n - Must be exactly 6 characters in length', 6) && ";

                                        #endregion
                                    }
                                }
                                else
                                {
                                    lblError.Text = "Invalid Workstation Name Record(" + oWorkstation.GetVirtual(intWorkstation, "nameid") + ")";
                                }
                            }
                            else
                            {
                                lblError.Text = "Invalid Workstation Record(" + dsWorkstations.Tables[0].Rows[0]["id"].ToString() + ")";
                            }
                        }
                        else
                        {
                            DataSet dsServers = oServer.GetAssetsAsset(intAsset);
                            if (dsServers.Tables[0].Rows.Count == 1)
                            {
                                int intServer = 0;
                                int intName   = 0;
                                if (Int32.TryParse(dsServers.Tables[0].Rows[0]["serverid"].ToString(), out intServer) == true)
                                {
                                    lblID.Text = intServer.ToString();
                                    if (Int32.TryParse(oServer.Get(intServer, "nameid"), out intName) == true)
                                    {
                                        lblNameID.Text = intName.ToString();
                                        lblName.Text   = oServer.GetName(intServer, true);
                                        if (oServer.Get(intServer, "pnc") == "1")
                                        {
                                            ddlType.SelectedValue = "1";
                                            panPNC.Visible        = true;
                                            DataSet dsPNC = oServerName.GetFactory(intName);
                                            if (dsPNC.Tables[0].Rows.Count == 1 || intName == 0)
                                            {
                                                //Operating System
                                                OperatingSystems oOperatingSystem = new OperatingSystems(intProfile, dsn);
                                                DataSet          dsOS             = oOperatingSystem.Gets(0, 1);
                                                DataView         dvOS             = dsOS.Tables[0].DefaultView;
                                                dvOS.RowFilter          = "factory_code <> '' AND factory_code IS NOT NULL";
                                                ddlPNCOS.DataTextField  = "name";
                                                ddlPNCOS.DataValueField = "factory_code";
                                                ddlPNCOS.DataSource     = dvOS;
                                                ddlPNCOS.DataBind();
                                                ddlPNCOS.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCOS.ClientID + "','PNC');");

                                                //Location
                                                Locations oLocation  = new Locations(intProfile, dsn);
                                                DataSet   dsLocation = oLocation.GetAddresss(1);
                                                DataView  dvLocation = dsLocation.Tables[0].DefaultView;
                                                dvLocation.RowFilter          = "factory_code <> 'X' AND factory_code <> '' AND factory_code IS NOT NULL";
                                                ddlPNCLocation.DataTextField  = "commonname";
                                                ddlPNCLocation.DataValueField = "factory_code";
                                                ddlPNCLocation.DataSource     = dvLocation;
                                                ddlPNCLocation.DataBind();
                                                ddlPNCLocation.Items.Add(new ListItem("Other", "X"));
                                                ddlPNCLocation.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCLocation.ClientID + "','PNC');");

                                                //Mnemonic
                                                Variables oVariable = new Variables(intEnvironment);
                                                Mnemonic  oMnemonic = new Mnemonic(intProfile, dsn);
                                                txtPNCMnemonic.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'350','150','" + divPNCMnemonic.ClientID + "','" + lstPNCMnemonic.ClientID + "','" + hdnPNCMnemonic.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_mnemonics.aspx',2);");
                                                lstPNCMnemonic.Attributes.Add("ondblclick", "AJAXClickRow();");
                                                hdnPNCMnemonic.Attributes.Add("onpropertychange", "UpdateNamingMnemonic('" + hdnPNCMnemonic.ClientID + "','" + txtPNCMnemonic.ClientID + "','" + lblPNCMnemonic.ClientID + "','PNC');");

                                                //Environment
                                                Classes  oClass  = new Classes(intProfile, dsn);
                                                DataSet  dsClass = oClass.Gets(1);
                                                DataView dvClass = dsClass.Tables[0].DefaultView;
                                                dvClass.RowFilter = "factory_code <> '' AND factory_code IS NOT NULL";
                                                ddlPNCEnvironment.DataTextField  = "name";
                                                ddlPNCEnvironment.DataValueField = "factory_code";
                                                ddlPNCEnvironment.DataSource     = dvClass;
                                                ddlPNCEnvironment.DataBind();
                                                ddlPNCEnvironment.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCEnvironment.ClientID + "','PNC');");

                                                //Sequence
                                                txtPNCSequence.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblPNCSequence.ClientID + "','PNC');");

                                                //Function
                                                ddlPNCFunction.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCFunction.ClientID + "','PNC');");

                                                //Specific
                                                ddlPNCSpecific.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCSpecific.ClientID + "','PNC');");

                                                #region PNC NAMING
                                                if (intName > 0)
                                                {
                                                    DataRow drPNC = dsPNC.Tables[0].Rows[0];
                                                    //Operating System
                                                    lblPNCOS.Text          = drPNC["os"].ToString();
                                                    ddlPNCOS.SelectedValue = lblPNCOS.Text;
                                                    //Location
                                                    lblPNCLocation.Text          = drPNC["location"].ToString();
                                                    ddlPNCLocation.SelectedValue = lblPNCLocation.Text;
                                                    //Mnemonic
                                                    lblPNCMnemonic.Text = drPNC["mnemonic"].ToString();
                                                    DataSet dsMnemonic  = oMnemonic.Get(lblPNCMnemonic.Text + " - ");
                                                    int     intMnemonic = Int32.Parse(dsMnemonic.Tables[0].Rows[0]["id"].ToString());
                                                    hdnPNCMnemonic.Value = intMnemonic.ToString();
                                                    txtPNCMnemonic.Text  = lblPNCMnemonic.Text + " - " + oMnemonic.Get(intMnemonic, "name");
                                                    //Environment
                                                    lblPNCEnvironment.Text          = drPNC["environment"].ToString();
                                                    ddlPNCEnvironment.SelectedValue = lblPNCEnvironment.Text;
                                                    //Sequence
                                                    lblPNCSequence.Text = drPNC["name1"].ToString() + drPNC["name2"].ToString();
                                                    txtPNCSequence.Text = lblPNCSequence.Text;
                                                    //Function
                                                    lblPNCFunction.Text          = drPNC["func"].ToString();
                                                    ddlPNCFunction.SelectedValue = lblPNCFunction.Text;
                                                    //Specific
                                                    lblPNCSpecific.Text          = drPNC["specific"].ToString();
                                                    ddlPNCSpecific.SelectedValue = lblPNCSpecific.Text;
                                                }
                                                else
                                                {
                                                    //Operating System
                                                    ddlPNCOS.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCOS.ClientID + "','Please select an Operating System') && ";
                                                    //Location
                                                    ddlPNCLocation.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCLocation.ClientID + "','Please select a Location') && ";
                                                    //Mnemonic
                                                    strAdditional += "ValidateHidden0('" + hdnPNCMnemonic.ClientID + "','" + txtPNCMnemonic.ClientID + "','Please enter the mnemonic') && ";
                                                    //Environment
                                                    ddlPNCEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCEnvironment.ClientID + "','Please select an Environment') && ";
                                                    //Sequence - Done down below
                                                    //Function
                                                    ddlPNCFunction.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCFunction.ClientID + "','Please select a Function') && ";
                                                    //Specific
                                                    ddlPNCSpecific.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCSpecific.ClientID + "','Please select an Option') && ";
                                                }

                                                panButtons.Visible = (Request.QueryString["clear"] != null);
                                                lblNew.Text        = lblPNCOS.Text + lblPNCLocation.Text + lblPNCMnemonic.Text + lblPNCEnvironment.Text + lblPNCSequence.Text + lblPNCFunction.Text + lblPNCSpecific.Text;
                                                strAdditional     += "ValidateTextLength('" + txtPNCSequence.ClientID + "', 'Please enter a valid sequence\\n\\n - Must be exactly 2 characters in length', 2) && ";

                                                #endregion
                                            }
                                            else
                                            {
                                                lblError.Text = "PNC Names (" + dsPNC.Tables[0].Rows.Count.ToString() + ")";
                                            }
                                        }
                                        else
                                        {
                                            ddlType.SelectedValue = "0";
                                            panNCB.Visible        = true;
                                            DataSet dsNCB = oServerName.Get(intName);
                                            if (dsNCB.Tables[0].Rows.Count == 1 || intName == 0)
                                            {
                                                //State
                                                txtNCBState.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblNCBState.ClientID + "','NCB');");

                                                //City
                                                txtNCBCity.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblNCBCity.ClientID + "','NCB');");

                                                //Function
                                                DataSet  dsFunction = oServerName.GetFunctions();
                                                DataView dvFunction = dsFunction.Tables[0].DefaultView;
                                                dvFunction.RowFilter          = "code <> '' AND code IS NOT NULL";
                                                ddlNCBFunction.DataTextField  = "name";
                                                ddlNCBFunction.DataValueField = "code";
                                                ddlNCBFunction.DataSource     = dvFunction;
                                                ddlNCBFunction.DataBind();
                                                ddlNCBFunction.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblNCBFunction.ClientID + "','NCB');");

                                                //SiteCode
                                                ddlNCBSiteCode.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblNCBSiteCode.ClientID + "','NCB');");

                                                //Sequence
                                                txtNCBSequence.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblNCBSequence.ClientID + "','NCB');");

                                                #region NCB NAMING
                                                if (intName > 0)
                                                {
                                                    DataRow drNCB      = dsNCB.Tables[0].Rows[0];
                                                    string  strPrefix  = drNCB["prefix1"].ToString();
                                                    string  strPrefix1 = strPrefix.Substring(0, 2);
                                                    string  strPrefix2 = strPrefix.Substring(2, 3);
                                                    //State
                                                    lblNCBState.Text = strPrefix1;
                                                    txtNCBState.Text = lblNCBState.Text;
                                                    //City
                                                    lblNCBCity.Text = strPrefix2;
                                                    txtNCBCity.Text = lblNCBCity.Text;
                                                    //Function
                                                    lblNCBFunction.Text          = drNCB["prefix2"].ToString();
                                                    ddlNCBFunction.SelectedValue = lblNCBFunction.Text;
                                                    //SiteCode
                                                    lblNCBSiteCode.Text          = drNCB["sitecode"].ToString();
                                                    ddlNCBSiteCode.SelectedValue = lblNCBSiteCode.Text;
                                                    //Sequence
                                                    lblNCBSequence.Text = drNCB["name1"].ToString() + drNCB["name2"].ToString();
                                                    txtNCBSequence.Text = lblNCBSequence.Text;
                                                }
                                                else
                                                {
                                                    //State - Done down below
                                                    //City - Done down below
                                                    //Function
                                                    ddlNCBFunction.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlNCBFunction.ClientID + "','Please select a Function') && ";
                                                    //SiteCode
                                                    ddlNCBSiteCode.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlNCBSiteCode.ClientID + "','Please select a Site Code') && ";
                                                    //Sequence - Done down below
                                                }

                                                panButtons.Visible = (Request.QueryString["clear"] != null);
                                                lblNew.Text        = lblNCBState.Text + lblNCBCity.Text + lblNCBFunction.Text + lblNCBSiteCode.Text + lblNCBSequence.Text;
                                                strAdditional     += "ValidateTextLength('" + txtNCBState.ClientID + "', 'Please enter a valid state\\n\\n - Must be exactly 2 characters in length', 2) && ";
                                                strAdditional     += "ValidateTextLength('" + txtNCBCity.ClientID + "', 'Please enter a valid city\\n\\n - Must be exactly 3 characters in length', 3) && ";
                                                strAdditional     += "ValidateTextLength('" + txtNCBSequence.ClientID + "', 'Please enter a valid sequence\\n\\n - Must be exactly 2 characters in length', 2) && ";

                                                #endregion
                                            }
                                            else
                                            {
                                                lblError.Text = "NCB Names (" + dsNCB.Tables[0].Rows.Count.ToString() + ")";
                                            }
                                        }
                                    }
                                    else
                                    {
                                        lblError.Text = "Invalid Server Name Record(" + oServer.Get(intServer, "nameid") + ")";
                                    }
                                }
                                else
                                {
                                    lblError.Text = "Invalid Server Record(" + dsServers.Tables[0].Rows[0]["serverid"].ToString() + ")";
                                }
                            }
                            else
                            {
                                if (dsWorkstations.Tables[0].Rows.Count > 1)
                                {
                                    lblError.Text = "Workstations (" + dsWorkstations.Tables[0].Rows.Count.ToString() + ")";
                                }
                                else if (dsServers.Tables[0].Rows.Count > 1)
                                {
                                    lblError.Text = "Servers (" + dsServers.Tables[0].Rows.Count.ToString() + ")";
                                }
                                else
                                {
                                    radClear.Items[1].Enabled = false;
                                    panButtons.Visible        = (Request.QueryString["clear"] != null);
                                    //lblError.Text = "Asset Not Found";
                                }
                            }
                        }
                        if (lblName.Text == "")
                        {
                            lblName.Text = "---";
                        }
                        else
                        {
                            lblNew.CssClass = (lblNew.Text == lblName.Text ? "header" : "redheader");
                        }
                        if (panChange.Visible == true)
                        {
                            btnSubmit.Attributes.Add("onclick", "return " + strAdditional + " IsOKtoChange() && confirm('WARNING: This will permanently change the device name and release the previous name for re-use (if applicable)!\\n\\nAre you sure you want to continue?') && ProcessButton(this,'Changing...','100');");
                        }
                        if (panClear.Visible == true)
                        {
                            btnSubmit.Attributes.Add("onclick", "return confirm('WARNING: This will permanently clear the device name and release it for re-use (if applicable)!\\n\\nAre you sure you want to continue?') && ProcessButton(this,'Clearing...','100');");
                        }
                        btnReset.Attributes.Add("onclick", "return IsOKtoReset(this);");
                        btnAlreadyChange.Attributes.Add("onclick", "return confirm('LAST CHANCE! This will permanently change the device name and release the previous name for re-use (if applicable)!\\n\\nAre you sure you want to continue?') && ProcessButton(this,'Changing...','100');");
                    }
                    else
                    {
                        lblError.Text = "Either the asset or the status of the asset could not be identified";
                    }
                }
            }
            else
            {
                lblError.Text = "Either the asset or the status of the asset could not be identified";
            }
            if (lblError.Text != "" && boolMessage == false)
            {
                panError.Visible  = true;
                panClear.Visible  = false;
                btnSubmit.Enabled = false;
            }
        }
Esempio n. 7
0
        public void SystemError(int _serverid, int _workstationid, int _stepid, string _error, int _assetid, int _modelid, bool _is_vmware, VMWare _vmware, int _environment, string _dsn_asset)
        {
            int intError = 0;

            if (_stepid > 0)
            {
                string   strName   = "";
                string   strType   = "";
                int      intID     = 0;
                OnDemand oOnDemand = new OnDemand(0, dsn);
                if (_serverid > 0)
                {
                    oOnDemand.UpdateStepDoneServer(_serverid, _stepid, _error, 1, false, false);
                    Servers oServer = new Servers(0, dsn);
                    intError = oServer.AddError(0, 0, 0, _serverid, _stepid, _error);
                    strName  = oServer.GetName(_serverid, true);
                    strType  = "server";
                    intID    = _serverid;
                }
                if (_workstationid > 0)
                {
                    oOnDemand.UpdateStepDoneWorkstation(_workstationid, _stepid, _error, 1, false, false);
                    Workstations oWorkstation = new Workstations(0, dsn);
                    intError = oWorkstation.AddVirtualError(0, 0, 0, _workstationid, _stepid, _error);
                    int intName = 0;
                    if (Int32.TryParse(oWorkstation.GetVirtual(_workstationid, "nameid"), out intName) == true)
                    {
                        strName = oWorkstation.GetName(intName);
                    }
                    strType = "workstation";
                    intID   = _workstationid;
                }
                if (_serverid > 0 || _workstationid > 0)
                {
                    ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
                    Functions        oFunction         = new Functions(0, dsn, _environment);
                    Variables        oVariable         = new Variables(_environment);
                    Asset            oAsset            = new Asset(0, _dsn_asset);

                    int     intType = oModelsProperties.GetType(_modelid);
                    DataSet dsSteps = oOnDemand.GetSteps(intType, 1);
                    string  strStep = "N / A";
                    if (dsSteps.Tables[0].Rows.Count > 0)
                    {
                        strStep = dsSteps.Tables[0].Rows[_stepid - 1]["name"].ToString();
                    }
                    string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_SUPPORT");
                    try
                    {
                        if (_is_vmware == true)
                        {
                            oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>DataCenter: " + _vmware.DataCenter() + "<br/>Virtual Center: " + _vmware.VirtualCenter() + "</p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                        }
                        else
                        {
                            oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>ILO: <a href=\"https://" + oAsset.GetServerOrBlade(_assetid, "ilo") + "\" target=\"_blank\">" + oAsset.GetServerOrBlade(_assetid, "ilo") + "</a></p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>Notification Error: (Error Message: " + ex.Message + ") (Source: " + ex.Source + ") (Stack Trace: " + ex.StackTrace + ")</p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                    }
                }
            }
            UpdateError(_error);
        }
Esempio n. 8
0
        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 strResult = "";
                        string strError  = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************

                        Workstations oWorkstation = new Workstations(intProfile, dsn);
                        DataSet      dsRebuild    = oWorkstation.GetVirtualRebuild(intRequest, intService, intNumber);
                        bool         found        = false;
                        foreach (DataRow drRebuild in dsRebuild.Tables[0].Rows)
                        {
                            if (drRebuild["cancelled"].ToString() == "")
                            {
                                found = true;
                                int intWorkstation = Int32.Parse(drRebuild["workstationid"].ToString());
                                int intName        = Int32.Parse(drRebuild["nameid"].ToString());
                                oWorkstation.UpdateVirtualRebuild(intRequest, intService, intNumber);
                                string strName  = oWorkstation.GetName(intName);
                                string strPower = drRebuild["scheduled"].ToString();
                                strResult += "<p>The workstation " + strName + " was successfully queued for rebuild on " + strPower + "</p>";
                                strError   = "";
                                break;
                            }
                        }
                        if (found == false)
                        {
                            strError = "<p>There was a problem configuring the workstation for rebuild ~ Request not found.</p>";
                        }

                        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, 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);
            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);
                        Users            oUser             = new Users(intProfile, dsn);
                        Workstations     oWorkstation      = new Workstations(intProfile, dsn);
                        Workstations     oRemote           = new Workstations(intProfile, dsnRemote);
                        Asset            oAsset            = new Asset(intProfile, dsnAsset);
                        Domains          oDomain           = new Domains(intProfile, dsn);
                        ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                        DataSet          ds = oWorkstation.GetVirtualDecommissions(intRequest, intItem, intNumber);
                        strResult = "";
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            int    intID    = Int32.Parse(dr["id"].ToString());
                            int    intName  = Int32.Parse(dr["nameid"].ToString());
                            string strName  = oWorkstation.GetName(intName);
                            int    intAsset = Int32.Parse(dr["assetid"].ToString());
                            int    intModel = Int32.Parse(dr["modelid"].ToString());
                            if (oModelsProperties.IsTypeVMware(intModel) == true)
                            {
                                // VMware Workstation
                                bool boolUnique = oAsset.AddDecommission(intRequest, intItem, intNumber, intAsset, intProfile, "", DateTime.Now, strName, 0, "");
                                if (boolUnique == true)
                                {
                                    oAsset.UpdateDecommission(intRequest, intItem, intNumber, 1);
                                    VMWare  oVMWare    = new VMWare(intProfile, dsn);
                                    DataSet dsGuest    = oVMWare.GetGuest(strName);
                                    string  strCluster = "???";
                                    if (dsGuest.Tables[0].Rows.Count > 0 && dsGuest.Tables[0].Rows[0]["hostid"].ToString() != "")
                                    {
                                        int intHost    = Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString());
                                        int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid"));
                                        strCluster = oVMWare.GetCluster(intCluster, "name");
                                    }
                                    strResult += "<p>The VMware workstation " + strName + " is queued to be decommissioned from the cluster " + strCluster + ".</p>";
                                }
                                else
                                {
                                    strResult += "<p>The VMware workstation " + strName + " is ALREADY queued to be decommissioned</p>";
                                }
                            }
                            else
                            {
                                // Microsoft Virtual Workstation
                                int     intHost       = Int32.Parse(dr["virtualhostid"].ToString());
                                int     intOS         = Int32.Parse(dr["osid"].ToString());
                                string  strHost       = oAsset.GetServerOrBlade(intHost, "name");
                                string  strVirtualDir = "";
                                DataSet dsOS          = oAsset.GetVirtualHostOs(intHost);
                                foreach (DataRow drOS in dsOS.Tables[0].Rows)
                                {
                                    if (Int32.Parse(drOS["osid"].ToString()) == intOS)
                                    {
                                        strVirtualDir = drOS["virtualdir"].ToString();
                                        break;
                                    }
                                }
                                int intDomain = Int32.Parse(dr["domainid"].ToString());
                                int intEnv    = Int32.Parse(oDomain.Get(intDomain, "environment"));
                                oRemote.AddRemoteVirtualDecom(intEnv, strHost, strVirtualDir, strName);
                                // Clean up database
                                oWorkstation.DeleteVirtual(intID);
                                oWorkstation.UpdateName(intName, 1);
                                oAsset.DeleteGuest(intAsset);
                                oAsset.AddStatus(intAsset, "", (int)AssetStatus.Decommissioned, intProfile, DateTime.Now);
                                strResult += "<p>The virtual workstation " + strName + " was successfully decommissioned from the host " + strHost + ".</p>";
                            }
                            strError = "";
                        }
                        oRequest.AddResult(intRequest, intItem, intNumber, "Virtual Workstation Decommission", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intProfile));
                        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, 1);
                    }
                }
            }
        }