protected void Page_Load(object sender, EventArgs e)
        {
            intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage        = new Pages(intProfile, dsn);
            oUser        = new Users(intProfile, dsn);
            oPlatform    = new Platforms(intProfile, dsn);
            oStatusLevel = new StatusLevels(intProfile, dsn);
            oAssetOrder  = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);

            oLocation         = new Locations(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);



            oRequest         = new Requests(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(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);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intPlatform = Int32.Parse(Request.QueryString["id"]);
            }

            intPlatform = 1;
            if (intPlatform != 0)
            {
                pnlAllow.Visible = true;
                if (!IsPostBack)
                {
                    LoadDefaultValues(intPlatform);

                    btnApplyFilter.Attributes.Add("onclick", "return ValidateDate('" + txtStartDate.ClientID + "','Please enter start date')" +
                                                  " && ValidateDate('" + txtEndDate.ClientID + "','Please enter end date')" +
                                                  ";");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "loadCurrentTab", "<script type=\"text/javascript\">window.top.LoadCurrentTab();<" + "/" + "script>");
                }
            }
            else
            {
                pnlDenied.Visible = true;
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oAssetOrder       = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
            oLocation         = new Locations(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oResourceRequest  = new ResourceRequest(intProfile, dsn);
            oService          = new Services(intProfile, dsn);
            oServiceRequest   = new ServiceRequests(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(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);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intPlatform = Int32.Parse(Request.QueryString["id"]);
            }

            //intPlatform = 1;
            if (intPlatform != 0)
            {
                pnlOrder.Visible = true;

                if (!IsPostBack)
                {
                    AddControlsAttributes();
                    LoadLists(intPlatform);
                    if (Request.QueryString["orderid"] != null && Request.QueryString["orderid"] != "")
                    {
                        if (Request.QueryString["submitted"] != null && Request.QueryString["submitted"] == "true")
                        {
                            lblInfo.Text    = "Your information has been submitted successfully.";
                            pnlInfo.Visible = true;
                            pnlOrder.Style.Add("display", "none");
                        }
                        else if (Request.QueryString["saved"] != null && Request.QueryString["saved"] == "true")
                        {
                            lblInfo.Text          = "Your information has been saved successfully.";
                            pnlInfo.Visible       = true;
                            btnNewRequest.Visible = false;
                            hdnOrderId.Value      = Request.QueryString["orderid"];
                            LoadOrderRequest();
                        }
                        else
                        {
                            hdnOrderId.Value = Request.QueryString["orderid"];
                            LoadOrderRequest();
                        }
                    }
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "loadCurrentTab", "<script type=\"text/javascript\">window.top.LoadCurrentTab();<" + "/" + "script>");
                }

                PopulateLocations();
            }
            else
            {
                pnlDenied.Visible = true;
            }
        }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/bypass.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");
     }
     oAsset           = new Asset(intProfile, dsnAsset, dsn);
     oLog             = new Log(intProfile, dsn);
     oUser            = new Users(intProfile, dsn);
     oServer          = new Servers(intProfile, dsn);
     oTSM             = new TSM(intProfile, dsn);
     oResourceRequest = new ResourceRequest(intProfile, dsn);
     oIPAddresses     = new IPAddresses(intProfile, dsnIP, dsn);
     oServerName      = new ServerName(intProfile, dsn);
     oAssetOrder      = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
     if (!IsPostBack)
     {
         Variables oVariable = new Variables(intEnvironment);
         txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','hdnAJAXValue','" + oVariable.URL() + "/frame/users.aspx',2);");
         lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
         txtFind.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnFind.ClientID + "').click();return false;}} else {return true}; ");
         btnFind.Attributes.Add("onclick", "SearchText('" + txtFind.ClientID + "','" + panResult.ClientID + "');return false;");
         txtName.Focus();
         btnSearch.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a device name');");
         btnSubmit.Attributes.Add("onclick", "return ValidateHidden0('hdnAJAXValue','" + txtUser.ClientID + "','Please select the requestor / client')"
                                  + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid date')"
                                  + " && ValidateText('" + txtPTM.ClientID + "','Please enter a change control')"
                                  + " && ValidateText('" + txtReason.ClientID + "','Please enter a reason')"
                                  + "&& confirm('WARNING: You are about to alter production data! This action CANNOT be undone!\\n\\nAre you sure you want to continue?') && confirm('LAST CHANCE! If you do not know what you are doing, I suggest you do not do this!\\n\\nAre you REALLY sure you want to do this?');");
     }
     if (Request.QueryString["assets"] != null)
     {
         string[]      strAssets = Request.QueryString["assets"].Split(strSplit);
         StringBuilder strDeploy = new StringBuilder();
         strDeploy.Append("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\">");
         strDeploy.Append("<tr bgcolor=\"#EEEEEE\"><td><b>Server Name</b></td><td><b>Serial Number</b></td><td><b>Power On Using</b></td><td><b>Backup?</b></td></tr>");
         int intBypass = 0;
         for (int ii = 0; ii < strAssets.Length; ii++)
         {
             if (strAssets[ii].Trim() != "")
             {
                 int    intAsset = Int32.Parse(strAssets[ii].Trim());
                 string strILO   = oAsset.GetServerOrBlade(intAsset, "ilo");
                 strDeploy.Append("<tr>");
                 strDeploy.Append("<td>");
                 string strName = oAsset.GetStatus(intAsset, "name");
                 strDeploy.Append(strName);
                 strDeploy.Append("</td>");
                 strDeploy.Append("<td>");
                 strDeploy.Append(oAsset.Get(intAsset, "serial"));
                 strDeploy.Append("</td>");
                 strDeploy.Append("<td>");
                 strDeploy.Append(strILO == "" ? "VMware Virtual Center" : "ILO: <a href=\"https://" + strILO + "\" target=\"_blank\">" + strILO + "</a>");
                 strDeploy.Append("</td>");
                 strDeploy.Append("<td>");
                 DataSet dsTSM = oTSM.GetDecom(strName);
                 if (dsTSM.Tables[0].Rows.Count > 0)
                 {
                     DataRow drTSM = dsTSM.Tables[0].Rows[0];
                     strDeploy.Append("YES<br/>");
                     strDeploy.Append("Server: " + drTSM["server"].ToString() + "<br/>");
                     strDeploy.Append("Port: " + drTSM["port"].ToString() + "<br/>");
                     strDeploy.Append("Domain: " + drTSM["domain"].ToString() + "<br/>");
                     strDeploy.Append("Schedule: " + drTSM["schedule"].ToString() + "<br/>");
                     strDeploy.Append("Contact(s): " + drTSM["contacts"].ToString());
                 }
                 else
                 {
                     strDeploy.Append("NO");
                 }
                 strDeploy.Append("</td>");
                 strDeploy.Append("</tr>");
                 intBypass++;
             }
         }
         strDeploy.Append("</table>");
         lblResult.Text  = "<p>ClearView bypassed the cooldown for " + intBypass.ToString() + " device(s)...</p>";
         lblResult.Text += "<p>Please use the following information to configure the devices...</p>";
         lblResult.Text += strDeploy.ToString();
     }
 }
