Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oOperatingSystem = new OperatingSystems(intProfile, dsn);
     oServicePack     = new ServicePacks(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intOS = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         Load(null);
         if (intOS > 0)
         {
             lblName.Text = oOperatingSystem.Get(intOS, "name");
         }
     }
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/service_packs.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oServicePack = new ServicePacks(intProfile, dsn);
     if (!IsPostBack)
     {
         LoopRepeater();
         btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=SERVICE_PACK" + "',false,400,400);");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
     }
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                    lblError.Text    = "Name Already Exists";
                }
                Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID);
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (intID > 0)
                {
                    DataSet ds = oDataPoint.GetAsset(intID);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | Enclosure (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about an enclosure...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Location Information", "");
                        oTab.AddTab("Virtual Connect IPs", "");
                        oTab.AddTab("Resource Dependencies", "");
                        oTab.AddTab("Provisioning History", "");
                        oTab.AddTab("Blades", "");
                        //oTab.AddTab("Network Adapter Configuration", "");
                        strMenuTab1 = oTab.GetTabs();
                        if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true)
                        {
                            panOldLocationInfo.Visible = true;
                        }

                        if (!IsPostBack)
                        {
                            //DataSet dsAssets = oServer.GetAsset(intAsset);
                            //foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                            //{
                            //    if (drAsset["latest"].ToString() == "1")
                            //    {
                            //        intAsset = Int32.Parse(drAsset["assetid"].ToString());
                            //        intAssetClass = Int32.Parse(drAsset["classid"].ToString());
                            //        intAssetEnv = Int32.Parse(drAsset["environmentid"].ToString());
                            //        break;
                            //    }
                            //}

                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "ENCLOSURE_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "ENCLOSURE_ASSET", strAsset, "", false, true);

                            int intAssetAttribute = Int32.Parse(oAsset.Get(intAsset, "asset_attribute"));
                            oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false);
                            oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true);
                            ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()");

                            ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');");
                            int intModel = Int32.Parse(oAsset.Get(intAsset, "modelid"));

                            hdnModel.Value = intModel.ToString();
                            int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            int intType        = oModel.GetType(intModelParent);
                            int intPlatform    = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "ENCLOSURE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "ENCLOSURE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "ENCLOSURE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "ENCLOSURE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            DataSet dsAsset = oAsset.GetEnclosure(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                oDataPoint.LoadTextBox(txtName, intProfile, null, "", lblName, fldName, "ENCLOSURE_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false);
                                if (txtName.Text != "")
                                {
                                    lblHeader.Text += "&nbsp;&nbsp;&nbsp;[" + txtName.Text + "]";
                                }
                                lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString();
                                int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString());
                                int intEnv   = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString());
                                hdnEnvironment.Value = intEnv.ToString();

                                oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "ENCLOSURE_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "ENCLOSURE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true);
                                oDataPoint.LoadTextBox(txtPlatformVLAN, intProfile, null, "", lblPlatformVLAN, fldPlatformVLAN, "ENCLOSURE_VLAN", dsAsset.Tables[0].Rows[0]["vlan"].ToString(), "", false, true);
                                if (dsAsset.Tables[0].Rows[0]["oa_ip"].ToString() != "")
                                {
                                    oDataPoint.LoadTextBox(txtPlatformOA, intProfile, btnOA, "https://" + dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), lblPlatformOA, fldPlatformOA, "ENCLOSURE_OA", dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), "", false, true);
                                }
                                else
                                {
                                    oDataPoint.LoadTextBox(txtPlatformOA, intProfile, null, "", lblPlatformOA, fldPlatformOA, "ENCLOSURE_OA", dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), "", false, true);
                                }
                                int intResiliency = 0;
                                Int32.TryParse(dsAsset.Tables[0].Rows[0]["resiliencyid"].ToString(), out intResiliency);
                                oDataPoint.LoadDropDown(ddlPlatformResiliency, intProfile, null, "", lblPlatformResiliency, fldPlatformResiliency, "ENCLOSURE_RESILIENCY", "name", "id", oResiliency.Gets(1), intResiliency, false, false, true);

                                lblOldlocation.Text = dsAsset.Tables[0].Rows[0]["OldLocation"].ToString();
                                lblOldRoom.Text     = dsAsset.Tables[0].Rows[0]["OldRoom"].ToString();
                                lblOldRack.Text     = dsAsset.Tables[0].Rows[0]["OldRack"].ToString();

                                txtLocation.Text     = dsAsset.Tables[0].Rows[0]["Location"].ToString();
                                txtRoom.Text         = dsAsset.Tables[0].Rows[0]["Room"].ToString();
                                txtZone.Text         = dsAsset.Tables[0].Rows[0]["Zone"].ToString();
                                txtRack.Text         = dsAsset.Tables[0].Rows[0]["Rack"].ToString();
                                txtRackPosition.Text = dsAsset.Tables[0].Rows[0]["Rackposition"].ToString();
                                oDataPoint.LoadTextBox(txtRackPosition, intProfile, null, "", lblRackPositionValue, fldLocation, "CHANGE_LOCATION", dsAsset.Tables[0].Rows[0]["rackposition"].ToString(), "", false, true);
                                hdnRackId.Value = dsAsset.Tables[0].Rows[0]["NewRackId"].ToString();

                                oDataPoint.LoadButton(btnSelectLocation, intProfile, fldLocation, "CHANGE_LOCATION",
                                                      "return LoadLocationRoomRack('" + "rack" + "','" + hdnRackId.ClientID + "', '" + txtLocation.ClientID + "','" + txtRoom.ClientID + "','" + txtZone.ClientID + "','" + txtRack.ClientID + "');");


                                //DR Counterpart
                                int    intDR = oAsset.GetDR(intAsset);
                                string strDR = oAsset.Get(intDR, "serial");
                                if (intDR > 0)
                                {
                                    oDataPoint.LoadTextBox(txtPlatformDRCounterPart, intProfile, btnPlatformDRCounterPart, "/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(strDR) + "&id=" + oFunction.encryptQueryString(intDR.ToString()), lblPlatformDRCounterPart, fldPlatformDRCounterPart, "BLADE_DR", strDR, "", true, false);
                                }
                                else
                                {
                                    oDataPoint.LoadTextBox(txtPlatformDRCounterPart, intProfile, null, "", lblPlatformDRCounterPart, fldPlatformDRCounterPart, "BLADE_DR", "", "", true, false);
                                }

                                ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString();
                                ddlStatus.Enabled       = (intAssetAttribute == (int)AssetAttribute.Ok);
                                panStatus.Visible       = (ddlStatus.Enabled == false);
                            }
                            else
                            {
                                Response.Redirect("/datapoint/asset/enclosure_deploy.aspx?t=serial&q=" + oFunction.encryptQueryString(strSerial) + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&r=0");
                            }

                            // Resource Dependencies
                            AssetOrder      oAssetOrder     = new AssetOrder(0, dsn, dsnAsset, intEnvironment);
                            Services        oService        = new Services(0, dsn);
                            ServiceRequests oServiceRequest = new ServiceRequests(0, dsn);
                            rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false);
                            rptServiceRequests.DataBind();
                            trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0);
                            foreach (RepeaterItem ri in rptServiceRequests.Items)
                            {
                                Label lblServiceID = (Label)ri.FindControl("lblServiceID");
                                int   intService   = Int32.Parse(lblServiceID.Text);
                                Label lblDetails   = (Label)ri.FindControl("lblDetails");
                                Label lblProgress  = (Label)ri.FindControl("lblProgress");

                                if (lblProgress.Text == "")
                                {
                                    lblProgress.Text = "<i>Unavailable</i>";
                                }
                                else
                                {
                                    int     intResource  = Int32.Parse(lblProgress.Text);
                                    double  dblAllocated = 0.00;
                                    double  dblUsed      = 0.00;
                                    int     intStatus    = 0;
                                    bool    boolAssigned = false;
                                    DataSet dsResource   = oDataPoint.GetServiceRequestResource(intResource);
                                    if (dsResource.Tables[0].Rows.Count > 0)
                                    {
                                        Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus);
                                    }
                                    foreach (DataRow drResource in dsResource.Tables[1].Rows)
                                    {
                                        boolAssigned  = true;
                                        dblAllocated += double.Parse(drResource["allocated"].ToString());
                                        dblUsed      += double.Parse(drResource["used"].ToString());
                                        intStatus     = Int32.Parse(drResource["status"].ToString());
                                    }
                                    if (intStatus == (int)ResourceRequestStatus.Closed)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true);
                                    }
                                    else if (intStatus == (int)ResourceRequestStatus.Cancelled)
                                    {
                                        lblProgress.Text = "Cancelled";
                                    }
                                    else if (boolAssigned == false)
                                    {
                                        string  strManager = "";
                                        DataSet dsManager  = oService.GetUser(intService, 1); // Managers
                                        foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                        {
                                            if (strManager != "")
                                            {
                                                strManager += "\\n";
                                            }
                                            int intManager = Int32.Parse(drManager["userid"].ToString());
                                            strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]";
                                        }
                                        lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>";
                                    }
                                    else if (dblAllocated > 0.00)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                                    }
                                    else
                                    {
                                        lblProgress.Text = "<i>N / A</i>";
                                    }
                                    lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>";
                                }
                            }

                            // Provioning History
                            rptHistory.DataSource = oAsset.GetProvisioningHistory(oDataPoint.AssetHistorySelect(intAsset));
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);
                            oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "ENCLOSURE_STATUS");

                            // Virtual Connects
                            rptVirtualConnect.DataSource = oAsset.GetEnclosureVCs(intAsset, 1);
                            rptVirtualConnect.DataBind();
                            lblVirtualConnect.Visible = (rptVirtualConnect.Items.Count == 0);
                            oDataPoint.LoadButton(btnVC, intProfile, fldVC, "ENCLOSURE_VC", "return OpenWindow('ASSET_DEPLOY_VCs','" + intAsset.ToString() + "');");

                            if (Request.QueryString["highlight"] != null && Request.QueryString["highlight"] != "")
                            {
                                intHighlight = Int32.Parse(Request.QueryString["highlight"]);
                            }
                            // Blades
                            rptBlades.DataSource = oAsset.GetEnclosureBlades(intAsset);
                            rptBlades.DataBind();
                            lblBlades.Visible = (rptBlades.Items.Count == 0);

                            // Redeploy
                            oDataPoint.LoadButton(btnRedeploy, intProfile, fldRedeploy, "ENCLOSURE_REDEPLOY");
                            if (rptBlades.Items.Count == 0)
                            {
                                btnRedeploy.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy this enclosure?') && confirm('WARNING! Redeploying an asset means that ALL the information regarding this asset will be erased.\\n\\nAre you sure you want to redeploy this enclosure?');");
                            }
                            else
                            {
                                btnRedeploy.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy this enclosure?\\n\\WARNING: The blades associated with this enclosure have not been redployed!\\nIt is STRONGLY recommended that you redeploy the blades first to avoid corrupting the asset database.\\n\\nAre you sure you want to continue?');");
                            }
                            oDataPoint.LoadButton(btnRedeployBlades, intProfile, fldRedeployBlades, "ENCLOSURE_REDEPLOY_BLADES");
                            if (rptBlades.Items.Count == 0)
                            {
                                btnRedeployBlades.Attributes.Add("onclick", "alert('All blades have already been redeployed');return false;;");
                            }
                            else
                            {
                                btnRedeployBlades.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy ALL the blades in this enclosure?') && confirm('WARNING! Redeploying an asset means that ALL the information regarding this asset will be erased.\\n\\nAre you sure you want to redeploy ALL the blades in this enclosure?');");
                            }
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "")
                {
                    string  strQuery = oFunction.decryptQueryString(Request.QueryString["q"]);
                    DataSet ds       = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                        Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()));
                    }
                    else
                    {
                        Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?multiple=true&t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"]);
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation());
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation());
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                //ddlLocationState.Attributes.Add("onchange", "LoadLocationCity('" + ddlLocationCity.ClientID + "');LoadLocationAddress('" + ddlLocationAddress.ClientID + "');PopulateCitys('" + ddlLocationState.ClientID + "','" + ddlLocationCity.ClientID + "');ResetDropDownHidden('" + hdnAddress.ClientID + "');");
                //ddlLocationCity.Attributes.Add("onchange", "LoadLocationAddress('" + ddlLocationAddress.ClientID + "');PopulateAddresss('" + ddlLocationCity.ClientID + "','" + ddlLocationAddress.ClientID + "');ResetDropDownHidden('" + hdnAddress.ClientID + "');");
                //ddlLocationAddress.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlLocationAddress.ClientID + "','" + hdnAddress.ClientID + "');");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/servername_components_details.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }

            oServerName       = new ServerName(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oZeus             = new Zeus(intProfile, dsn);
            oAudit            = new Audit(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                if (Request.QueryString["parent"] == null)
                {
                    LoadComponents(oTreeDetails, false, false);
                }
                else
                {
                    panAdd.Visible          = true;
                    ddlParent.SelectedValue = Request.QueryString["parent"];
                    btnDelete.Enabled       = false;
                    strDisabled             = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available when updating an existing item</b></p>";
                    btnUser.Enabled         = false;
                }
            }
            else
            {
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (!IsPostBack)
                {
                    DataSet ds = oServerName.GetComponentDetail(intID);
                    ddlParent.SelectedValue          = ds.Tables[0].Rows[0]["componentid"].ToString();
                    txtName.Text                     = ds.Tables[0].Rows[0]["name"].ToString();
                    ddlZEUSArrayConfig.SelectedValue = ds.Tables[0].Rows[0]["zeus_array_config_id"].ToString();
                    ddlZEUSBuildType.SelectedValue   = ds.Tables[0].Rows[0]["zeus_build_type_id"].ToString();
                    chkApproval.Checked              = (ds.Tables[0].Rows[0]["approval"].ToString() == "1");
                    chkModels.Checked                = (ds.Tables[0].Rows[0]["models"].ToString() == "1");
                    chkNetworks.Checked              = (ds.Tables[0].Rows[0]["networks"].ToString() == "1");
                    chkInstall.Checked               = (ds.Tables[0].Rows[0]["install"].ToString() == "1");
                    chkMount.Checked                 = (ds.Tables[0].Rows[0]["mount"].ToString() == "1");
                    txtNetworkPath.Text              = ds.Tables[0].Rows[0]["network_path"].ToString();
                    txtInstallPath.Text              = ds.Tables[0].Rows[0]["install_path"].ToString();
                    txtAD.Text = ds.Tables[0].Rows[0]["ad_move_location"].ToString();
                    ddlScript.SelectedValue      = ds.Tables[0].Rows[0]["scriptid"].ToString();
                    ddlEnvironment.SelectedValue = ds.Tables[0].Rows[0]["environment"].ToString();
                    chkEnabled.Checked           = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    btnAdd.Text = "Update";

                    LoadClasses(oTreeClassEnvironment, false);
                    oTreeClassEnvironment.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    if (chkModels.Checked == false)
                    {
                        strModels = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY INDIVIDUAL MODEL(S)</i> flag is checked</b></p>";
                    }
                    else
                    {
                        LoadTypes(oTreeModels);
                        oTreeModels.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    }
                    LoadOperatingSystems(oTreeOperatingSystemServicePack);
                    if (chkApproval.Checked == false)
                    {
                        btnUser.Enabled = false;
                        strApprovals    = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>REQUIRES APPROVAL</i> flag is checked</b></p>";
                    }
                    else
                    {
                        LoadUsers();
                    }
                    LoadComponents(oTreeInclude, true, false);
                    oTreeInclude.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    LoadComponents(oTreeExclude, false, true);
                    oTreeExclude.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    LoadApplications(oTreeIncludeApp, true);
                    LoadApplications(oTreeExcludeApp, false);
                    if (chkNetworks.Checked == false)
                    {
                        strNetworks = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY NETWORK RANGES(S)</i> flag is checked</b></p>";
                    }
                    else
                    {
                        LoadClasses(oTreeNetworks, true);
                        oTreeNetworks.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    }
                    panScripts.Visible = true;
                    frmScripts.Attributes.Add("src", "/admin/servername_components_scripts.aspx?detailid=" + intID.ToString());
                }
            }

            if (panAdd.Visible == true)
            {
                int intMenuTab = 0;
                if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                {
                    intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                }
                Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);
                oTab.AddTab("Details", "");
                oTab.AddTab("Class / Environments", "");
                oTab.AddTab("Models", "");
                oTab.AddTab("Approvers", "");
                oTab.AddTab("Operating Systems / Service Packs", "");
                oTab.AddTab("Associated Components", "");
                int intMenuTabComp = 0;
                if (Request.QueryString["menu_tab_comp"] != null && Request.QueryString["menu_tab_comp"] != "")
                {
                    intMenuTabComp = Int32.Parse(Request.QueryString["menu_tab_comp"]);
                }
                Tab oTabComp = new Tab("", intMenuTabComp, "divMenuComp1", true, false);
                oTabComp.AddTab("Inclusions", "");
                oTabComp.AddTab("Exclusions", "");
                strMenuTabComp = oTabComp.GetTabs();
                oTab.AddTab("Associated Applications", "");
                int intMenuTabApp = 0;
                if (Request.QueryString["menu_tab_app"] != null && Request.QueryString["menu_tab_app"] != "")
                {
                    intMenuTabApp = Int32.Parse(Request.QueryString["menu_tab_app"]);
                }
                Tab oTabApp = new Tab("", intMenuTabApp, "divMenuApp1", true, false);
                oTabApp.AddTab("Inclusions", "");
                oTabApp.AddTab("Exclusions", "");
                strMenuTabApp = oTabApp.GetTabs();
                oTab.AddTab("Network Ranges", "");
                oTab.AddTab("Scripts", "");
                strMenuTab1 = oTab.GetTabs();
            }

            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            Variables oVariable = new Variables(intEnvironment);

            txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divUser.ClientID + "','" + lstUser.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstUser.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnUser.Attributes.Add("onclick", "return EnsureHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter the LAN ID of the user')" +
                                   ";");
            btnArrayConfig.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnArrayConfigId.ClientID + "','" + hdnArrayConfigOrder.ClientID + "&type=ZEUS_ARRAY_CONFIGS" + "',false,400,400);");
            btnBuildType.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnBuildTypeId.ClientID + "','" + hdnBuildTypeOrder.ClientID + "&type=ZEUS_BUILD_TYPES" + "',false,400,400);");
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oServicePacks     = new ServicePacks(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oVariable         = new Variables(intEnvironment);
            oMnemonic         = new Mnemonic(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);
            }
            lblTitle.Text = oPage.Get(intPage, "title");
            string strName = "";

            if (Request.QueryString["type"] != null && Request.QueryString["type"] != "" && Request.QueryString["save"] != null && Request.QueryString["save"] != "")
            {
                if (Request.QueryString["type"] == "NCB")
                {
                    strName = oServerName.GetName(Int32.Parse(Request.QueryString["save"]), 0);
                    if (strName != "DENIED")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Server Name Generated Successfully!\\n\\nServer Name: " + strName + "\\n\\nThis name has been reserved to you - to release this reservation, click on My Server Names in the left menu.');window.navigate('" + oPage.GetFullLink(intPage) + "?type=" + Request.QueryString["type"] + "&dr=" + (Request.QueryString["dr"] == null ? "" : Request.QueryString["dr"]) + "&id=" + Request.QueryString["save"] + "');<" + "/" + "script>");
                    }
                }
                else if (Request.QueryString["type"] == "PNC")
                {
                    strName = oServerName.GetNameFactory(Int32.Parse(Request.QueryString["save"]), 0);
                    if (strName != "DENIED")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Server Name Generated Successfully!\\n\\nServer Name: " + strName + "\\n\\nThis name has been reserved to you - to release this reservation, click on My Server Names in the left menu.');window.navigate('" + oPage.GetFullLink(intPage) + "?type=" + Request.QueryString["type"] + "&dr=" + (Request.QueryString["dr"] == null ? "" : Request.QueryString["dr"]) + "&id=" + Request.QueryString["save"] + "');<" + "/" + "script>");
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Invalid TYPE - server name generation failed!');window.navigate('" + oPage.GetFullLink(intPage) + "');<" + "/" + "script>");
                }
            }
            if (Request.QueryString["type"] != null && Request.QueryString["type"] != "" && Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                if (Request.QueryString["type"] == "NCB")
                {
                    radType.SelectedValue = "NCB";
                    strName = oServerName.GetName(Int32.Parse(Request.QueryString["id"]), 0);
                }
                else if (Request.QueryString["type"] == "PNC")
                {
                    radType.SelectedValue = "PNC";
                    strName = oServerName.GetNameFactory(Int32.Parse(Request.QueryString["id"]), 0);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Invalid TYPE - server name generation failed!');window.navigate('" + oPage.GetFullLink(intPage) + "');<" + "/" + "script>");
                }
            }
            if (!IsPostBack)
            {
                btnSubmit.Enabled = false;
                string strAdditional = ShowForm();
                LoadLists();
                btnSubmit.Attributes.Add("onclick", "return EnsureFunction('" + ddlApplication.ClientID + "','hdnComponents')" +
                                         " && ValidateDropDown('" + ddlCluster.ClientID + "','Please make a selection for the clustering options')" +
                                         strAdditional +
                                         " && ValidateText('" + txtName.ClientID + "','Please enter a name for this server name request')" +
                                         " && ProcessButton(this)" +
                                         ";");
                btnParent.Attributes.Add("onclick", "return OpenLocations('" + hdnParent.ClientID + "','" + txtParent.ClientID + "');");
                ddlLocation.Attributes.Add("onchange", "WaitDDL('" + divLocation.ClientID + "');");
                ddlOS.Attributes.Add("onchange", "WaitDDL('" + divOS.ClientID + "');");
                ddlSP.Attributes.Add("onchange", "WaitDDL('" + divSP.ClientID + "');");
                ddlClass.Attributes.Add("onchange", "WaitDDL('" + divClass.ClientID + "');");
                ddlEnvironment.Attributes.Add("onchange", "WaitDDL('" + divEnvironment.ClientID + "');");
                btnDuplicate.Attributes.Add("onclick", "return confirm('Are you sure you want to genearate another server name?\\n\\nThis new name will have the same settings as your previous request.');");
                txtMnemonic.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'500','195','" + divMnemonic.ClientID + "','" + lstMnemonic.ClientID + "','" + hdnMnemonic.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_mnemonics.aspx',2);");
                lstMnemonic.Attributes.Add("ondblclick", "AJAXClickRow();");
            }
            if (strName != "" && strName != "DENIED")
            {
                lblName.Text    = strName;
                txtName.Enabled = true;
                txtName.Text    = "Enter a new nickname HERE";
                txtName.Attributes.Add("onfocus", "ChangeDefaultName(this);");
                panName.Visible = true;
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Servers          oServer           = new Servers(0, dsn);
            VMWare           oVMWare           = new VMWare(0, dsn);
            Forecast         oForecast         = new Forecast(0, dsn);
            Environments     oEnvironment      = new Environments(0, dsn);
            OperatingSystems oOperatingSystem  = new OperatingSystems(0, dsn);
            Classes          oClass            = new Classes(0, dsn);
            Requests         oRequest          = new Requests(0, dsn);
            Projects         oProject          = new Projects(0, dsn);
            ServerName       oServerName       = new ServerName(0, dsn);
            Locations        oLocations        = new Locations(0, dsn);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
            ServicePacks     oServicePacks     = new ServicePacks(0, dsn);
            Users            oUser             = new Users(0, dsn);
            Organizations    oOrganization     = new Organizations(0, dsn);
            IPAddresses      oIPAddresses      = new IPAddresses(0, dsnIP, dsn);
            ResourceRequest  oResourceRequest  = new ResourceRequest(0, dsn);
            Domains          oDomains          = new Domains(0, dsn);

            oVariables = new Variables(intEnvironment);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                StringBuilder sbTable   = new StringBuilder(strTable);
                int           intServer = Int32.Parse(Request.QueryString["id"]);
                DataSet       ds        = oServer.Get(intServer);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int    intAnswer   = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    int    intName     = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString());
                    string strName     = oServer.GetName(intServer, boolUsePNCNaming);
                    int    intForecast = Int32.Parse(oForecast.GetAnswer(intAnswer, "forecastid"));
                    int    intRequest  = Int32.Parse(oForecast.Get(intForecast, "requestid"));
                    int    intProject  = oRequest.GetProjectNumber(intRequest);
                    int    intClass    = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
                    int    intEnv      = Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid"));
                    int    intModel    = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());

                    string _save_location = oVariables.UploadsFolder() + "SC\\";
                    string strFileName    = "SC_" + intServer.ToString() + "_" + oProject.Get(intProject, "number") + ".HTM";
                    if (Directory.Exists(_save_location) == false)
                    {
                        Directory.CreateDirectory(_save_location);
                    }
                    string       strFile = _save_location + strFileName;
                    StreamWriter fp      = File.CreateText(strFile);


                    string strDefault = "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">";

                    StringBuilder sbLeft1 = new StringBuilder();
                    string        strLead = oProject.Get(intProject, "lead");
                    int           intLead = 0;
                    if (strLead != "")
                    {
                        intLead = Int32.Parse(strLead);
                    }
                    sbLeft1.Append("<fieldset>");
                    sbLeft1.Append("<legend><b>Who is this for?</b></legend>");
                    sbLeft1.Append(strDefault);
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client XID:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Name:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Phone No.:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Department:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox("", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Fax:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox("", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Cost Center:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox("", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("</table>");
                    sbLeft1.Append("</fieldset>");

                    StringBuilder sbRight1 = new StringBuilder();
                    string        strIE    = oProject.Get(intProject, "engineer");
                    int           intIE    = 0;
                    if (strIE != "")
                    {
                        intIE = Int32.Parse(strIE);
                    }
                    sbRight1.Append("<fieldset>");
                    sbRight1.Append("<legend><b>Requestor Information</b></legend>");
                    sbRight1.Append(strDefault);
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Requested By Name:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox(intIE > 0 ? oUser.GetFullName(intIE) : "***ERROR**", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Requested By Phone No.:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox(intIE > 0 ? oUser.Get(intIE, "phone") : "***ERROR**", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Requested By Email:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox(intIE > 0 ? oUser.GetEmail(oUser.GetName(intIE), intEnvironment) : "***ERROR**", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("</table>");
                    sbRight1.Append("</fieldset>");
                    sbRight1.Append("<fieldset>");
                    sbRight1.Append("<legend><b>Location Information:</b></legend>");
                    sbRight1.Append(strDefault);
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Location:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox("", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Location Full Name:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox("", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("</table>");
                    sbRight1.Append("</fieldset>");

                    StringBuilder sbCenter1 = new StringBuilder();
                    sbCenter1.Append("<fieldset>");
                    sbCenter1.Append("<legend><b>Brief Desc:</b></legend>");
                    sbCenter1.Append(strDefault);
                    sbCenter1.Append("<tr>");
                    sbCenter1.Append("<td>");
                    sbCenter1.Append(GetBox(oForecast.GetAnswer(intAnswer, "name") + " (" + strName + ")", 600));
                    sbCenter1.Append("</td>");
                    sbCenter1.Append("</tr>");
                    sbCenter1.Append("</table>");
                    sbCenter1.Append("</fieldset>");

                    StringBuilder sbLeft2 = new StringBuilder();
                    sbLeft2.Append("<fieldset>");
                    sbLeft2.Append("<legend><b>Project Information:</b></legend>");
                    sbLeft2.Append(strDefault);
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project ID:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(oProject.Get(intProject, "number"), 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager XID:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project Name:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(oProject.Get(intProject, "name"), 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager Name:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project Budgeted:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(oProject.Get(intProject, "bd"), 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager Phone:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project Cost Ctr:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox("", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager Email:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetEmail(oUser.GetName(intLead), intEnvironment) : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("</table>");
                    sbLeft2.Append("</fieldset>");

                    OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn);
                    int           intImplementor = 0;
                    DataSet       dsTasks        = oOnDemandTasks.GetPending(intAnswer);
                    if (dsTasks.Tables[0].Rows.Count > 0)
                    {
                        intImplementor = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intImplementor, "userid"));
                    }
                    else
                    {
                        intImplementor = -999;
                    }
                    sbTable = new StringBuilder("<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\"><b>NOTE:</b> ASSIGN THIS REQUEST TO: ");
                    sbTable.Append(intImplementor > 0 || intImplementor == -999 ? oUser.GetFullName(intImplementor) + " (" + oUser.GetName(intImplementor) + ")" : "***ERROR**");
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td>");
                    sbTable.Append(sbLeft1.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("<td>");
                    sbTable.Append(sbRight1.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\">");
                    sbTable.Append(sbCenter1.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\">");
                    sbTable.Append(sbLeft2.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\"><p>&nbsp;</p></td>");
                    sbTable.Append("</tr>");

                    bool boolVirtual = false;
                    if (boolVirtual == true)
                    {
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION VIRTUAL SERVER GUEST</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Requested Server Completion Date:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Hardware Specifications:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("VIRTUAL SERVER GUEST VMWARE", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Operating System:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Environment:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Class:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Domain:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Backup Method:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TSM", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        string  strHost = "***ERROR***";
                        DataSet dsGuest = oVMWare.GetGuest(strName);
                        if (dsGuest.Tables[0].Rows.Count > 0)
                        {
                            strHost = oVMWare.GetHost(Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString()), "name").ToUpper();
                        }
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Host Server Name:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(strHost, 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>");
                        sbTable.Append("</tr>");
                        bool    boolSQL = false;
                        bool    boolIIS = false;
                        DataSet dsComp  = oServerName.GetComponentDetailSelected(intServer, 1);
                        foreach (DataRow drComp in dsComp.Tables[0].Rows)
                        {
                            if (drComp["code"].ToString() == "IIS")
                            {
                                boolIIS = true;
                            }
                            if (drComp["code"].ToString() == "SQL")
                            {
                                boolSQL = true;
                            }
                        }
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TCP/IP", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Attached to SAN?:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server is Clustered:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Load Balanced:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Maximum Allowable Downtime:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("Not Applicable", 150) + "</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">");
                        sbTable.Append(GetBox("", 500));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                    }
                    else
                    {
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION SERVER</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Requested Server Completion Date:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Hardware Specifications:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oModelsProperties.Get(intModel, "name"), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\" checked/> User re-deployable hardware if applicable</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>PO:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Operating System:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Environment:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Class:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Domain:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Location:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oLocations.GetFull(Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid"))).ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Backup Method:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TSM", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>");
                        sbTable.Append("</tr>");
                        bool    boolSQL = false;
                        bool    boolIIS = false;
                        DataSet dsComp  = oServerName.GetComponentDetailSelected(intServer, 1);
                        foreach (DataRow drComp in dsComp.Tables[0].Rows)
                        {
                            if (drComp["code"].ToString() == "IIS")
                            {
                                boolIIS = true;
                            }
                            if (drComp["code"].ToString() == "SQL")
                            {
                                boolSQL = true;
                            }
                        }
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TCP/IP", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Attached to SAN?:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server is Clustered:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Load Balanced:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Maximum Allowable Downtime:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("Not Applicable", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">");
                        sbTable.Append(GetBox("", 500));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                    }
                    sbTable.Append("</table>");

                    fp.WriteLine("<html>");
                    fp.WriteLine("<head>");
                    fp.WriteLine("<title>ClearView | Service Center Request Form</title>");
                    fp.WriteLine("<style type=\"text/css\">");
                    fp.WriteLine(".default {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;}");
                    fp.WriteLine(".header {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 16px;font-style: italic;font-weight: bold;}");
                    fp.WriteLine("</style>");
                    fp.WriteLine("<body leftmargin=\"0\" topmargin=\"0\">");
                    fp.WriteLine(sbTable.ToString());
                    fp.WriteLine("</body>");
                    fp.WriteLine("</html>");
                    fp.Close();
                }

                strTable = sbTable.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();

            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset, dsn);
            oAssetOrder       = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oSolaris          = new Solaris(intProfile, dsn);
            oRoom             = new RoomsNew(intProfile, dsn);
            oRack             = new RacksNew(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }

            if ((Request.QueryString["assetid"] != null && Request.QueryString["assetid"] != "") &&
                (Request.QueryString["orderid"] != null && Request.QueryString["orderid"] != ""))
            {
                hdnAssetId.Value = oFunction.decryptQueryString(Request.QueryString["assetid"]);
                hdnOrderId.Value = oFunction.decryptQueryString(Request.QueryString["orderid"]);
                //hdnAssetId.Value = "11049";  //Balde"24188";
                if (!IsPostBack)
                {
                    LoadList();
                    LoadAssetInformation();
                    populateLocations();
                }

                ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
                ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");


                btnAddWWPortName.Attributes.Add("onclick", "return ValidateText('" + txtWWPortName.ClientID + "','Please enter a World Wide Port name') && ProcessControlButton()" +
                                                ";");
            }
            else
            {
                pnlAllow.Visible  = false;
                pnlDenied.Visible = true;
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/audit_script_sets.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }

            oAudit            = new Audit(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                LoopRepeater();
            }
            else
            {
                intID = Int32.Parse(Request.QueryString["id"]);
                if (intID == 0)
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                    strDisabled       = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available when updating an existing item</b></p>";
                }
                else
                {
                    if (Request.QueryString["save"] != null)
                    {
                        panSave.Visible = true;
                    }
                    panAdd.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds = oAudit.GetScriptSet(intID);
                        txtName.Text       = ds.Tables[0].Rows[0]["name"].ToString();
                        chkModels.Checked  = (ds.Tables[0].Rows[0]["models"].ToString() == "1");
                        chkSAN.Checked     = (ds.Tables[0].Rows[0]["san"].ToString() == "1");
                        chkCluster.Checked = (ds.Tables[0].Rows[0]["cluster"].ToString() == "1");
                        chkMIS.Checked     = (ds.Tables[0].Rows[0]["mis"].ToString() == "1");
                        chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text        = "Update";

                        LoadClasses(oTreeClassEnvironment);
                        oTreeClassEnvironment.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                        if (chkModels.Checked == false)
                        {
                            strModels = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY INDIVIDUAL MODEL(S)</i> flag is checked</b></p>";
                        }
                        else
                        {
                            LoadTypes(oTreeModels);
                            oTreeModels.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                        }
                        LoadOperatingSystems(oTreeOperatingSystemServicePack);
                        LoadLocations();
                        panSteps.Visible = true;
                        frmSteps.Attributes.Add("src", "/admin/audit_script_set_details.aspx?parent=" + intID.ToString());
                    }
                }
            }

            if (panAdd.Visible == true)
            {
                int intMenuTab = 0;
                if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                {
                    intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                }
                Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);
                oTab.AddTab("Details", "");
                oTab.AddTab("Class / Environments", "");
                oTab.AddTab("Models", "");
                oTab.AddTab("Operating Systems / Service Packs", "");
                oTab.AddTab("Locations", "");
                oTab.AddTab("Scripts", "");
                strMenuTab1 = oTab.GetTabs();
            }

            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            strLocation = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, 0, true, "ddlCommon");
            btnLocation.Attributes.Add("onclick", "return EnsureHidden('" + hdnLocation.ClientID + "','ddlState','Please select a location')" +
                                       ";");
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);

            oSolaris    = new Solaris(intProfile, dsn);
            oStatusList = new StatusLevels(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                }
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    string  strID = oFunction.decryptQueryString(Request.QueryString["id"]);
                    DataSet ds    = oDataPoint.GetAsset(Int32.Parse(strID));
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | Physical Deploy (" + strHeader + ")";
                        lblHeaderSub.Text = "Complete the following information to deploy a physical server...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Location Information", "");
                        oTab.AddTab("World Wide Port Names", "");
                        oTab.AddTab("Resource Dependencies", "");
                        oTab.AddTab("Provisioning History", "");
                        strMenuTab1 = oTab.GetTabs();

                        if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true)
                        {
                            panOldLocationInfo.Visible = true;
                        }

                        if (!IsPostBack)
                        {
                            LoadList();

                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "PHYSICAL_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "PHYSICAL_ASSET", strAsset, "", false, true);

                            int intAssetAttribute = Int32.Parse(oAsset.Get(intAsset, "asset_attribute"));
                            oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false);
                            oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true);
                            ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()");

                            ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');");
                            int intModel  = Int32.Parse(oAsset.Get(intAsset, "modelid"));
                            int intParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            if (oDataPoint.GetDeployModel(intProfile, intParent) == false && oUser.IsAdmin(intProfile) == false)
                            {
                                panAllow.Visible  = false;
                                panDenied.Visible = true;
                            }

                            hdnModel.Value = intModel.ToString();
                            int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            int intType        = oModel.GetType(intModelParent);
                            int intPlatform    = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "PHYSICAL_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "PHYSICAL_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "PHYSICAL_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "PHYSICAL_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            DataSet dsAsset = oAsset.GetServerOrBlade(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                Response.Redirect("/datapoint/asset/physical.aspx?t=serial&q=" + oFunction.encryptQueryString(strSerial) + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&r=0");
                            }

                            oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "PHYSICAL_CLASS", "name", "id", oClass.Gets(1), 0, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "PHYSICAL_ENVIRONMENT", "name", "id", oClass.GetEnvironment(0, 0), 0, false, false, true);
                            oDataPoint.LoadTextBox(txtPlatformILO, intProfile, null, "", lblPlatformILO, fldPlatformILO, "PHYSICAL_ILO", "", "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformDummy, intProfile, null, "", lblPlatformDummy, fldPlatformDummy, "PHYSICAL_DUMMY", "", "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformMAC, intProfile, null, "", lblPlatformMAC, fldPlatformMAC, "PHYSICAL_MAC", "", "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformVLAN, intProfile, null, "", lblPlatformVLAN, fldPlatformVLAN, "PHYSICAL_VLAN", "", "", false, true);
                            oDataPoint.LoadDropDown(ddlPlatformBuildNetwork, intProfile, null, "", lblPlatformBuildNetwork, fldPlatformBuildNetwork, "PHYSICAL_BUILD_NETWORK", "name", "id", oSolaris.GetBuildNetworks(1), 0, false, false, false);
                            oDataPoint.LoadDropDown(ddlPlatformResiliency, intProfile, null, "", lblPlatformResiliency, fldPlatformResiliency, "PHYSICAL_RESILIENCY", "name", "id", oResiliency.Gets(1), 0, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformOperatingSystemGroup, intProfile, null, "", lblPlatformOperatingSystemGroup, fldPlatformOperatingSystemGroup, "PHYSICAL_OS_GROUP", "name", "id", oOperatingSystem.GetGroups(1), 0, false, false, false);

                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                lblOldlocation.Text = dsAsset.Tables[0].Rows[0]["OldLocation"].ToString();
                                lblOldRoom.Text     = dsAsset.Tables[0].Rows[0]["OldRoom"].ToString();
                                lblOldRack.Text     = dsAsset.Tables[0].Rows[0]["OldRack"].ToString();

                                txtLocation.Text     = dsAsset.Tables[0].Rows[0]["Location"].ToString();
                                txtRoom.Text         = dsAsset.Tables[0].Rows[0]["Room"].ToString();
                                txtZone.Text         = dsAsset.Tables[0].Rows[0]["Zone"].ToString();
                                txtRack.Text         = dsAsset.Tables[0].Rows[0]["Rack"].ToString();
                                txtRackPosition.Text = dsAsset.Tables[0].Rows[0]["Rackposition"].ToString();
                                oDataPoint.LoadTextBox(txtRackPosition, intProfile, null, "", lblRackPositionValue, fldLocation, "CHANGE_LOCATION", dsAsset.Tables[0].Rows[0]["rackposition"].ToString(), "", false, true);
                                hdnRackId.Value = dsAsset.Tables[0].Rows[0]["RackId"].ToString();
                            }
                            oDataPoint.LoadButton(btnSelectLocation, intProfile, fldLocation, "CHANGE_LOCATION",
                                                  "return LoadLocationRoomRack('" + "rack" + "','" + hdnRackId.ClientID + "', '" + txtLocation.ClientID + "','" + txtRoom.ClientID + "','" + txtZone.ClientID + "','" + txtRack.ClientID + "');");

                            ddlPlatformStatus.SelectedValue = oAsset.GetStatus(intAsset, "status");

                            // Resource Dependencies
                            AssetOrder      oAssetOrder     = new AssetOrder(0, dsn, dsnAsset, intEnvironment);
                            Services        oService        = new Services(0, dsn);
                            ServiceRequests oServiceRequest = new ServiceRequests(0, dsn);
                            rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false);
                            rptServiceRequests.DataBind();
                            trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0);
                            foreach (RepeaterItem ri in rptServiceRequests.Items)
                            {
                                Label lblServiceID = (Label)ri.FindControl("lblServiceID");
                                int   intService   = Int32.Parse(lblServiceID.Text);
                                Label lblDetails   = (Label)ri.FindControl("lblDetails");
                                Label lblProgress  = (Label)ri.FindControl("lblProgress");

                                if (lblProgress.Text == "")
                                {
                                    lblProgress.Text = "<i>Unavailable</i>";
                                }
                                else
                                {
                                    int     intResource  = Int32.Parse(lblProgress.Text);
                                    double  dblAllocated = 0.00;
                                    double  dblUsed      = 0.00;
                                    int     intStatus    = 0;
                                    bool    boolAssigned = false;
                                    DataSet dsResource   = oDataPoint.GetServiceRequestResource(intResource);
                                    if (dsResource.Tables[0].Rows.Count > 0)
                                    {
                                        Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus);
                                    }
                                    foreach (DataRow drResource in dsResource.Tables[1].Rows)
                                    {
                                        boolAssigned  = true;
                                        dblAllocated += double.Parse(drResource["allocated"].ToString());
                                        dblUsed      += double.Parse(drResource["used"].ToString());
                                        intStatus     = Int32.Parse(drResource["status"].ToString());
                                    }
                                    if (intStatus == (int)ResourceRequestStatus.Closed)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true);
                                    }
                                    else if (intStatus == (int)ResourceRequestStatus.Cancelled)
                                    {
                                        lblProgress.Text = "Cancelled";
                                    }
                                    else if (boolAssigned == false)
                                    {
                                        string  strManager = "";
                                        DataSet dsManager  = oService.GetUser(intService, 1); // Managers
                                        foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                        {
                                            if (strManager != "")
                                            {
                                                strManager += "\\n";
                                            }
                                            int intManager = Int32.Parse(drManager["userid"].ToString());
                                            strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]";
                                        }
                                        lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>";
                                    }
                                    else if (dblAllocated > 0.00)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                                    }
                                    else
                                    {
                                        lblProgress.Text = "<i>N / A</i>";
                                    }
                                    lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>";
                                }
                            }

                            // Provioning History
                            rptHistory.DataSource = oAsset.GetProvisioningHistory(intAsset);
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);

                            // WWW
                            rptWWW.DataSource = oAsset.GetHBA(intAsset);
                            rptWWW.DataBind();
                            lblWWW.Visible = (rptWWW.Items.Count == 0);
                            oDataPoint.LoadButton(btnWWW, intProfile, fldWWW, "PHYSICAL_WWW", "return OpenWindow('ASSET_DEPLOY_HBAs','" + intAsset.ToString() + "');");
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnDeploy.Attributes.Add("onclick", oDataPoint.LoadValidation());
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Exemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     oForecast = new Forecast(0, dsn);
     oServer   = new Servers(0, dsn);
     if (Request.QueryString["id"] != null)
     {
         int intID = Int32.Parse(Request.QueryString["id"]);
         if (oForecast.IsStorage(intID) == true)
         {
             DataSet dsStorage           = oForecast.GetStorage(intID);
             double  intHigh             = double.Parse(dsStorage.Tables[0].Rows[0]["high_total"].ToString());
             double  intStandard         = double.Parse(dsStorage.Tables[0].Rows[0]["standard_total"].ToString());
             double  intLow              = double.Parse(dsStorage.Tables[0].Rows[0]["low_total"].ToString());
             double  intHighTest         = double.Parse(dsStorage.Tables[0].Rows[0]["high_test"].ToString());
             double  intStandardTest     = double.Parse(dsStorage.Tables[0].Rows[0]["standard_test"].ToString());
             double  intLowTest          = double.Parse(dsStorage.Tables[0].Rows[0]["low_test"].ToString());
             double  dblTotal            = intHigh + intStandard + intLow + intHighTest + intStandardTest + intLowTest;
             int     TotalFileSystemData = Int32.Parse(dblTotal.ToString());
             lblTCDC.Text = TotalFileSystemData.ToString() + " GB";
         }
         int      intForecast = Int32.Parse(oForecast.GetAnswer(intID, "forecastid"));
         int      intRequest  = Int32.Parse(oForecast.Get(intForecast, "requestid"));
         Requests oRequest    = new Requests(0, dsn);
         int      intProject  = oRequest.GetProjectNumber(intRequest);
         Projects oProject    = new Projects(0, dsn);
         //rptApp.DataSource = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "select top 1 * from cv_ondemand_answering");
         //rptApp.DataBind();
         lblAppNone.Visible = (rptApp.Items.Count == 0);
         lblPrjName.Text    = oProject.Get(intProject, "name");
         Users  oUser   = new Users(0, dsn);
         string strLead = oProject.Get(intProject, "lead");
         if (strLead != "")
         {
             lblPrjMgr.Text    = oUser.GetFullName(Int32.Parse(strLead));
             lblPhoneNum1.Text = oUser.Get(Int32.Parse(strLead), "phone");
         }
         string strRequester = oForecast.Get(intForecast, "userid");
         if (strRequester != "")
         {
             lblRequester.Text = oUser.GetFullName(Int32.Parse(strRequester));
             lblPhoneNum2.Text = oUser.Get(Int32.Parse(strRequester), "phone");
         }
         lblDate.Text = DateTime.Parse(oForecast.GetAnswer(intID, "implementation")).ToLongDateString();
         // Get data from servers table
         ServerName       oServerName      = new ServerName(0, dsn);
         IPAddresses      oIPAddress       = new IPAddresses(0, dsnIP, dsn);
         OperatingSystems oOperatingSystem = new OperatingSystems(0, dsn);
         ServicePacks     oServicePack     = new ServicePacks(0, dsn);
         DataSet          dsServer         = oServer.GetAnswer(intID);
         StringBuilder    sbHosts          = new StringBuilder(strHosts);
         foreach (DataRow drServer in dsServer.Tables[0].Rows)
         {
             int intServer = Int32.Parse(dsServer.Tables[0].Rows[0]["id"].ToString());
             sbHosts.Append("<tr>");
             sbHosts.Append("<td>");
             sbHosts.Append(oServer.GetName(intServer, boolUsePNCNaming));
             sbHosts.Append("</td>");
             sbHosts.Append("<td>");
             sbHosts.Append(oServer.GetIPs(intServer, 0, 1, 0, 0, dsnIP, "", ""));
             sbHosts.Append("</td>");
             sbHosts.Append("<td>");
             sbHosts.Append(oOperatingSystem.Get(Int32.Parse(dsServer.Tables[0].Rows[0]["osid"].ToString()), "name"));
             sbHosts.Append("</td>");
             sbHosts.Append("<td>");
             sbHosts.Append(oServicePack.Get(Int32.Parse(dsServer.Tables[0].Rows[0]["spid"].ToString()), "name"));
             sbHosts.Append("</td>");
             sbHosts.Append("</tr>");
         }
         strHosts                 = sbHosts.ToString();
         lblHostNone.Visible      = (strHosts == "");
         lblRecoveryLocation.Text = "Ops Center";
         // Get data from backup table
         DataSet dsBackup = oForecast.GetBackup(intID);
         if (dsBackup.Tables[0].Rows.Count > 0)
         {
             if (dsBackup.Tables[0].Rows[0]["daily"].ToString() == "1")
             {
                 lblBackupFreq.Text = "Daily";
             }
             else if (dsBackup.Tables[0].Rows[0]["weekly"].ToString() == "1")
             {
                 lblBackupFreq.Text = "Weekly";
             }
             else if (dsBackup.Tables[0].Rows[0]["monthly"].ToString() == "1")
             {
                 lblBackupFreq.Text = "Monthly";
             }
             if (dsBackup.Tables[0].Rows[0]["time"].ToString() == "1")
             {
                 lblCSB.Text = dsBackup.Tables[0].Rows[0]["time_hour"].ToString() + " " + dsBackup.Tables[0].Rows[0]["time_switch"].ToString();
             }
             else
             {
                 lblCSB.Text = "Don't Care";
             }
             lblAvgSize.Text = dsBackup.Tables[0].Rows[0]["average_one"].ToString() + " GB";
             lblPTD.Text     = dsBackup.Tables[0].Rows[0]["documentation"].ToString();
             if (lblPTD.Text == "")
             {
                 lblPTD.Text     = "Not Specified";
                 lblPTD.CssClass = "redbold";
             }
             if (dsBackup.Tables[0].Rows[0]["start_date"].ToString() != "")
             {
                 lblFirstBackupDate.Text = DateTime.Parse(dsBackup.Tables[0].Rows[0]["start_date"].ToString()).ToShortDateString();
             }
         }
         // Load Exclusions
         DataSet dsExclusions = oForecast.GetBackupExclusions(intID);
         foreach (DataRow drExclusion in dsExclusions.Tables[0].Rows)
         {
             strExclusions += "<tr><td>" + drExclusion["path"].ToString() + "</td></tr>";
         }
         if (strExclusions == "")
         {
             strExclusions = "<tr><td class=\"redbold\">No Exclusions</td></tr>";
         }
         // Load Requirements
         DataSet       dsRequirements = oForecast.GetBackupRetentions(intID);
         StringBuilder sbRequirements = new StringBuilder(strRequirements);
         foreach (DataRow drRequirement in dsRequirements.Tables[0].Rows)
         {
             sbRequirements.Append("<tr><td nowrap>Path:</td><td width=\"100%\">");
             sbRequirements.Append(drRequirement["path"].ToString());
             sbRequirements.Append("</td></tr>");
             sbRequirements.Append("<tr><td nowrap>First Archival:</td><td width=\"100%\">");
             sbRequirements.Append(DateTime.Parse(drRequirement["first"].ToString()).ToShortDateString());
             sbRequirements.Append("</td></tr>");
             sbRequirements.Append("<tr><td nowrap>Retention Period:</td><td width=\"100%\">");
             sbRequirements.Append(drRequirement["number"].ToString() == "0" ? "" : drRequirement["number"].ToString() + " ");
             sbRequirements.Append(drRequirement["type"].ToString());
             sbRequirements.Append("</td></tr>");
             sbRequirements.Append("<tr><td nowrap>Start Time:</td><td width=\"100%\">");
             sbRequirements.Append(drRequirement["hour"].ToString());
             sbRequirements.Append(" ");
             sbRequirements.Append(drRequirement["switch"].ToString());
             sbRequirements.Append("</td></tr>");
             sbRequirements.Append("<tr><td nowrap>Frequency:</td><td width=\"100%\">");
             sbRequirements.Append(drRequirement["occurence"].ToString());
             sbRequirements.Append(drRequirement["occurs"].ToString() == "" ? "" : " occurring on " + drRequirement["occurs"].ToString());
             sbRequirements.Append("</td></tr>");
             sbRequirements.Append("<tr><td colspan=\"2\">&nbsp;</td></tr>");
         }
         strRequirements    = sbRequirements.ToString();
         lblCCDU.Text       = "5 GB";
         lblPolicyExcl.Text = "No Exceptions";
     }
 }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oWorkstation      = new Workstations(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oZeus             = new Zeus(intProfile, dsnZeus);
            oLog             = new Log(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);

            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                    //      -100: More than one device name
                    //       -10: No device names
                    //        -5: Improper Name Format
                    //        -1: ServerID = 0
                    if (Request.QueryString["error"] == "-100")
                    {
                        lblError.Text = "More than one name";
                    }
                    else if (Request.QueryString["error"] == "-10")
                    {
                        lblError.Text = "User Cancelled Prompt";
                    }
                    else if (Request.QueryString["error"] == "-5")
                    {
                        lblError.Text = "Name is in Incorrect Format";
                    }
                    else if (Request.QueryString["error"] == "-1")
                    {
                        lblError.Text = "DeviceID = 0";
                    }
                    else
                    {
                        lblError.Text = "Generic Error";
                    }
                }
                Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID);
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (intID > 0)
                {
                    DataSet ds = oDataPoint.GetAsset(intID);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | VMware Workstation (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about a VMware Workstation...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Guest Information", "");
                        oTab.AddTab("Account Information", "");
                        oTab.AddTab("Resource Dependencies", "");
                        oTab.AddTab("Provisioning Information", "");
                        if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true)
                        {
                            oTab.AddTab("Administration", "");
                            panAdministration.Visible = true;
                        }
                        strMenuTab1 = oTab.GetTabs();

                        if (!IsPostBack)
                        {
                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "WORKSTATION_VMWARE_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "WORKSTATION_VMWARE_ASSET", strAsset, "", false, true);

                            int intAssetAttribute = Int32.Parse(oAsset.Get(intAsset, "asset_attribute"));
                            oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false);
                            oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true);
                            ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()");

                            ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');");
                            int intModel = Int32.Parse(oAsset.Get(intAsset, "modelid"));

                            hdnModel.Value = intModel.ToString();
                            int    intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            int    intType        = oModel.GetType(intModelParent);
                            string strExecute     = oType.Get(intType, "forecast_execution_path");
                            if (strExecute != "")
                            {
                                DataSet dsVirtual = oWorkstation.GetVirtualAsset(intAsset);
                                if (dsVirtual.Tables[0].Rows.Count > 0)
                                {
                                    btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + dsVirtual.Tables[0].Rows[0]["answerid"].ToString() + "');");
                                }
                                else
                                {
                                    btnExecute.Enabled = false;
                                }
                            }
                            else
                            {
                                btnExecute.Enabled = false;
                            }
                            int intPlatform = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "WORKSTATION_VMWARE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "WORKSTATION_VMWARE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "WORKSTATION_VMWARE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "WORKSTATION_VMWARE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            int     intWorkstation = 0;
                            DataSet dsAsset        = oWorkstation.GetVirtualAsset(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                intWorkstation      = Int32.Parse(dsAsset.Tables[0].Rows[0]["id"].ToString());
                                lblWorkstation.Text = intWorkstation.ToString();
                                txtStep.Text        = dsAsset.Tables[0].Rows[0]["step"].ToString();
                                oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, null, "", lblName, fldName, "WORKSTATION_VMWARE_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false);
                                if (txtName.Text != "")
                                {
                                    lblHeader.Text += "&nbsp;&nbsp;&nbsp;[" + txtName.Text + "]";
                                }
                                lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString();
                                // Administrative Functions
                                if (Request.QueryString["admin"] != null)
                                {
                                    if (Request.QueryString["result"] != null)
                                    {
                                        strAdministration = "<tr><td>" + oFunction.decryptQueryString(Request.QueryString["result"]) + "</td></tr>";
                                    }
                                    if (Request.QueryString["output"] != null)
                                    {
                                        DataSet dsOutput = oWorkstation.GetVirtualOutput(intWorkstation);
                                        foreach (DataRow drOutput in dsOutput.Tables[0].Rows)
                                        {
                                            strAdministration += "<tr><td><a href=\"javascript:void(0);\" onclick=\"ShowHideDiv2('div" + drOutput["id"].ToString() + "');\">" + drOutput["type"].ToString() + "</a></td></tr>";
                                            strAdministration += "<tr id=\"div" + drOutput["id"].ToString() + "\" style=\"display:none\"><td>" + oFunction.FormatText(drOutput["output"].ToString()) + "</td></tr>";
                                        }
                                        if (lblStatus.Text != "")
                                        {
                                            strAdministration += "<tr><td>" + oLog.GetEvents(oLog.GetEventsByName(txtName.Text.ToUpper(), (int)LoggingType.Error), intEnvironment) + "</td></tr>";
                                        }
                                    }
                                }
                                int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString());
                                int intEnv   = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString());
                                hdnEnvironment.Value = intEnv.ToString();
                                oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "WORKSTATION_VMWARE_CLASS", "name", "id", oClass.GetWorkstationVMwares(1), intClass, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "WORKSTATION_VMWARE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true);
                                ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString();
                                ddlStatus.Enabled       = (intAssetAttribute == (int)AssetAttribute.Ok);
                                panStatus.Visible       = (ddlStatus.Enabled == false);

                                int  intOS    = Int32.Parse(dsAsset.Tables[0].Rows[0]["osid"].ToString());
                                bool boolXP   = (oOperatingSystem.Get(intOS, "code") == "XP");
                                bool boolWin7 = (oOperatingSystem.Get(intOS, "code") == "7");
                                oDataPoint.LoadDropDown(ddlPlatformOS, intProfile, null, "", lblPlatformOS, fldPlatformOS, "WORKSTATION_VMWARE_OS", "name", "id", oOperatingSystem.Gets(1, 1), intOS, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformServicePack, intProfile, null, "", lblPlatformServicePack, fldPlatformServicePack, "WORKSTATION_VMWARE_SP", "name", "id", oOperatingSystem.GetServicePack(intOS), Int32.Parse(dsAsset.Tables[0].Rows[0]["spid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformDomain, intProfile, null, "", lblPlatformDomain, fldPlatformDomain, "WORKSTATION_VMWARE_DOMAIN", "name", "id", oDomain.Gets(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["domainid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformHDD, intProfile, null, "", lblPlatformHDD, fldPlatformHDD, "WORKSTATION_VMWARE_HDD", "name", "id", oVirtualHDD.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1), Int32.Parse(dsAsset.Tables[0].Rows[0]["hddid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformRam, intProfile, null, "", lblPlatformRam, fldPlatformRam, "WORKSTATION_VMWARE_RAM", "name", "id", oVirtualRam.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1), Int32.Parse(dsAsset.Tables[0].Rows[0]["ramid"].ToString()), false, false, true);
                            }
                            else
                            {
                                Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                            }

                            // Get Host
                            oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["hostname"].ToString()), lblHostName, fldHostName, "WORKSTATION_VMWARE_HOST", dsAsset.Tables[0].Rows[0]["hostname"].ToString(), "", false, false);
                            if (Request.Cookies["virtual_guest"] != null && Request.Cookies["virtual_guest"].Value != "")
                            {
                                string strHost = "";
                                string strFind = txtName.Text;
                                //strFind = "ohcleapp103d";
                                DateTime datStart = DateTime.Parse(Request.Cookies["virtual_guest"].Value);
                                Response.Cookies["virtual_guest"].Value = "";
                                VMWare         oVMWare    = new VMWare(intProfile, dsn);
                                string         strConnect = oVMWare.Connect(strFind);
                                VimService     _service   = oVMWare.GetService();
                                ServiceContent _sic       = oVMWare.GetSic();
                                try
                                {
                                    ManagedObjectReference oVM         = oVMWare.GetVM(strFind);
                                    ManagedObjectReference oParent     = (ManagedObjectReference)oVMWare.getObjectProperty(oVM, "parent");
                                    ManagedObjectReference oDataCenter = (ManagedObjectReference)oVMWare.getObjectProperty(oParent, "parent");
                                    string    strDataCenter            = (string)oVMWare.getObjectProperty(oDataCenter, "name");
                                    GuestInfo ginfo = (GuestInfo)oVMWare.getObjectProperty(oVM, "guest");
                                    lblGuestState.Text = ginfo.guestState;
                                    GuestNicInfo[] nInfo = ginfo.net;
                                    foreach (GuestNicInfo nic in nInfo)
                                    {
                                        string[] strIPAddresses = nic.ipAddress;
                                        foreach (string strIPAddress in strIPAddresses)
                                        {
                                            if (lblIPAddress.Text != "")
                                            {
                                                lblIPAddress.Text += ", ";
                                            }
                                            lblIPAddress.Text += strIPAddress;
                                        }
                                        if (lblMACAddress.Text != "")
                                        {
                                            lblMACAddress.Text += ", ";
                                        }
                                        lblMACAddress.Text += nic.macAddress;
                                        if (lblNetwork.Text != "")
                                        {
                                            lblNetwork.Text += ", ";
                                        }
                                        lblNetwork.Text += nic.network;
                                    }
                                    // HDD
                                    GuestDiskInfo[] oVMDisks = ginfo.disk;
                                    foreach (GuestDiskInfo oDisk in oVMDisks)
                                    {
                                        if (lblHDD.Text != "")
                                        {
                                            lblHDD.Text += "<br/>";
                                        }
                                        double dblCapacity = double.Parse(oDisk.capacity.ToString());
                                        dblCapacity = dblCapacity / 1024.00;
                                        dblCapacity = dblCapacity / 1024.00;
                                        dblCapacity = dblCapacity / 1024.00;
                                        double dblAvailable = double.Parse(oDisk.freeSpace.ToString());
                                        dblAvailable = dblAvailable / 1024.00;
                                        dblAvailable = dblAvailable / 1024.00;
                                        dblAvailable = dblAvailable / 1024.00;
                                        lblHDD.Text += oDisk.diskPath + "&nbsp;&nbsp;" + dblCapacity.ToString("F") + " GB (" + dblAvailable.ToString("F") + " GB available)";
                                    }
                                    // Status
                                    VirtualMachineSummary oVMSummary = (VirtualMachineSummary)oVMWare.getObjectProperty(oVM, "summary");
                                    ManagedEntityStatus   oVMStatus  = oVMSummary.overallStatus;

                                    //lblOverallStatus.Text = (string)oVMStatus;
                                    lblOverallStatus.Text = Enum.GetName(typeof(ManagedEntityStatus), (ManagedEntityStatus)oVMStatus);
                                    // RAM & CPUs & Host
                                    VirtualMachineConfigSummary oVMConfig = oVMSummary.config;
                                    lblRAM.Text  = oVMConfig.memorySizeMB.ToString();
                                    lblCPUs.Text = oVMConfig.numCpu.ToString();
                                    VirtualMachineRuntimeInfo oVMRuntime = oVMSummary.runtime;
                                    ManagedObjectReference    oVMHost    = oVMRuntime.host;
                                    strHost = (string)oVMWare.getObjectProperty(oVMHost, "name");
                                    if (strHost.IndexOf(".") > -1)
                                    {
                                        strHost = strHost.Substring(0, strHost.IndexOf("."));
                                    }
                                    lblVirtualCenter.Text = oVMWare.VirtualCenter();
                                    lblDataCenter.Text    = oVMWare.DataCenter();
                                }
                                catch { }
                                finally
                                {
                                    if (_service != null)
                                    {
                                        _service.Abort();
                                        if (_service.Container != null)
                                        {
                                            _service.Container.Dispose();
                                        }
                                        try
                                        {
                                            _service.Logout(_sic.sessionManager);
                                        }
                                        catch { }
                                        _service.Dispose();
                                        _service = null;
                                        _sic     = null;
                                    }
                                }

                                if (strHost != "")
                                {
                                    panGuestYes.Visible = true;
                                    oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(strHost), lblHostName, fldHostName, "WORKSTATION_VMWARE_HOST", strHost, "", false, false);
                                }
                                else
                                {
                                    panGuestNo.Visible = true;
                                }
                                TimeSpan oSpan = DateTime.Now.Subtract(datStart);
                                btnGuestQuery.Enabled = false;
                                btnGuestQuery.Text    = "Query Time: " + oSpan.TotalSeconds.ToString("0") + " seconds...";
                            }
                            oDataPoint.LoadPanel(panGuestQuery, intProfile, fldHostQuery, "WORKSTATION_VMWARE_HOST_QUERY");

                            // Account Information
                            DataSet dsAccounts = oWorkstation.GetAccountsVMware(intWorkstation);
                            rptAccounts.DataSource = dsAccounts;
                            rptAccounts.DataBind();
                            lblNone.Visible = (rptAccounts.Items.Count == 0);

                            // Resource Dependencies
                            rptServiceRequests.DataSource = ds.Tables[1];
                            rptServiceRequests.DataBind();
                            trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0);
                            foreach (RepeaterItem ri in rptServiceRequests.Items)
                            {
                                Label lblRequestID = (Label)ri.FindControl("lblRequestID");
                                Label lblServiceID = (Label)ri.FindControl("lblServiceID");
                                Label lblNumber    = (Label)ri.FindControl("lblNumber");
                                int   intService   = Int32.Parse(lblServiceID.Text);
                                Label lblDetails   = (Label)ri.FindControl("lblDetails");
                                Label lblProgress  = (Label)ri.FindControl("lblProgress");

                                if (lblProgress.Text == "")
                                {
                                    lblProgress.Text = "<i>Unavailable</i>";
                                }
                                else
                                {
                                    int intResource = Int32.Parse(lblProgress.Text);
                                    //lblProgress.Text = oResourceRequest.GetStatus(Int32.Parse(lblRequestID.Text), Int32.Parse(lblServiceID.Text), Int32.Parse(lblNumber.Text), true, true, dsnServiceEditor, dsnAsset, intServiceDecommission);
                                    lblProgress.Text = oResourceRequest.GetStatus(null, null, Int32.Parse(lblRequestID.Text), Int32.Parse(lblServiceID.Text), null, Int32.Parse(lblNumber.Text), true, dsnServiceEditor)[0].status;

                                    /*
                                     * double dblAllocated = 0.00;
                                     * double dblUsed = 0.00;
                                     * int intStatus = 0;
                                     * bool boolAssigned = false;
                                     * DataSet dsResource = oDataPoint.GetServiceRequestResource(intResource);
                                     * if (dsResource.Tables[0].Rows.Count > 0)
                                     *  Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus);
                                     * foreach (DataRow drResource in dsResource.Tables[1].Rows)
                                     * {
                                     *  boolAssigned = true;
                                     *  dblAllocated += double.Parse(drResource["allocated"].ToString());
                                     *  dblUsed += double.Parse(drResource["used"].ToString());
                                     *  intStatus = Int32.Parse(drResource["status"].ToString());
                                     * }
                                     * if (intStatus == (int)ResourceRequestStatus.Closed)
                                     *  lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true);
                                     * else if (intStatus == (int)ResourceRequestStatus.Cancelled)
                                     *  lblProgress.Text = "Cancelled";
                                     * else if (boolAssigned == false)
                                     * {
                                     *  string strManager = "";
                                     *  DataSet dsManager = oService.GetUser(intService, 1);  // Managers
                                     *  foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                     *  {
                                     *      if (strManager != "")
                                     *          strManager += "\\n";
                                     *      int intManager = Int32.Parse(drManager["userid"].ToString());
                                     *      strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]";
                                     *  }
                                     *  lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>";
                                     * }
                                     * else if (dblAllocated > 0.00)
                                     *  lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                                     * else
                                     *  lblProgress.Text = "<i>N / A</i>";
                                     */
                                    lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>";
                                }
                            }

                            // Provioning History
                            rptHistory.DataSource = SqlHelper.ExecuteDataset(dsnAsset, CommandType.Text, oDataPoint.AssetHistorySelect(intAsset));
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);
                            oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "WORKSTATION_VMWARE_STATUS");
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "")
                {
                    string  strQuery = oFunction.decryptQueryString(Request.QueryString["q"]);
                    DataSet ds       = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                        Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()));
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnName.Attributes.Add("onclick", "return OpenWindow('DEVICE_NAME','?assetid=" + intAsset.ToString() + "');");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                btnGuestQuery.Attributes.Add("onclick", "ProcessButton(this,'Querying... please be patient...','225') && ProcessControlButton();");
                btnOutput.Attributes.Add("onclick", "return ProcessButton(this) && ProcessControlButton();");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Reload();
            }
            oPlatform         = new Platforms(intProfile, dsn);
            oOrganization     = new Organizations(intProfile, dsn);
            oRequestItem      = new RequestItems(intProfile, dsn);
            oUserAt           = new Users_At(intProfile, dsn);
            oCost             = new Costs(intProfile, dsn);
            oService          = new Services(intProfile, dsn);
            oRequestField     = new RequestFields(intProfile, dsn);
            oReport           = new Reports(intProfile, dsn);
            oSites            = new Sites(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRacks            = new Racks(intProfile, dsn);
            oBanks            = new Banks(intProfile, dsn);
            oDepot            = new Depot(intProfile, dsn);
            oShelf            = new Shelf(intProfile, dsn);
            oClasses          = new Classes(intProfile, dsn);
            oRooms            = new Rooms(intProfile, dsn);
            oFloor            = new Floor(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oSolution         = new Solution(intProfile, dsn);
            oConfidence       = new Confidence(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oField            = new Field(intProfile, dsn);
            oServiceDetail    = new ServiceDetails(intProfile, dsn);
            oDomainController = new DomainController(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oHost             = new Host(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oRestart          = new Restart(intProfile, dsn);
            oSegment          = new Segment(intProfile, dsn);
            oServiceEditor    = new ServiceEditor(intProfile, dsnServiceEditor);
            oProjectRequest   = new ProjectRequest(intProfile, dsn);
            oVMWare           = new VMWare(intProfile, dsn);
            oWorkstation      = new Workstations(intProfile, dsn);
            //oNew = new New(intProfile, dsn);
            oWhatsNew          = new WhatsNew(intProfile, dsn);
            oMaintenanceWindow = new MaintenanceWindow(intProfile, dsn);
            //oRecoveryLocations = new RecoveryLocations(intProfile, dsn);
            oTSM         = new TSM(intProfile, dsn);
            oDNS         = new DNS(intProfile, dsn);
            oSolaris     = new Solaris(intProfile, dsn);
            oZeus        = new Zeus(intProfile, dsn);
            oError       = new Errors(intProfile, dsn);
            oDesign      = new Design(intProfile, dsn);
            oResiliency  = new Resiliency(intProfile, dsn);
            oEnhancement = new Enhancements(intProfile, dsn);

            if (Request.QueryString["type"] != null && Request.QueryString["type"] != "")
            {
                lblType.Text = Request.QueryString["type"];
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                lblId.Text = Request.QueryString["id"];
            }
            string strControl = "";

            if (Request.QueryString["control"] != null)
            {
                strControl = Request.QueryString["control"];
            }
            btnSave.Attributes.Add("onclick", "return Update('hdnUpdateOrder','" + strControl + "');");
            btnClose.Attributes.Add("onclick", "return HidePanel();");
            imgOrderUp.Attributes.Add("onclick", "return MoveOrderUp(" + lstOrder.ClientID + ");");
            imgOrderDown.Attributes.Add("onclick", "return MoveOrderDown(" + lstOrder.ClientID + ");");
            LoadList();
        }
Exemplo n.º 13
0
        private void LoadLists(int _classid, int _environmentid)
        {
            ddlOS.DataValueField = "id";
            ddlOS.DataTextField  = "name";
            ddlOS.DataSource     = oOperatingSystem.Gets(0, 1);
            ddlOS.DataBind();
            ddlOS.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            bool boolEnabled = false;

            if (intOS == 0)
            {
                string strOS = oForecast.GetAnswerPlatformResponse(intAnswer, intOSQuestion);
                if (strOS != "")
                {
                    foreach (ListItem oItem in ddlOS.Items)
                    {
                        if (oItem.Text == strOS)
                        {
                            intOS = Int32.Parse(oItem.Value);
                            break;
                        }
                    }
                }
                if (intOS == 0 && Request.QueryString["osid"] != null && Request.QueryString["osid"] != "")
                {
                    intOS       = Int32.Parse(Request.QueryString["osid"]);
                    boolEnabled = true;
                }
            }
            if (intOS > 0)
            {
                ddlOS.SelectedValue           = intOS.ToString();
                ddlOS.Enabled                 = boolEnabled;
                ddlServicePack.DataValueField = "id";
                ddlServicePack.DataTextField  = "name";
                ddlServicePack.DataSource     = oOperatingSystem.GetServicePack(intOS);
                ddlServicePack.DataBind();
                ddlServicePack.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                ddlMaintenance.DataValueField = "id";
                ddlMaintenance.DataTextField  = "name";
                ddlMaintenance.DataSource     = oOperatingSystem.GetServicePack(intOS);
                ddlMaintenance.DataBind();
                ddlMaintenance.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                ddlTemplate.DataValueField = "id";
                ddlTemplate.DataTextField  = "name";
                ddlTemplate.DataSource     = oVMWare.GetTemplateClassEnvironment(_classid, _environmentid);
                ddlTemplate.DataBind();
                ddlTemplate.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            }
            else
            {
                ServicePacks oServicePack = new ServicePacks(intProfile, dsn);
                ddlServicePack.DataValueField = "id";
                ddlServicePack.DataTextField  = "name";
                ddlServicePack.DataSource     = oServicePack.Gets(1);
                ddlServicePack.DataBind();
                ddlServicePack.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                ddlMaintenance.DataValueField = "id";
                ddlMaintenance.DataTextField  = "name";
                ddlMaintenance.DataSource     = oServicePack.Gets(1);
                ddlMaintenance.DataBind();
                ddlMaintenance.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            }
            Domains oDomain = new Domains(intProfile, dsn);

            ddlDomain.DataValueField = "id";
            ddlDomain.DataTextField  = "name";
            ddlDomain.DataSource     = oDomain.GetClassEnvironment(_classid, _environmentid);
            ddlDomain.DataBind();
            ddlDomain.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            ddlTestDomain.DataValueField = "id";
            ddlTestDomain.DataTextField  = "name";
            ddlTestDomain.DataSource     = oDomain.GetsTest(1);
            ddlTestDomain.DataBind();
            ddlTestDomain.Items.Insert(0, new ListItem("-- SELECT --", "0"));
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oWorkstation      = new Workstations(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                    //      -100: More than one device name
                    //       -10: No device names
                    //        -5: Improper Name Format
                    //        -1: ServerID = 0
                    if (Request.QueryString["error"] == "-100")
                    {
                        lblError.Text = "More than one name";
                    }
                    else if (Request.QueryString["error"] == "-10")
                    {
                        lblError.Text = "User Cancelled Prompt";
                    }
                    else if (Request.QueryString["error"] == "-5")
                    {
                        lblError.Text = "Name is in Incorrect Format";
                    }
                    else if (Request.QueryString["error"] == "-1")
                    {
                        lblError.Text = "DeviceID = 0";
                    }
                    else
                    {
                        lblError.Text = "Generic Error";
                    }
                }
                Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID);
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (intID > 0)
                {
                    DataSet ds = oDataPoint.GetAsset(intID);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | Virtual Workstation (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about a Microsoft Virtual Workstation...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Host Information", "");
                        oTab.AddTab("Account Information", "");
                        oTab.AddTab("Provisioning Information", "");
                        strMenuTab1 = oTab.GetTabs();

                        if (!IsPostBack)
                        {
                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "WORKSTATION_VIRTUAL_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "WORKSTATION_VIRTUAL_ASSET", strAsset, "", false, true);


                            int intAssetAttribute = Int32.Parse(oAsset.Get(intAsset, "asset_attribute"));
                            oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false);
                            oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true);
                            ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()");

                            ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');");
                            int intModel = Int32.Parse(oAsset.Get(intAsset, "modelid"));

                            hdnModel.Value = intModel.ToString();
                            int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            int intType        = oModel.GetType(intModelParent);
                            int intPlatform    = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "WORKSTATION_VIRTUAL_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "WORKSTATION_VIRTUAL_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "WORKSTATION_VIRTUAL_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "WORKSTATION_VIRTUAL_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            DataSet dsAsset = oWorkstation.GetVirtualAsset(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, null, "", lblName, fldName, "WORKSTATION_VIRTUAL_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false);
                                if (txtName.Text != "")
                                {
                                    lblHeader.Text += "&nbsp;&nbsp;&nbsp;[" + txtName.Text + "]";
                                }
                                lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString();
                                int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString());
                                int intEnv   = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString());
                                hdnEnvironment.Value = intEnv.ToString();
                                oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "WORKSTATION_VIRTUAL_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "WORKSTATION_VIRTUAL_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true);
                                ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString();
                                ddlStatus.Enabled       = (intAssetAttribute == (int)AssetAttribute.Ok);
                                panStatus.Visible       = (ddlStatus.Enabled == false);

                                int intOS = Int32.Parse(dsAsset.Tables[0].Rows[0]["osid"].ToString());
                                oDataPoint.LoadDropDown(ddlPlatformOS, intProfile, null, "", lblPlatformOS, fldPlatformOS, "WORKSTATION_VIRTUAL_OS", "name", "id", oOperatingSystem.Gets(1, 1), intOS, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformServicePack, intProfile, null, "", lblPlatformServicePack, fldPlatformServicePack, "WORKSTATION_VIRTUAL_SP", "name", "id", oOperatingSystem.GetServicePack(intOS), Int32.Parse(dsAsset.Tables[0].Rows[0]["spid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformDomain, intProfile, null, "", lblPlatformDomain, fldPlatformDomain, "WORKSTATION_VIRTUAL_DOMAIN", "name", "id", oDomain.Gets(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["domainid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformHDD, intProfile, null, "", lblPlatformHDD, fldPlatformHDD, "WORKSTATION_VIRTUAL_HDD", "name", "id", oVirtualHDD.GetVirtuals(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["hddid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformRam, intProfile, null, "", lblPlatformRam, fldPlatformRam, "WORKSTATION_VIRTUAL_RAM", "name", "id", oVirtualRam.GetVirtuals(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["ramid"].ToString()), false, false, true);
                                lblCPUs.Text = "1";
                            }
                            else
                            {
                                Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                            }

                            // Get Host
                            oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["hostname"].ToString()), lblHostName, fldHostName, "WORKSTATION_VIRTUAL_HOST", dsAsset.Tables[0].Rows[0]["hostname"].ToString(), "", false, false);

                            // Account Information
                            DataSet dsAccounts = oWorkstation.GetAccountsVirtual(intAsset);
                            rptAccounts.DataSource = dsAccounts;
                            rptAccounts.DataBind();
                            lblNone.Visible = (rptAccounts.Items.Count == 0);

                            // Provioning History
                            rptHistory.DataSource = SqlHelper.ExecuteDataset(dsnAsset, CommandType.Text, oDataPoint.AssetHistorySelect(intAsset));
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);
                            oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "WORKSTATION_VIRTUAL_STATUS");
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "")
                {
                    string  strQuery = oFunction.decryptQueryString(Request.QueryString["q"]);
                    DataSet ds       = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                        Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()));
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnName.Attributes.Add("onclick", "return OpenWindow('DEVICE_NAME','?assetid=" + intAsset.ToString() + "');");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                    //      -100: More than one device name
                    //       -10: No device names
                    //        -5: Improper Name Format
                    //        -1: ServerID = 0
                    if (Request.QueryString["error"] == "-100")
                    {
                        lblError.Text = "More than one name";
                    }
                    else if (Request.QueryString["error"] == "-10")
                    {
                        lblError.Text = "User Cancelled Prompt";
                    }
                    else if (Request.QueryString["error"] == "-5")
                    {
                        lblError.Text = "Name is in Incorrect Format";
                    }
                    else if (Request.QueryString["error"] == "-1")
                    {
                        lblError.Text = "DeviceID = 0";
                    }
                    else
                    {
                        lblError.Text = "Generic Error";
                    }
                }
                Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID);
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (intID > 0)
                {
                    DataSet ds = oDataPoint.GetAsset(intID);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | VMware (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about a VMware guest...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Host Information", "");
                        oTab.AddTab("Resource Dependencies", "");
                        oTab.AddTab("Provisioning Information", "");
                        //oTab.AddTab("Network Adapter Configuration", "");
                        strMenuTab1 = oTab.GetTabs();

                        if (!IsPostBack)
                        {
                            //DataSet dsAssets = oServer.GetAsset(intAsset);
                            //foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                            //{
                            //    if (drAsset["latest"].ToString() == "1")
                            //    {
                            //        intAsset = Int32.Parse(drAsset["assetid"].ToString());
                            //        intAssetClass = Int32.Parse(drAsset["classid"].ToString());
                            //        intAssetEnv = Int32.Parse(drAsset["environmentid"].ToString());
                            //        break;
                            //    }
                            //}

                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "VMWARE_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "VMWARE_ASSET", strAsset, "", false, true);

                            int intAssetAttribute = 0;
                            Int32.TryParse(oAsset.Get(intAsset, "asset_attribute"), out intAssetAttribute);
                            oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false);
                            oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true);
                            ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()");

                            ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');");
                            int intModel = 0;
                            Int32.TryParse(oAsset.Get(intAsset, "modelid"), out intModel);

                            hdnModel.Value = intModel.ToString();
                            int intModelParent = 0;
                            Int32.TryParse(oModelsProperties.Get(intModel, "modelid"), out intModelParent);
                            int intType     = oModel.GetType(intModelParent);
                            int intPlatform = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "VMWARE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "VMWARE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "VMWARE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "VMWARE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            DataSet dsAsset = oAsset.GetGuest(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, btnNameLookup, "/datapoint/asset/datapoint_asset_search.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["name"].ToString()), lblName, fldName, "VMWARE_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false);
                                if (txtName.Text != "")
                                {
                                    lblHeader.Text += "&nbsp;&nbsp;&nbsp;[" + txtName.Text + "]";
                                }
                                lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString();
                                int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString());
                                int intEnv   = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString());
                                hdnEnvironment.Value = intEnv.ToString();
                                oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "VMWARE_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "VMWARE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true);
                                ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString();
                                ddlStatus.Enabled       = (intAssetAttribute == (int)AssetAttribute.Ok);
                                panStatus.Visible       = (ddlStatus.Enabled == false);
                            }
                            else
                            {
                                Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                            }

                            // Get Original Detail
                            VMWare  oVMWare = new VMWare(intProfile, dsn);
                            DataSet dsGuest = oVMWare.GetGuest(dsAsset.Tables[0].Rows[0]["name"].ToString());
                            if (dsGuest.Tables[0].Rows.Count > 0)
                            {
                                panVMWare.Visible = true;
                                DataRow drGuest      = dsGuest.Tables[0].Rows[0];
                                int     intDatastore = Int32.Parse(drGuest["datastoreid"].ToString());
                                lblBuildDataStore.Text = oVMWare.GetDatastore(intDatastore, "name");
                                int intHost = Int32.Parse(drGuest["hostid"].ToString());
                                lblBuildHost.Text = oVMWare.GetHost(intHost, "name");
                                int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid"));
                                lblBuildCluster.Text = oVMWare.GetCluster(intCluster, "name");
                                int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid"));
                                lblBuildFolder.Text = oVMWare.GetFolder(intFolder, "name");
                                int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid"));
                                lblBuildDataCenter.Text = oVMWare.GetDatacenter(intDataCenter, "name");
                                int intVirtualCenter = Int32.Parse(oVMWare.GetDatacenter(intDataCenter, "virtualcenterid"));
                                lblBuildVirtualCenter.Text = oVMWare.GetVirtualCenter(intVirtualCenter, "name");

                                // Get Host
                                if (Request.Cookies["host"] != null && Request.Cookies["host"].Value != "")
                                {
                                    string strHost = "";
                                    string strFind = txtName.Text;
                                    //strFind = "ohcleapp103d";
                                    DateTime datStart = DateTime.Parse(Request.Cookies["host"].Value);
                                    Response.Cookies["host"].Value = "";
                                    //VMWare oVMWare = new VMWare(intProfile, dsn);
                                    DataSet dsVirtualCenter = oVMWare.GetVirtualCenters(1);
                                    foreach (DataRow drVirtualCenter in dsVirtualCenter.Tables[0].Rows)
                                    {
                                        intVirtualCenter = Int32.Parse(drVirtualCenter["id"].ToString());
                                        string  strVirtualCenter    = drVirtualCenter["name"].ToString();
                                        string  strVirtualCenterURL = drVirtualCenter["url"].ToString();
                                        int     intVirtualCenterEnv = Int32.Parse(drVirtualCenter["environment"].ToString());
                                        DataSet dsDataCenter        = oVMWare.GetDatacenters(intVirtualCenter, 1);
                                        foreach (DataRow drDataCenter in dsDataCenter.Tables[0].Rows)
                                        {
                                            intDataCenter = Int32.Parse(drDataCenter["id"].ToString());
                                            string         strDataCenter = drDataCenter["name"].ToString();
                                            string         strConnect    = oVMWare.ConnectDEBUG(strVirtualCenterURL, intVirtualCenterEnv, strDataCenter);
                                            VimService     _service      = oVMWare.GetService();
                                            ServiceContent _sic          = oVMWare.GetSic();
                                            try
                                            {
                                                ManagedObjectReference oVM = oVMWare.GetVM(strFind);
                                                GuestInfo ginfo            = (GuestInfo)oVMWare.getObjectProperty(oVM, "guest");
                                                lblGuestName.Text  = ginfo.guestFullName;
                                                lblGuestState.Text = ginfo.guestState;
                                                GuestNicInfo[] nInfo = ginfo.net;
                                                foreach (GuestNicInfo nic in nInfo)
                                                {
                                                    string[] strIPAddresses = nic.ipAddress;
                                                    foreach (string strIPAddress in strIPAddresses)
                                                    {
                                                        if (lblIPAddress.Text != "")
                                                        {
                                                            lblIPAddress.Text += ", ";
                                                        }
                                                        lblIPAddress.Text += strIPAddress;
                                                    }
                                                    if (lblMACAddress.Text != "")
                                                    {
                                                        lblMACAddress.Text += ", ";
                                                    }
                                                    lblMACAddress.Text += nic.macAddress;
                                                    if (lblNetwork.Text != "")
                                                    {
                                                        lblNetwork.Text += ", ";
                                                    }
                                                    lblNetwork.Text += nic.network;
                                                }
                                                VirtualMachineConfigInfo    vminfo     = (VirtualMachineConfigInfo)oVMWare.getObjectProperty(oVM, "config");
                                                VirtualMachineSummary       oVMSummary = (VirtualMachineSummary)oVMWare.getObjectProperty(oVM, "summary");
                                                VirtualMachineConfigSummary oVMConfig  = oVMSummary.config;
                                                lblRAM.Text  = oVMConfig.memorySizeMB.ToString();
                                                lblCPUs.Text = oVMConfig.numCpu.ToString();
                                                lblPath.Text = oVMConfig.vmPathName;
                                                VirtualMachineRuntimeInfo oVMRuntime = oVMSummary.runtime;
                                                ManagedObjectReference    oVMHost    = oVMRuntime.host;
                                                strHost = (string)oVMWare.getObjectProperty(oVMHost, "name");
                                                if (strHost.IndexOf(".") > -1)
                                                {
                                                    strHost = strHost.Substring(0, strHost.IndexOf("."));
                                                }
                                                lblVirtualCenter.Text = strVirtualCenter;
                                                lblDataCenter.Text    = strDataCenter;
                                                break;
                                            }
                                            catch { }
                                            finally
                                            {
                                                if (_service != null)
                                                {
                                                    _service.Abort();
                                                    if (_service.Container != null)
                                                    {
                                                        _service.Container.Dispose();
                                                    }
                                                    try
                                                    {
                                                        _service.Logout(_sic.sessionManager);
                                                    }
                                                    catch { }
                                                    _service.Dispose();
                                                    _service = null;
                                                    _sic     = null;
                                                }
                                            }
                                        }
                                    }
                                    if (strHost != "")
                                    {
                                        oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(strHost), lblHostName, fldHostName, "VMWARE_HOST", strHost, "", false, false);
                                    }
                                    else
                                    {
                                        panHostNo.Visible = true;
                                    }
                                    TimeSpan oSpan = DateTime.Now.Subtract(datStart);
                                    btnHostQuery.Enabled = false;
                                    btnHostQuery.Text    = "Query Time: " + oSpan.TotalSeconds.ToString("0") + " seconds...";
                                }
                                else
                                {
                                    txtHostName.Visible   = false;
                                    lblHostName.Text      = "---";
                                    lblDataCenter.Text    = "---";
                                    lblVirtualCenter.Text = "---";
                                }
                                oDataPoint.LoadPanel(panHostQuery, intProfile, fldHostQuery, "VMWARE_HOST_QUERY");
                            }
                            else
                            {
                                Solaris oSolaris  = new Solaris(intProfile, dsn);
                                DataSet dsServers = oServer.GetAssetsAsset(intAsset);
                                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                                {
                                    DataSet dsSVE = oSolaris.GetSVEGuest(Int32.Parse(drServer["serverid"].ToString()));
                                    if (dsSVE.Tables[0].Rows.Count > 0)
                                    {
                                        panSVE.Visible = true;
                                        int intCluster = Int32.Parse(dsSVE.Tables[0].Rows[0]["clusterid"].ToString());
                                        lblSVECluster.Text = oSolaris.GetSVECluster(intCluster, "name");
                                    }
                                }
                            }


                            // Resource Dependencies
                            AssetOrder      oAssetOrder     = new AssetOrder(0, dsn, dsnAsset, intEnvironment);
                            Services        oService        = new Services(0, dsn);
                            ServiceRequests oServiceRequest = new ServiceRequests(0, dsn);
                            rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false);
                            rptServiceRequests.DataBind();
                            trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0);
                            foreach (RepeaterItem ri in rptServiceRequests.Items)
                            {
                                Label lblServiceID = (Label)ri.FindControl("lblServiceID");
                                int   intService   = Int32.Parse(lblServiceID.Text);
                                Label lblDetails   = (Label)ri.FindControl("lblDetails");
                                Label lblProgress  = (Label)ri.FindControl("lblProgress");

                                if (lblProgress.Text == "")
                                {
                                    lblProgress.Text = "<i>Unavailable</i>";
                                }
                                else
                                {
                                    int     intResource  = Int32.Parse(lblProgress.Text);
                                    double  dblAllocated = 0.00;
                                    double  dblUsed      = 0.00;
                                    int     intStatus    = 0;
                                    bool    boolAssigned = false;
                                    DataSet dsResource   = oDataPoint.GetServiceRequestResource(intResource);
                                    if (dsResource.Tables[0].Rows.Count > 0)
                                    {
                                        Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus);
                                    }
                                    foreach (DataRow drResource in dsResource.Tables[1].Rows)
                                    {
                                        boolAssigned  = true;
                                        dblAllocated += double.Parse(drResource["allocated"].ToString());
                                        dblUsed      += double.Parse(drResource["used"].ToString());
                                        intStatus     = Int32.Parse(drResource["status"].ToString());
                                    }
                                    if (intStatus == (int)ResourceRequestStatus.Closed)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true);
                                    }
                                    else if (intStatus == (int)ResourceRequestStatus.Cancelled)
                                    {
                                        lblProgress.Text = "Cancelled";
                                    }
                                    else if (boolAssigned == false)
                                    {
                                        string  strManager = "";
                                        DataSet dsManager  = oService.GetUser(intService, 1); // Managers
                                        foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                        {
                                            if (strManager != "")
                                            {
                                                strManager += "\\n";
                                            }
                                            int intManager = Int32.Parse(drManager["userid"].ToString());
                                            strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]";
                                        }
                                        lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>";
                                    }
                                    else if (dblAllocated > 0.00)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                                    }
                                    else
                                    {
                                        lblProgress.Text = "<i>N / A</i>";
                                    }
                                    lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>";
                                }
                            }

                            // Provioning History
                            rptHistory.DataSource = oAsset.GetProvisioningHistory(oDataPoint.AssetHistorySelect(intAsset));
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);
                            oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "VMWARE_STATUS");
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "")
                {
                    string  strQuery = oFunction.decryptQueryString(Request.QueryString["q"]);
                    DataSet ds       = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        intID = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intID.ToString()));
                    }
                    else
                    {
                        Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?multiple=true&t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"]);
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnName.Attributes.Add("onclick", "return OpenWindow('DEVICE_NAME','?assetid=" + intAsset.ToString() + "');");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                btnHostQuery.Attributes.Add("onclick", "ProcessButton(this,'Querying... please be patient...','225') && ProcessControlButton();");
            }
            else
            {
                panDenied.Visible = true;
            }
        }