Exemple #4
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)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oStatusLevel     = new StatusLevels(intProfile, dsn);
            oAssetOrder      = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
            oAsset           = new Asset(0, dsnAsset, dsn);
            oVariable        = new Variables(intEnvironment);

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                LoadAssetTable();
                //Load Attributes
                if (!IsPostBack)
                {
                    if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>");
                    }
                    if (Request.QueryString["status"] != null && Request.QueryString["status"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Updates Added Successfully');<" + "/" + "script>");
                    }



                    oFunction.ConfigureToolButton(btnEmail, "/images/tool_email");
                    oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                    oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                    oFunction.ConfigureToolButton(btnSave, "/images/tool_save");
                    oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                    oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");

                    btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                    btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                    btnClose.Attributes.Add("onclick", "return ExitWindow();");


                    //btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" +
                    //   ";");

                    btnStatus.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" +
                                             ";");

                    imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
                }

                LoadRequest();
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Exemple #6
0
        public string GetBody(int _requestid, int _itemid, int _number, int _serviceid, int _rrid, int _rr_workflowid, string _se_dsn, int _environment, string _dsn_asset, string _dsn_ip)
        {
            string              strView              = "";
            Applications        oApplication         = new Applications(user, dsn);
            RequestItems        oRequestItem         = new RequestItems(user, dsn);
            ResourceRequest     oResourceRequest     = new ResourceRequest(user, dsn);
            Users               oUser                = new Users(user, dsn);
            Services            oService             = new Services(user, dsn);
            Variables           oVariable            = new Variables(_environment);
            Functions           oFunction            = new Functions(0, dsn, _environment);
            Requests            oRequest             = new Requests(user, dsn);
            Projects            oProject             = new Projects(user, dsn);
            ServiceRequests     oServiceRequest      = new ServiceRequests(user, dsn);
            ServiceEditor       oServiceEditor       = new ServiceEditor(user, _se_dsn);
            Servers             oServer              = new Servers(user, dsn);
            Workstations        oWorkstation         = new Workstations(user, dsn);
            AssetOrder          oAssetOrder          = new AssetOrder(user, dsn, _dsn_asset, _environment);
            AssetSharedEnvOrder oAssetSharedEnvOrder = new AssetSharedEnvOrder(user, dsn, _dsn_asset, _environment);
            PNCTasks            oPNCTask             = new PNCTasks(user, dsn);
            TSM          oTSM         = new TSM(user, dsn);
            StatusLevels oStatusLevel = new StatusLevels();

            DataSet dsRR = oResourceRequest.GetRequestService(_requestid, _serviceid, _number);

            if (dsRR.Tables[0].Rows.Count > 0)
            {
                if (_rrid == 0)
                {
                    Int32.TryParse(dsRR.Tables[0].Rows[0]["parent"].ToString(), out _rrid);
                }
                if (_rr_workflowid == 0)
                {
                    Int32.TryParse(dsRR.Tables[0].Rows[0]["id"].ToString(), out _rr_workflowid);
                }
            }

            // Workflow
            string strWorkflowName = "";
            int    intProject      = oRequest.GetProjectNumber(_requestid);

            if (intProject > 0)
            {
                strView += "<tr><td valign=\"top\"><b>Project Name:</b></td>";
                strView += "<td colspan=\"40\">" + oProject.Get(intProject, "name") + "</td></tr>";
                strView += "<tr><td valign=\"top\"><b>Project Number:</b></td>";
                strView += "<td>" + "<a href=\"" + oRequest.GetDataPointLink(_requestid, _environment) + "\" target=\"_blank\">" + oProject.Get(intProject, "number") + "</a></td></tr>";
            }
            else
            {
                string strTaskName = "N/A";
                if (_rr_workflowid > 0)
                {
                    strTaskName = oResourceRequest.GetWorkflow(_rr_workflowid, "name").Trim();
                }
                if ((strTaskName == "" || strTaskName == "N/A") && _rrid > 0)
                {
                    strTaskName = oResourceRequest.Get(_rrid, "name").Trim();
                }
                if ((strTaskName == "" || strTaskName == "N/A") && _requestid > 0)
                {
                    strTaskName = oServiceRequest.Get(_requestid, "name").Trim();
                }
                strView += "<tr><td valign=\"top\"><b>Task Name:</b></td>";
                strView += "<td colspan=\"40\">" + strTaskName + "</td></tr>";
            }
            strView += "<tr><td valign=\"top\"><b>Task Number:</b></td>";
            strView += "<td>" + "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(_rrid.ToString()) + "', '800', '600');\">CVT" + _requestid.ToString() + "-" + _serviceid.ToString() + "-" + _number.ToString() + "</a></td></tr>";
            //strWorkflowName += "<td>" + "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('" + oRequest.GetDataPointLink(_requestid, _environment) + "', '800', '600');\">CVT" + _requestid.ToString() + "</a></td>";

            string strWorkflowRequested  = "";
            string strWorkflowCreated    = "";
            string strWorkflowService    = "";
            string strWorkflowDepartment = "";
            string strWorkflowResources  = "";
            string strWorkflowStatus     = "";
            string strWorkflowComments   = "";
            int    intStatus             = 0;

            // Requested
            strWorkflowRequested += "<td valign=\"top\"><b>Requested By:</b></td>";
            int intRequestor        = oRequest.GetUser(_requestid);
            int intRequestorManager = 0;

            Int32.TryParse(oUser.Get(intRequestor, "manager"), out intRequestorManager);
            Int32.TryParse(oResourceRequest.Get(_rrid, "status"), out intStatus);
            strWorkflowRequested += "<td>" + oUser.GetFullName(intRequestor) + " (" + oUser.GetName(intRequestor) + ")" + "</td>";
            strWorkflowCreated   += "<td valign=\"top\"><b>Created On:</b></td>";
            if (_rrid > 0)
            {
                strWorkflowCreated += "<td>" + DateTime.Parse(oResourceRequest.Get(_rrid, "created")).ToLongDateString() + "</td>";
            }
            else
            {
                strWorkflowCreated += "<td>" + DateTime.Parse(oRequest.Get(_requestid, "created")).ToLongDateString() + "</td>";
            }
            // Service
            strWorkflowService += "<td valign=\"top\"><b>Service:</b></td>";
            if (_serviceid == 0)
            {
                strWorkflowService += "<td>" + oRequestItem.GetItem(_itemid, "service_title") + "</td>";
            }
            else
            {
                strWorkflowService += "<td>" + oService.GetName(_serviceid) + "</td>";
            }
            // Department
            strWorkflowDepartment += "<td valign=\"top\"><b>Department:</b></td>";
            strWorkflowDepartment += "<td>" + oApplication.Get(oRequestItem.GetItemApplication(_itemid), "service_title") + "</td>";
            // Resources
            string  strApprovers = "";
            DataSet dsApprovals  = oResourceRequest.GetApprovals(_requestid, _serviceid, _number);

            foreach (DataRow drApprover in dsApprovals.Tables[0].Rows)
            {
                int intApprover = Int32.Parse(drApprover["userid"].ToString());
                if (drApprover["approved"].ToString() == "" && drApprover["denied"].ToString() == "")
                {
                    if (strApprovers != "")
                    {
                        strApprovers += "\\n";
                    }
                    strApprovers += oUser.GetFullName(intApprover) + " (" + oUser.GetName(intApprover) + ")";
                }
            }
            bool boolAutomated = (oService.Get(_serviceid, "automate") == "1");

            if (boolAutomated == false)
            {
                DataSet dsReqForm = oRequestItem.GetForm(_requestid, _serviceid, _itemid, _number);
                if (dsReqForm.Tables[0].Rows.Count > 0)
                {
                    boolAutomated = (dsReqForm.Tables[0].Rows[0]["automated"].ToString() == "1" ? true : false);
                }
            }
            strWorkflowResources += "<td valign=\"top\"><b>Assigned:</b></td>";
            strWorkflowStatus    += "<td><b>Status:</b></td>";
            if (boolAutomated == true)
            {
                strWorkflowResources += "<td valign=\"top\">---</td>";
                intStatus             = (int)ResourceRequestStatus.NotAvailable; // Set to N/A since it is automated...
                strWorkflowStatus    += "<td>" + oStatusLevel.HTML(intStatus) + "</td>";
            }
            else
            {
                List <WorkflowStatus> RR = oResourceRequest.GetStatus(null, _rrid, null, null, null, null, false, _se_dsn);
                if (RR.Count > 0)
                {
                    StringBuilder strUsers = new StringBuilder();
                    foreach (string strUser in RR[0].users)
                    {
                        if (String.IsNullOrEmpty(strUser) == false)
                        {
                            strUsers.Append(strUser);
                            strUsers.AppendLine("<br/>");
                        }
                    }
                    strWorkflowResources += "<td valign=\"top\">" + strUsers.ToString() + "</td>";
                    strWorkflowStatus    += "<td>" + RR[0].status + "</td>";
                    if (String.IsNullOrEmpty(RR[0].comments) == false)
                    {
                        strWorkflowComments += "<td valign=\"top\"><b>Comments:</b></td>";
                        strWorkflowComments += "<td valign=\"top\">" + oFunction.FormatText(RR[0].comments) + "</td>";
                    }
                }
                else
                {
                    strWorkflowResources += "<td valign=\"top\"> N / A </td>";
                    strWorkflowStatus    += "<td> N / A </td>";
                }
            }
            strView += "<tr>" + strWorkflowRequested + "</tr><tr>" + strWorkflowCreated + "</tr><tr>" + strWorkflowService + "</tr><tr>" + strWorkflowDepartment + "</tr>" + "<tr>" + strWorkflowStatus + "</tr>" + (strWorkflowResources == "" ? "" : "<tr>" + strWorkflowResources + "</tr>") + (strWorkflowComments == "" ? "" : "<tr>" + strWorkflowComments + "</tr>");

            if (strView == "")
            {
                strView = "Information Unavailable";
            }
            else
            {
                strView = "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strView + "</table>";
                StringBuilder      sbViewRequest       = new StringBuilder();
                Customized         oCustomized         = new Customized(user, dsn);
                DNS                oDNS                = new DNS(user, dsn);
                OnDemandTasks      oOnDemandTask       = new OnDemandTasks(user, dsn);
                Reports            oReport             = new Reports(user, dsn);
                Audit              oAudit              = new Audit(user, dsn);
                Enhancements       oEnhancement        = new Enhancements(user, dsn);
                ServerDecommission oServerDecommission = new ServerDecommission(0, dsn);
                Storage            oStorage            = new Storage(0, dsn);

                string strCatch = "1";
                try
                {
                    sbViewRequest.Append(oServiceEditor.GetRequestBody(_requestid, _serviceid, _number, dsn));
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "2";
                        sbViewRequest.Append(oCustomized.GetPNCDNSConflictBody(_requestid, _itemid, _number));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "3";
                        sbViewRequest.Append(oCustomized.GetStorage3rdBody(_requestid, _itemid, _number, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "4";
                        sbViewRequest.Append(oOnDemandTask.GetServerOther(_requestid, _serviceid, _number, _environment, _dsn_asset, _dsn_ip));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "5";
                        sbViewRequest.Append(GetBody(oReport.GetOrderReport(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "6";
                        sbViewRequest.Append(oServerDecommission.GetBody(_requestid, _number, _dsn_asset, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "7";
                        sbViewRequest.Append(oCustomized.GetDecommissionServerBody(_requestid, _itemid, _number, _dsn_asset));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "7.1";
                        sbViewRequest.Append(oWorkstation.GetApprovalSummary(_requestid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "8";
                        int intEnhancementID = oCustomized.GetEnhancementID(_requestid);
                        if (intEnhancementID > 0)
                        {
                            sbViewRequest.Append("<tr><td>");
                            sbViewRequest.Append(oCustomized.GetEnhancementBody(intEnhancementID, _environment, false));
                            sbViewRequest.Append("</td></tr>");
                        }
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "9";
                        int intIssueID = oCustomized.GetIssueID(_requestid);
                        if (intIssueID > 0)
                        {
                            sbViewRequest.Append("<tr><td>");
                            sbViewRequest.Append(oCustomized.GetIssueBody(intIssueID, _environment, false));
                            sbViewRequest.Append("</td></tr>");
                        }
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "10";
                        sbViewRequest.Append(GetBody(oCustomized.GetIIS(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "11";
                        sbViewRequest.Append(GetBody(oCustomized.GetRemediation(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "12";
                        sbViewRequest.Append(GetBody(oCustomized.GetServerArchive(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "13";
                        sbViewRequest.Append(GetBody(oCustomized.GetServerRetrieve(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "14";
                        sbViewRequest.Append(GetBody(oCustomized.GetTPM(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "15";
                        sbViewRequest.Append(GetBody(oCustomized.GetWorkstation(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "16";
                        sbViewRequest.Append(GetBody(oCustomized.GetThirdTierDistributed(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "17";
                        sbViewRequest.Append(GetBody(oCustomized.GetGeneric(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "18";
                        sbViewRequest.Append(oDNS.GetDNSBody(_requestid, _itemid, _number, false, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "19";
                        sbViewRequest.Append(oAudit.GetErrorBody(_requestid, _serviceid, _number));
                    }

                    if (sbViewRequest.ToString() == "")//Server Error Provisioning Support
                    {
                        strCatch = "20";
                        sbViewRequest.Append(oServer.GetErrorDetailsBody(_requestid, _itemid, _number, _environment));
                    }

                    if (sbViewRequest.ToString() == "") //Workstation Error Provisioning Support
                    {
                        strCatch = "21";
                        sbViewRequest.Append(oWorkstation.GetVirtualErrorDetailsBody(_requestid, _number, _environment));
                    }

                    if (sbViewRequest.ToString() == "") //Asset Procurement
                    {
                        strCatch = "22";
                        sbViewRequest.Append(oAssetOrder.GetOrderBody(_requestid, _itemid, _number));
                    }

                    if (sbViewRequest.ToString() == "") //Shared Environement - IM
                    {
                        strCatch = "23";
                        sbViewRequest.Append(oAssetSharedEnvOrder.GetOrderBody(_requestid, _itemid, _number));
                    }

                    if (sbViewRequest.ToString() == "") //Backup
                    {
                        strCatch = "24";
                        sbViewRequest.Append(oTSM.GetBody(_requestid, _itemid, _number, _dsn_asset, _dsn_ip));
                    }

                    if (sbViewRequest.ToString() == "") // New Enhancement
                    {
                        strCatch = "25";
                        sbViewRequest.Append(oEnhancement.GetBodyRequest(_requestid, _environment));
                    }

                    if (sbViewRequest.ToString() == "") // New Enhancement
                    {
                        strCatch = "26";
                        sbViewRequest.Append(oStorage.GetBody(_requestid, _itemid, _number, _dsn_asset, _dsn_ip, _environment, false));
                    }


                    if (sbViewRequest.ToString() == "")
                    {
                        //strViewRequest = "Information Unavailable";
                        sbViewRequest.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    }
                    else
                    {
                        if (sbViewRequest.ToString().Trim().StartsWith("<table") == false)
                        {
                            sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">");
                            sbViewRequest.Append("</table>");
                        }
                    }
                }
                catch
                {
                    sbViewRequest = new StringBuilder("&nbsp;&nbsp;** WARNING: Information Unavailable (# " + strCatch + ") **&nbsp;&nbsp;");
                }
                sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\"><tr><td>");
                sbViewRequest.Append("</td></tr></table>");
                strView += "<br/>" + sbViewRequest.ToString();
            }
            return(strView);
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oStatusLevel     = new StatusLevels(intProfile, dsn);
            oAssetOrder      = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
            oVariable        = new Variables(intEnvironment);


            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                //Load Attributes
                if (!IsPostBack)
                {
                    if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>");
                    }
                    if (Request.QueryString["status"] != null && Request.QueryString["status"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Updates Added Successfully');<" + "/" + "script>");
                    }


                    LoadLists();
                    oFunction.ConfigureToolButton(btnEmail, "/images/tool_email");
                    oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                    oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                    oFunction.ConfigureToolButton(btnSave, "/images/tool_save");
                    oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                    oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");

                    btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                    btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                    btnClose.Attributes.Add("onclick", "return ExitWindow();");


                    btnSave.Attributes.Add("onclick", "return ValidateText('" + txtNickName.ClientID + "','Please enter the nick name')" +
                                           " && ValidateNumber('" + txtApprovedQuantity.ClientID + "','Please enter the quantity.')" +
                                           //" && ValidateNumber('" + txtProcureQuantity.ClientID + "','Please enter the quantity.')" +
                                           //" && ValidateNumber('" + txtReDeployQuantity.ClientID + "','Please enter the re-deploy quantity.')" +
                                           //" && ValidateNumber('" + txtReturnedQuantity.ClientID + "','Please enter the returned quantity.')" +
                                           " && ValidateDropDown('" + ddlPurchaseOrderStatus.ClientID + "','Please select the purchase order status')" +
                                           " && ValidatePurchaseOrderStatus()" +
                                           ";");
                    //" && ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" +
                    btnStatus.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" +
                                             ";");

                    imgBtnPurchaseOrderDate.Attributes.Add("onclick", "return ShowCalendar('" + txtPurchaseOrderDate.ClientID + "');");
                    imgApprovedOn.Attributes.Add("onclick", "return ShowCalendar('" + txtApprovedOn.ClientID + "');");
                    imgQuoteDate.Attributes.Add("onclick", "return ShowCalendar('" + txtQuoteDate.ClientID + "','" + txtWarrantyDate.ClientID + "',1095);");
                    imgBtnVendorOrderDate.Attributes.Add("onclick", "return ShowCalendar('" + txtVendorOrderDate.ClientID + "');");
                    txtAttentionTo.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divAttentionTo.ClientID + "','" + lstAttentionTo.ClientID + "','" + hdnAttentionTo.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstAttentionTo.Attributes.Add("ondblclick", "AJAXClickRow();");
                    txtProjectManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divProjectManager.ClientID + "','" + lstProjectManager.ClientID + "','" + hdnProjectManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstProjectManager.Attributes.Add("ondblclick", "AJAXClickRow();");


                    imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
                }

                LoadRequest();
            }
            else
            {
                panDenied.Visible = true;
            }
        }
        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;
            }
        }
Exemple #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;
            }
        }
Exemple #10
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;
            }
        }