Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/ip_vlans.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");
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     oLocation    = new Locations(intProfile, dsn);
     oResiliency  = new Resiliency(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadLists();
         LoadClasses();
         oTreeview.ExpandDepth = 0;
         btnParent.Attributes.Add("onclick", "return OpenWindow('LOCATION_BROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
         ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
     }
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/vmware/clusters.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");
            }
            oVMWare           = new VMWare(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            if (Request.QueryString["id"] != null)
            {
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (intID > 0 && !IsPostBack)
                {
                    DataSet ds            = oVMWare.GetCluster(intID);
                    int     intFolder     = Int32.Parse(ds.Tables[0].Rows[0]["folderid"].ToString());
                    int     intDatacenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid"));
                    LoadFolders(intDatacenter);
                    ddlParent.SelectedValue = intFolder.ToString();
                    int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                    hdnModel.Value                = intModel.ToString();
                    txtName.Text                  = ds.Tables[0].Rows[0]["name"].ToString();
                    ddlVersion.SelectedValue      = ds.Tables[0].Rows[0]["version"].ToString();
                    ddlAntiAffinity.SelectedValue = ds.Tables[0].Rows[0]["anti_affinity"].ToString();
                    txtMaximum.Text               = ds.Tables[0].Rows[0]["maximum"].ToString();
                    txtResourcePool.Text          = ds.Tables[0].Rows[0]["resource_pool"].ToString();
                    txtDatastoreNotify.Text       = ds.Tables[0].Rows[0]["datastores_notify"].ToString();
                    txtDatastoreLeft.Text         = ds.Tables[0].Rows[0]["datastores_left"].ToString();
                    txtDatastoreSize.Text         = ds.Tables[0].Rows[0]["datastores_size"].ToString();
                    chkPNC.Checked                = (ds.Tables[0].Rows[0]["pnc"].ToString() == "1");
                    chkFull.Checked               = (ds.Tables[0].Rows[0]["at_max"].ToString() == "1");
                    chkAPoff.Checked              = (ds.Tables[0].Rows[0]["auto_provision_off"].ToString() == "1");
                    chkAPoffDR.Checked            = (ds.Tables[0].Rows[0]["auto_provision_dr_off"].ToString() == "1");
                    chkDell.Checked               = (ds.Tables[0].Rows[0]["dell"].ToString() == "1");
                    ddlResiliency.SelectedValue   = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                    chkOracle.Checked             = (ds.Tables[0].Rows[0]["can_oracle"].ToString() == "1");
                    chkOracleCluster.Checked      = (ds.Tables[0].Rows[0]["can_oracle_cluster"].ToString() == "1");
                    chkSQL.Checked                = (ds.Tables[0].Rows[0]["can_sql"].ToString() == "1");
                    chkSQLCluster.Checked         = (ds.Tables[0].Rows[0]["can_sql_cluster"].ToString() == "1");
                    chkCluster.Checked            = (ds.Tables[0].Rows[0]["can_cluster"].ToString() == "1");
                    chkEnabled.Checked            = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    // Calculations
                    double dblA3  = 0.00;
                    double dblA4  = 0.00;
                    double dblA5  = 0.00;
                    double dblA8  = 0.00;
                    double dblA10 = 0.00;
                    double dblA20 = 0.00;
                    double dblA21 = 0.00;
                    double dblA22 = 0.00;
                    double dblA25 = 0.00;
                    double dblA26 = 0.00;
                    double dblA29 = 0.00;
                    double dblA30 = 0.00;
                    if (ds.Tables[0].Rows[0]["input_failures"].ToString() != "")
                    {
                        dblA3 = double.Parse(ds.Tables[0].Rows[0]["input_failures"].ToString());
                    }
                    txtFailures.Text = dblA3.ToString();
                    if (ds.Tables[0].Rows[0]["input_cpu_utilization"].ToString() != "")
                    {
                        dblA4 = double.Parse(ds.Tables[0].Rows[0]["input_cpu_utilization"].ToString());
                    }
                    txtCPUUtilization.Text = dblA4.ToString();
                    if (ds.Tables[0].Rows[0]["input_ram_utilization"].ToString() != "")
                    {
                        dblA5 = double.Parse(ds.Tables[0].Rows[0]["input_ram_utilization"].ToString());
                    }
                    txtRAMUtilization.Text = dblA5.ToString();
                    if (ds.Tables[0].Rows[0]["input_max_ram"].ToString() != "")
                    {
                        dblA8 = double.Parse(ds.Tables[0].Rows[0]["input_max_ram"].ToString());
                    }
                    txtMaxRAM.Text = dblA8.ToString();
                    if (ds.Tables[0].Rows[0]["input_avg_utilization"].ToString() != "")
                    {
                        dblA10 = double.Parse(ds.Tables[0].Rows[0]["input_avg_utilization"].ToString());
                    }
                    txtAvgUtilization.Text = dblA10.ToString();
                    if (ds.Tables[0].Rows[0]["input_lun_size"].ToString() != "")
                    {
                        dblA20 = double.Parse(ds.Tables[0].Rows[0]["input_lun_size"].ToString());
                    }
                    txtLunSize.Text = dblA20.ToString();
                    if (ds.Tables[0].Rows[0]["input_lun_utilization"].ToString() != "")
                    {
                        dblA21 = double.Parse(ds.Tables[0].Rows[0]["input_lun_utilization"].ToString());
                    }
                    txtLunUtilization.Text = dblA21.ToString();
                    if (ds.Tables[0].Rows[0]["input_vms_per_lun"].ToString() != "")
                    {
                        dblA22 = double.Parse(ds.Tables[0].Rows[0]["input_vms_per_lun"].ToString());
                    }
                    txtVMsPerLun.Text = dblA22.ToString();
                    if (ds.Tables[0].Rows[0]["input_time_lun"].ToString() != "")
                    {
                        dblA25 = double.Parse(ds.Tables[0].Rows[0]["input_time_lun"].ToString());
                    }
                    txtTimeLUN.Text = dblA25.ToString();
                    if (ds.Tables[0].Rows[0]["input_time_cluster"].ToString() != "")
                    {
                        dblA26 = double.Parse(ds.Tables[0].Rows[0]["input_time_cluster"].ToString());
                    }
                    txtTimeCluster.Text = dblA26.ToString();
                    if (ds.Tables[0].Rows[0]["input_max_vms_server"].ToString() != "")
                    {
                        dblA29 = double.Parse(ds.Tables[0].Rows[0]["input_max_vms_server"].ToString());
                    }
                    txtMaxVMsServer.Text = dblA29.ToString();
                    if (ds.Tables[0].Rows[0]["input_max_vms_lun"].ToString() != "")
                    {
                        dblA30 = double.Parse(ds.Tables[0].Rows[0]["input_max_vms_lun"].ToString());
                    }
                    txtMaxVMsLUN.Text = dblA30.ToString();
                    double  dblA13  = 0.00;
                    double  dblA14  = 0.00;
                    double  dblA15  = 0.00;
                    double  dblA16  = 0.00;
                    DataSet dsModel = oModelsProperties.Get(intModel);
                    if (dsModel.Tables[0].Rows.Count > 0)
                    {
                        lblModel.Text = dsModel.Tables[0].Rows[0]["name"].ToString();
                        dblA13        = double.Parse(dsModel.Tables[0].Rows[0]["ram"].ToString());
                        dblA14        = double.Parse(dsModel.Tables[0].Rows[0]["cpu_count"].ToString());
                        dblA15        = 1.00;
                        dblA16        = double.Parse(dsModel.Tables[0].Rows[0]["cpu_speed"].ToString());
                    }
                    txtRAM.Text   = dblA13.ToString();
                    txtCores.Text = dblA14.ToString();
                    txtCPUs.Text  = dblA15.ToString();
                    txtProcs.Text = dblA16.ToString();
                    double dblA17 = dblA14 * dblA15 * dblA16;   // =A14*A15*A16
                    txtTotal.Text = dblA17.ToString();

                    double dblA2 = 0.00;
                    if (Request.QueryString["query"] != null)
                    {
                        trCapacity.Visible = true;
                        chkQuery.Checked   = true;
                        // Get # of hosts from cluster
                        int    intVirtualCenter = Int32.Parse(oVMWare.GetDatacenter(intDatacenter, "virtualcenterid"));
                        string strVirtualCenter = oVMWare.GetVirtualCenter(intVirtualCenter, "name");
                        string strConnect       = oVMWare.ConnectDEBUG(oVMWare.GetVirtualCenter(intVirtualCenter, "url"), Int32.Parse(oVMWare.GetVirtualCenter(intVirtualCenter, "environment")), oVMWare.GetDatacenter(intDatacenter, "name"));
                        if (strConnect == "")
                        {
                            VimService               _service = oVMWare.GetService();
                            ServiceContent           _sic     = oVMWare.GetSic();
                            ManagedObjectReference[] hostRefs = oVMWare.GetHosts(txtName.Text);
                            dblA2 = double.Parse(hostRefs.Length.ToString());
                            if (_service != null)
                            {
                                _service.Abort();
                                if (_service.Container != null)
                                {
                                    _service.Container.Dispose();
                                }
                                try
                                {
                                    _service.Logout(_sic.sessionManager);
                                }
                                catch { }
                                _service.Dispose();
                                _service = null;
                                _sic     = null;
                            }
                        }
                        else
                        {
                            dblA2 = -1.00;
                        }
                    }
                    else
                    {
                        dblA2 = -1.00;
                    }
                    txtServers.Text = dblA2.ToString();
                    // Maximum CPU allocated
                    double dblA9 = dblA13 * dblA8;
                    dblA9          = dblA17 / dblA9;
                    txtMaxCPU.Text = dblA9.ToString();          // =A17/A13*A8
                    // Total CPU & RAM
                    double dblD2 = dblA2 * dblA17;
                    txtTotalCPU.Text = dblD2.ToString();        // =A2*A17
                    double dblD3 = dblA2 * dblA13;
                    txtTotalRAM.Text = dblD3.ToString();        // =A2*A13
                    // Reserves
                    double dblD7 = dblA29 * dblA26 * dblA9;
                    txtReserveCPU.Text = dblD7.ToString();      // =A29*A26*A9
                    double dblD8 = dblA29 * dblA26 * dblA8;
                    txtReserveRAM.Text = dblD8.ToString();      // =A29*A26*A8
                    double dblD9 = dblA10 + dblA8;
                    dblD9 = dblA30 * dblA25 * dblD9;
                    txtReserveDisk.Text = dblD9.ToString();     // =A30*A25*(A10+A8)
                    // Expansion
                    double dblD12 = dblA3 * 17.00;
                    dblD12            = dblD2 - dblD7 - dblD12;
                    dblD12            = dblD12 / dblD2;
                    dblD12            = dblD12 * dblA4;
                    dblD12            = Math.Floor(dblD12);
                    txtExpandCPU.Text = dblD12.ToString();      // =INT((D2-D7-(A3*17))/D2*A4)
                    double dblD13 = dblA3 * 13.00;
                    dblD13            = dblD3 - dblD8 - dblD13;
                    dblD13            = dblD13 / dblD3;
                    dblD13            = dblD13 * dblA5;
                    dblD13            = Math.Floor(dblD13);
                    txtExpandRAM.Text = dblD13.ToString();      // =INT((D3-D8-(A3*13))/D3*A5)
                    double dblD14 = dblA20 * dblA21;
                    dblD14             = dblD14 / 100.00;
                    dblD14             = dblD14 - dblD9;
                    dblD14             = dblD14 / dblA20;
                    dblD14             = dblD14 * 100.00;
                    dblD14             = Math.Floor(dblD14);
                    txtExpandDisk.Text = dblD14.ToString();      // =INT(((A20*A21/100)-D9)/A20*100)


                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
                    btnModel.Attributes.Add("onclick", "return OpenWindow('SUBMODELBROWSER','" + hdnModel.ClientID + "','&control=" + hdnModel.ClientID + "&controltext=" + lblModel.ClientID + "',false,400,600);");
                    btnOS.Attributes.Add("onclick", "return OpenWindow('VMWARE_OS','','" + intID.ToString() + "',false,'650',500);");
                }
                else if (intID == 0)
                {
                    trCapacity.Visible = true;
                    chkQuery.Checked   = true;
                    chkQuery.Enabled   = false;
                    btnOS.Enabled      = false;
                }
            }
            else if (Request.QueryString["folderid"] != null)
            {
                int intFolder     = Int32.Parse(Request.QueryString["folderid"]);
                int intDatacenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid"));
                LoadFolders(intDatacenter);
                ddlParent.SelectedValue = intFolder.ToString();
                panAdd.Visible          = true;

                trCapacity.Visible = false;
                chkQuery.Checked   = true;
                chkQuery.Enabled   = false;
                btnOS.Enabled      = false;
            }
            else
            {
                LoadVirtualCenters();
            }
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = Request.Path;
            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");
            }
            oResiliency = new Resiliency(intProfile, dsn);
            oLocation   = new Locations(intProfile, dsn);
            if (!IsPostBack)
            {
                LoadLists();
            }
            if (Request.QueryString["id"] == null)
            {
                if (Request.QueryString["add"] == null)
                {
                    LoopRepeater();
                }
                else
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                    txtMin.Text       = "0";
                    txtMax.Text       = "0";
                }
            }
            else
            {
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (intID > 0 && !IsPostBack)
                {
                    DataSet ds = oResiliency.Get(intID);
                    hdnId.Value        = intID.ToString();
                    txtName.Text       = ds.Tables[0].Rows[0]["name"].ToString();
                    chkBIR.Checked     = (ds.Tables[0].Rows[0]["bir"].ToString() == "1");
                    txtMin.Text        = ds.Tables[0].Rows[0]["min"].ToString();
                    txtMax.Text        = ds.Tables[0].Rows[0]["max"].ToString();
                    chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    btnAdd.Text        = "Update";

                    rptItems.DataSource = oResiliency.GetLocations(intID);
                    rptItems.DataBind();
                    lblNone.Visible = (rptItems.Items.Count == 0);
                    foreach (RepeaterItem ri in rptItems.Items)
                    {
                        ((LinkButton)ri.FindControl("btnDeleteLocation")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
                    }

                    strLocationProd       = oLocation.LoadDDL("ddlStateFinal", "ddlCityFinal", "ddlAddressFinal", hdnLocationProd.ClientID, intLocation, true, "ddlCommonFinal");
                    hdnLocationProd.Value = intLocation.ToString();
                    strLocationDR         = oLocation.LoadDDL("ddlStateBuild", "ddlCityBuild", "ddlAddressBuild", hdnLocationDR.ClientID, intLocation, true, "ddlCommonBuild");
                    hdnLocationDR.Value   = intLocation.ToString();
                }
            }
            // Modify "/admin/frame/frame_support_order.aspx" with the "&type=xxx" value.
            btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=RESILIENCY" + "',false,400,400);");
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            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);
            }

            oPage             = new Pages(intProfile, dsn);
            oVMWare           = new VMWare(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);

            if (!IsPostBack)
            {
                if (String.IsNullOrEmpty(Request.QueryString["v"]) == false)
                {
                    int     v   = Int32.Parse(Request.QueryString["v"]);
                    DataSet rec = oVMWare.GetVlan(v);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblVParent.ToolTip  = rec.Tables[0].Rows[0]["clusterid"].ToString();
                        lblVParent.Text     = oVMWare.GetCluster(Int32.Parse(lblVParent.ToolTip), "name");
                        txtVName.Text       = rec.Tables[0].Rows[0]["name"].ToString();
                        chkVEnabled.Checked = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnUpdateV.Text     = "Update";
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["c"]) == false)
                    {
                        lblVParent.ToolTip = Request.QueryString["c"];
                        lblVParent.Text    = oVMWare.GetCluster(Int32.Parse(lblVParent.ToolTip), "name");
                    }
                    panVLAN.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["ds"]) == false)
                {
                    ddlOperatingSystemGroup.DataTextField  = "name";
                    ddlOperatingSystemGroup.DataValueField = "id";
                    ddlOperatingSystemGroup.DataSource     = oOperatingSystems.GetGroups(1);
                    ddlOperatingSystemGroup.DataBind();
                    ddlOperatingSystemGroup.Items.Insert(0, new ListItem("-- ALL OS's --", "0"));

                    ddlPartner.DataTextField  = "name";
                    ddlPartner.DataValueField = "id";

                    int c = 0;
                    if (String.IsNullOrEmpty(Request.QueryString["c"]) == false)
                    {
                        Int32.TryParse(Request.QueryString["c"], out c);
                        ddlPartner.DataSource = oVMWare.GetDatastores(c, 1);
                        ddlPartner.DataBind();
                        ddlPartner.Items.Insert(0, new ListItem("-- NONE --", "0"));
                    }

                    int     ds  = Int32.Parse(Request.QueryString["ds"]);
                    DataSet rec = oVMWare.GetDatastore(ds);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        c = Int32.Parse(rec.Tables[0].Rows[0]["clusterid"].ToString());
                        ddlPartner.DataSource = oVMWare.GetDatastores(c, 1);
                        ddlPartner.DataBind();
                        ddlPartner.Items.Insert(0, new ListItem("-- NONE --", "0"));

                        txtDSName.Text        = rec.Tables[0].Rows[0]["name"].ToString();
                        ddlType.SelectedValue = rec.Tables[0].Rows[0]["storage_type"].ToString();
                        ddlOperatingSystemGroup.SelectedValue = rec.Tables[0].Rows[0]["osgroupid"].ToString();
                        chkReplicated.Checked         = (rec.Tables[0].Rows[0]["replicated"].ToString() == "1");
                        txtDSMaximum.Text             = rec.Tables[0].Rows[0]["maximum"].ToString();
                        chkServer.Checked             = (rec.Tables[0].Rows[0]["server"].ToString() == "1");
                        chkPagefile.Checked           = (rec.Tables[0].Rows[0]["pagefile"].ToString() == "1");
                        chkOverridePermission.Checked = (rec.Tables[0].Rows[0]["override_permission"].ToString() == "1");
                        ddlPartner.SelectedValue      = rec.Tables[0].Rows[0]["partner"].ToString();
                        chkDSEnabled.Checked          = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnUpdateDS.Text = "Update";
                    }

                    lblDSParent.ToolTip  = c.ToString();
                    lblDSParent.Text     = oVMWare.GetCluster(c, "name");
                    panDatastore.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["h"]) == false)
                {
                    int     h   = Int32.Parse(Request.QueryString["h"]);
                    DataSet rec = oVMWare.GetHost(h);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblHParent.ToolTip  = rec.Tables[0].Rows[0]["clusterid"].ToString();
                        lblHParent.Text     = oVMWare.GetCluster(Int32.Parse(lblHParent.ToolTip), "name");
                        txtHName.Text       = rec.Tables[0].Rows[0]["name"].ToString();
                        txtHMaximum.Text    = rec.Tables[0].Rows[0]["maximum"].ToString();
                        chkHEnabled.Checked = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnUpdateH.Text     = "Update";
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["c"]) == false)
                    {
                        lblHParent.ToolTip = Request.QueryString["c"];
                        lblHParent.Text    = oVMWare.GetCluster(Int32.Parse(lblHParent.ToolTip), "name");
                    }
                    panHost.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["c"]) == false)
                {
                    ddlResiliency.DataTextField  = "name";
                    ddlResiliency.DataValueField = "id";
                    ddlResiliency.DataSource     = oResiliency.Gets(1);
                    ddlResiliency.DataBind();

                    int     c   = Int32.Parse(Request.QueryString["c"]);
                    DataSet rec = oVMWare.GetCluster(c);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblCParent.ToolTip            = rec.Tables[0].Rows[0]["folderid"].ToString();
                        lblCParent.Text               = oVMWare.GetFolder(Int32.Parse(lblCParent.ToolTip), "name");
                        txtCName.Text                 = rec.Tables[0].Rows[0]["name"].ToString();
                        ddlVersion.SelectedValue      = rec.Tables[0].Rows[0]["version"].ToString();
                        ddlAntiAffinity.SelectedValue = rec.Tables[0].Rows[0]["anti_affinity"].ToString();
                        txtCMaximum.Text              = rec.Tables[0].Rows[0]["maximum"].ToString();
                        txtResourcePool.Text          = rec.Tables[0].Rows[0]["resource_pool"].ToString();
                        txtDatastoreNotify.Text       = rec.Tables[0].Rows[0]["datastores_notify"].ToString();
                        txtDatastoreLeft.Text         = rec.Tables[0].Rows[0]["datastores_left"].ToString();
                        txtDatastoreSize.Text         = rec.Tables[0].Rows[0]["datastores_size"].ToString();
                        chkFull.Checked               = (rec.Tables[0].Rows[0]["at_max"].ToString() == "1");
                        chkAPoff.Checked              = (rec.Tables[0].Rows[0]["auto_provision_off"].ToString() == "1");
                        chkAPoffDR.Checked            = (rec.Tables[0].Rows[0]["auto_provision_dr_off"].ToString() == "1");
                        chkDell.Checked               = (rec.Tables[0].Rows[0]["dell"].ToString() == "1");
                        ddlResiliency.SelectedValue   = rec.Tables[0].Rows[0]["resiliencyid"].ToString();
                        chkOracle.Checked             = (rec.Tables[0].Rows[0]["can_oracle"].ToString() == "1");
                        chkOracleCluster.Checked      = (rec.Tables[0].Rows[0]["can_oracle_cluster"].ToString() == "1");
                        chkSQL.Checked                = (rec.Tables[0].Rows[0]["can_sql"].ToString() == "1");
                        chkSQLCluster.Checked         = (rec.Tables[0].Rows[0]["can_sql_cluster"].ToString() == "1");
                        chkCluster.Checked            = (rec.Tables[0].Rows[0]["can_cluster"].ToString() == "1");
                        chkCEnabled.Checked           = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");

                        txtFailures.Text       = rec.Tables[0].Rows[0]["input_failures"].ToString();
                        txtCPUUtilization.Text = rec.Tables[0].Rows[0]["input_cpu_utilization"].ToString();
                        txtRAMUtilization.Text = rec.Tables[0].Rows[0]["input_ram_utilization"].ToString();
                        txtMaxRAM.Text         = rec.Tables[0].Rows[0]["input_max_ram"].ToString();
                        txtAvgUtilization.Text = rec.Tables[0].Rows[0]["input_avg_utilization"].ToString();
                        txtLunSize.Text        = rec.Tables[0].Rows[0]["input_lun_size"].ToString();
                        txtLunUtilization.Text = rec.Tables[0].Rows[0]["input_lun_utilization"].ToString();
                        txtVMsPerLun.Text      = rec.Tables[0].Rows[0]["input_vms_per_lun"].ToString();
                        txtTimeLUN.Text        = rec.Tables[0].Rows[0]["input_time_lun"].ToString();
                        txtTimeCluster.Text    = rec.Tables[0].Rows[0]["input_time_cluster"].ToString();
                        txtMaxVMsServer.Text   = rec.Tables[0].Rows[0]["input_max_vms_server"].ToString();
                        txtMaxVMsLUN.Text      = rec.Tables[0].Rows[0]["input_max_vms_lun"].ToString();

                        btnUpdateC.Text = "Update";

                        rptHosts.DataSource = oVMWare.GetHosts(c, 0);
                        rptHosts.DataBind();
                        rptDatastores.DataSource = oVMWare.GetDatastores(c, 0);
                        rptDatastores.DataBind();
                        rptVLANs.DataSource = oVMWare.GetVlans(c, 0);
                        rptVLANs.DataBind();

                        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("Hosts", "");
                        oTab.AddTab("Datastores", "");
                        oTab.AddTab("VLANs", "");
                        strMenuTab1 = oTab.GetTabs();
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["f"]) == false)
                    {
                        lblCParent.ToolTip = Request.QueryString["f"];
                        lblCParent.Text    = oVMWare.GetFolder(Int32.Parse(lblCParent.ToolTip), "name");
                    }
                    panCluster.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["f"]) == false)
                {
                    int     f   = Int32.Parse(Request.QueryString["f"]);
                    DataSet rec = oVMWare.GetFolder(f);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblFParent.ToolTip    = rec.Tables[0].Rows[0]["datacenterid"].ToString();
                        lblFParent.Text       = oVMWare.GetDatacenter(Int32.Parse(lblFParent.ToolTip), "name");
                        txtFName.Text         = rec.Tables[0].Rows[0]["name"].ToString();
                        txtFNotification.Text = rec.Tables[0].Rows[0]["notification"].ToString();
                        chkFEnabled.Checked   = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnUpdateF.Text       = "Update";

                        rptClusters.DataSource = oVMWare.GetClusters(f, 0);
                        rptClusters.DataBind();
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["dc"]) == false)
                    {
                        lblFParent.ToolTip = Request.QueryString["dc"];
                        lblFParent.Text    = oVMWare.GetDatacenter(Int32.Parse(lblFParent.ToolTip), "name");
                    }
                    panFolder.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["dc"]) == false)
                {
                    ddlDCParent.DataTextField  = "name";
                    ddlDCParent.DataValueField = "id";
                    ddlDCParent.DataSource     = oVMWare.GetVirtualCenters(1);
                    ddlDCParent.DataBind();

                    int     dc  = Int32.Parse(Request.QueryString["dc"]);
                    DataSet rec = oVMWare.GetDatacenter(dc);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        ddlDCParent.SelectedValue      = rec.Tables[0].Rows[0]["virtualcenterid"].ToString();
                        txtDCName.Text                 = rec.Tables[0].Rows[0]["name"].ToString();
                        txtDCBuildFolder.Text          = rec.Tables[0].Rows[0]["build_folder"].ToString();
                        txtDCDesktopNetwork.Text       = rec.Tables[0].Rows[0]["desktop_network"].ToString();
                        txtDCWorkstationDecomVLAN.Text = rec.Tables[0].Rows[0]["workstation_decom_vlan"].ToString();
                        chkDCEnabled.Checked           = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnUpdateDC.Text               = "Update";

                        rptFolders.DataSource = oVMWare.GetFolders(dc, 0);
                        rptFolders.DataBind();
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["vc"]) == false)
                    {
                        ddlDCParent.SelectedValue = Request.QueryString["vc"];
                    }
                    panDC.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["vc"]) == false)
                {
                    int     vc  = Int32.Parse(Request.QueryString["vc"]);
                    DataSet rec = oVMWare.GetVirtualCenter(vc);
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        txtName.Text = rec.Tables[0].Rows[0]["name"].ToString();
                        txtUrl.Text  = rec.Tables[0].Rows[0]["url"].ToString();
                        ddlEnvironment.SelectedValue = rec.Tables[0].Rows[0]["environment"].ToString();
                        chkEnabled.Checked           = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnUpdateVC.Text             = "Update";

                        rptDCs.DataSource = oVMWare.GetDatacenters(vc, 0);
                        rptDCs.DataBind();
                    }
                    panVC.Visible = true;
                }
                else
                {
                    panVCs.Visible    = true;
                    rptVCs.DataSource = oVMWare.GetVirtualCenters(0);
                    rptVCs.DataBind();
                }
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset            = new Asset(0, dsnAsset);
            oIPAddresses      = new IPAddresses(0, dsnIP, dsn);
            oModel            = new Models(0, dsn);
            oModelsProperties = new ModelsProperties(0, dsn);
            oSolaris          = new Solaris(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID = Int32.Parse(Request.QueryString["id"]);
            }
            if (Request.QueryString["save"] != null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Asset Deployed Successfully!');window.close();<" + "/" + "script>");
            }
            if (!IsPostBack)
            {
                DataSet ds = oAsset.Get(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblTracking.Text = ds.Tables[0].Rows[0]["tracking"].ToString();
                    lblSerial.Text   = ds.Tables[0].Rows[0]["serial"].ToString();
                    int intModel  = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                    int intParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    ddlModels.DataTextField  = "name";
                    ddlModels.DataValueField = "id";
                    ddlModels.DataSource     = oModelsProperties.GetModels(1, intParent, 1);
                    ddlModels.DataBind();
                    ddlModels.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                    ddlModels.SelectedValue = intModel.ToString();
                    //lblModel.Text = ds.Tables[0].Rows[0]["modelname"].ToString();
                    lblAsset.Text = ds.Tables[0].Rows[0]["asset"].ToString();
                    lblHBA.Text   = "&nbsp;(Currently = " + oAsset.GetHBA(intID).Tables[0].Rows.Count.ToString() + ")";

                    if (oModelsProperties.IsTypeBlade(intModel) == true)
                    {
                        panBlade.Visible            = true;
                        ddlEnclosure.DataValueField = "id";
                        ddlEnclosure.DataTextField  = "name";
                        ddlEnclosure.DataSource     = oAsset.GetEnclosures((int)AssetStatus.InUse);
                        ddlEnclosure.DataBind();
                        ddlEnclosure.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        btnSubmit.Attributes.Add("onclick", "return ValidateDropDown('" + ddlStatus.ClientID + "','Please select a status')" +
                                                 " && ValidateDropDown('" + ddlModels.ClientID + "','Please select a model')" +
                                                 " && ValidateDropDown('" + ddlEnclosure.ClientID + "','Please select an enclosure')" +
                                                 " && ValidateNumber0('" + txtSlot.ClientID + "','Please enter a valid slot number')" +
                                                 " && ValidateRadioButtons('" + radSpareYes.ClientID + "','" + radSpareNo.ClientID + "','Please select whether or not this blade is a spare')" +
                                                 " && ValidateText('" + txtILO.ClientID + "','Please enter an ILO address')" +
                                                 " && ValidateText('" + txtDummy.ClientID + "','Please enter a dummy name')" +
                                                 " && ValidateText('" + txtMAC.ClientID + "','Please enter a mac address')" +
                                                 " && ValidateNumber0('" + txtVLAN.ClientID + "','Please enter a valid original VLAN')" +
                                                 ";");
                    }
                    else
                    {
                        panServer.Visible = true;
                        LoadLists();
                        ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
                        ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                        btnSubmit.Attributes.Add("onclick", "return ValidateDropDown('" + ddlStatus.ClientID + "','Please select a status')" +
                                                 " && ValidateDropDown('" + ddlModels.ClientID + "','Please select a model')" +
                                                 " && ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                                                 " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please select an environment')" +
                                                 " && ValidateHidden0('" + hdnRackId.ClientID + "','" + btnChangeLocation.ClientID + "','Please select a location details')" +
                                                 " && ValidateHidden0('" + hdnRackPosition.ClientID + "','" + btnChangeLocation.ClientID + "','Please enter a rack position')" +
                                                 " && ValidateText('" + txtILO.ClientID + "','Please enter an ILO address')" +
                                                 " && ValidateText('" + txtDummy.ClientID + "','Please enter a dummy name')" +
                                                 " && ValidateText('" + txtMAC.ClientID + "','Please enter a mac address')" +
                                                 " && ValidateNumber0('" + txtVLAN.ClientID + "','Please enter a valid original VLAN')" +
                                                 ";");
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return parent.HidePanel();");
            btnHBAs.Attributes.Add("onclick", "return OpenWindow('ASSET_DEPLOY_HBAs','" + Request.QueryString["id"] + "');");
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/sve_clusters.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");
            }
            oSolaris     = new Solaris(intProfile, dsn);
            oClass       = new Classes(intProfile, dsn);
            oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
            oServer      = new Servers(intProfile, dsn);
            oLocation    = new Locations(intProfile, dsn);
            oResiliency  = new Resiliency(intProfile, dsn);
            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                if (Request.QueryString["add"] == null)
                {
                    LoopRepeater();
                }
                else
                {
                    panAdd.Visible = true;
                }
            }
            else
            {
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (intID > 0)
                {
                    if (!IsPostBack)
                    {
                        DataSet ds = oSolaris.GetSVECluster(intID);
                        txtName.Text        = ds.Tables[0].Rows[0]["name"].ToString();
                        chkDatabase.Checked = (ds.Tables[0].Rows[0]["db"].ToString() == "1");
                        int intClass = 0;
                        if (Int32.TryParse(ds.Tables[0].Rows[0]["classid"].ToString(), out intClass) == true)
                        {
                            ddlClass.SelectedValue = intClass.ToString();
                        }
                        ddlResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                        chkAvailable.Checked        = (ds.Tables[0].Rows[0]["available"].ToString() == "1");
                        chkNetworks.Checked         = (ds.Tables[0].Rows[0]["networks"].ToString() == "1");
                        txtComments.Text            = ds.Tables[0].Rows[0]["comments"].ToString();
                        chkStorage.Checked          = (ds.Tables[0].Rows[0]["storage_allocated"].ToString() == "1");
                        chkTrunking.Checked         = (ds.Tables[0].Rows[0]["trunking"].ToString() == "1");
                        chkEnabled.Checked          = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text = "Update";

                        // Load Networks
                        if (chkNetworks.Checked == false)
                        {
                            strNetworks = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY NETWORK RANGES(S)</i> flag is checked</b></p>";
                        }
                        else
                        {
                            LoadClasses(oTreeNetworks, intClass);
                            oTreeNetworks.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                        }
                        LoadLocations();
                        // Load Hosts
                        rptHosts.DataSource = oServer.GetSVEClusters(intID);
                        rptHosts.DataBind();
                    }
                }
                else
                {
                    btnDelete.Enabled = false;
                }
            }

            if (panAdd.Visible == true)
            {
                int intMenuTab = 0;
                if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                {
                    intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                }
                Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);
                oTab.AddTab("Details", "");
                oTab.AddTab("Network Ranges", "");
                oTab.AddTab("Locations", "");
                oTab.AddTab("Current Hosts", "");
                strMenuTab1 = oTab.GetTabs();
            }

            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            strLocation = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, 0, true, "ddlCommon");
        }
Exemplo n.º 9
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);
            oServer = new Servers(intProfile, dsn);
            oAvamar = new Avamar(intProfile, dsn);
            oLocation = new Locations(intProfile, dsn);
            oClass = new Classes(intProfile, dsn);
            oResiliency = new Resiliency(intProfile, dsn);
            oOperatingSystem = new OperatingSystems(intProfile, dsn);
            oServerName = new ServerName(intProfile, dsn);
            oFunctions = new Functions(intProfile, dsn, 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["saved"] != null)
                lblMessage.Text = oFunctions.BuildBox("/images/ico_check.gif", "Information Saved", "Your change has been saved successfully!", "box_green header");
            if (Request.QueryString["deleted"] != null)
                lblMessage.Text = oFunctions.BuildBox("/images/ico_check.gif", "Record Deleted", "The record has been deleted successfully!", "box_green header");
            int intMenuTab = 0;
            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            int intAddressID = 0;
            if (Request.QueryString["grid"] != null && Request.QueryString["grid"] != "")
            {
                intGrid = Int32.Parse(Request.QueryString["grid"]);
                lblCrumbs.Text += "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("") + "\">Back to Home</a>";
                if (Request.QueryString["domain"] != null && Request.QueryString["domain"] != "")
                {
                    intDomain = Int32.Parse(Request.QueryString["domain"]);
                    lblCrumbs.Text += strSpacer + "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("grid=" + intGrid.ToString()) + "\">" + oAvamar.GetGrid(intGrid, "name") + "</a>";
                    panDomain.Visible = true;
                    if (!IsPostBack)
                    {
                        chkDomainResiliency.DataValueField = "id";
                        chkDomainResiliency.DataTextField = "name";
                        chkDomainResiliency.DataSource = oResiliency.Gets(1);
                        chkDomainResiliency.DataBind();

                        chkDomainApplication.DataValueField = "id";
                        chkDomainApplication.DataTextField = "name";
                        chkDomainApplication.DataSource = oServerName.GetComponents(1);
                        chkDomainApplication.DataBind();

                        ddlDomainParent.DataValueField = "id";
                        ddlDomainParent.DataTextField = "FQDN";
                        ddlDomainParent.DataSource = oAvamar.GetDomainsGrid(intGrid, 0, 1);
                        ddlDomainParent.DataBind();
                        

                        DataSet ds = oAvamar.GetDomain(intDomain);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            txtDomainName.Text = ds.Tables[0].Rows[0]["name"].ToString();
                            if (ds.Tables[0].Rows[0]["root"].ToString() == "1")
                            {
                                txtDomainName.Enabled = false;
                                txtDomainName.Text = "/ (ROOT)";
                                ddlDomainParent.Enabled = false;
                                btnDomainUpdate.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                            }
                            else
                            {
                                foreach (ListItem domain in ddlDomainParent.Items)
                                {
                                    if (domain.Value == ds.Tables[0].Rows[0]["id"].ToString())
                                    {
                                        ddlDomainParent.Items.Remove(domain);
                                        break;
                                    }
                                }
                                btnDomainUpdate.Attributes.Add("onclick", "return ValidateText('" + txtDomainName.ClientID + "','Please enter a name for this domain')" +
                                " && ProcessButton(this) && LoadWait()" +
                                    ";");
                            }
                            lblCrumbs.Text += strSpacer + txtDomainName.Text;
                            ddlDomainParent.SelectedValue = ds.Tables[0].Rows[0]["domainid"].ToString();
                            chkDomainCatchAll.Checked = (ds.Tables[0].Rows[0]["catchall"].ToString() == "1");
                            chkDomainEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnDomainUpdate.Visible = true;
                            btnDomainDelete.Visible = true;
                            btnDomainDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this domain')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");

                            // Resiliencies
                            DataSet dsResiliencies = oAvamar.GetDomainResiliencys(intDomain);
                            foreach (DataRow drResiliency in dsResiliencies.Tables[0].Rows)
                            {
                                foreach (ListItem item in chkDomainResiliency.Items)
                                {
                                    if (drResiliency["resiliencyid"].ToString() == item.Value)
                                    {
                                        item.Selected = true;
                                        break;
                                    }
                                }
                            }
                            // Applications
                            DataSet dsApplications = oAvamar.GetDomainApplications(intDomain);
                            foreach (DataRow drApplication in dsApplications.Tables[0].Rows)
                            {
                                foreach (ListItem item in chkDomainApplication.Items)
                                {
                                    if (drApplication["applicationid"].ToString() == item.Value)
                                    {
                                        item.Selected = true;
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            btnDomainAdd.Visible = true;
                            btnDomainAdd.Attributes.Add("onclick", "return ValidateText('" + txtDomainName.ClientID + "','Please enter a name for this domain')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        btnDomainCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                    }
                }
                else if (String.IsNullOrEmpty(Request.QueryString["group"]) == false)
                {
                    intGroup = Int32.Parse(Request.QueryString["group"]);
                    lblCrumbs.Text += strSpacer + "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("grid=" + intGrid.ToString()) + "\">" + oAvamar.GetGrid(intGrid, "name") + "</a>";
                    panGroup.Visible = true;
                    if (!IsPostBack)
                    {
                        ddlGroupDomain.DataValueField = "id";
                        ddlGroupDomain.DataTextField = "FQDN";
                        ddlGroupDomain.DataSource = oAvamar.GetDomainsGrid(intGrid, 1, 1);
                        ddlGroupDomain.DataBind();

                        chkGroupOS.DataValueField = "id";
                        chkGroupOS.DataTextField = "name";
                        chkGroupOS.DataSource = oOperatingSystem.GetStandard(0);
                        chkGroupOS.DataBind();

                        DataSet ds = oAvamar.GetGroup(intGroup);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            txtGroupName.Text = ds.Tables[0].Rows[0]["name"].ToString();
                            lblCrumbs.Text += strSpacer + txtGroupName.Text;
                            chkGroupDaily.Checked = (ds.Tables[0].Rows[0]["daily"].ToString() == "1");
                            chkGroupWeekly.Checked = (ds.Tables[0].Rows[0]["weekly"].ToString() == "1");
                            if (chkGroupWeekly.Checked == true)
                                divGroupWeekly.Style["display"] = "inline";
                            chkGroupWeeklySunday.Checked = (ds.Tables[0].Rows[0]["sunday"].ToString() == "1");
                            chkGroupWeeklyMonday.Checked = (ds.Tables[0].Rows[0]["monday"].ToString() == "1");
                            chkGroupWeeklyTuesday.Checked = (ds.Tables[0].Rows[0]["tuesday"].ToString() == "1");
                            chkGroupWeeklyWednesday.Checked = (ds.Tables[0].Rows[0]["wednesday"].ToString() == "1");
                            chkGroupWeeklyThursday.Checked = (ds.Tables[0].Rows[0]["thursday"].ToString() == "1");
                            chkGroupWeeklyFriday.Checked = (ds.Tables[0].Rows[0]["friday"].ToString() == "1");
                            chkGroupWeeklySaturday.Checked = (ds.Tables[0].Rows[0]["saturday"].ToString() == "1");
                            chkGroupMonthly.Checked = (ds.Tables[0].Rows[0]["monthly"].ToString() == "1");
                            if (chkGroupMonthly.Checked == true)
                                divGroupMonthly.Style["display"] = "inline";
                            ddlGroupMonthly.SelectedValue = ds.Tables[0].Rows[0]["day"].ToString();
                            chk1200AM.Checked = (ds.Tables[0].Rows[0]["AM1200"].ToString() == "1");
                            chk100AM.Checked = (ds.Tables[0].Rows[0]["AM100"].ToString() == "1");
                            chk200AM.Checked = (ds.Tables[0].Rows[0]["AM200"].ToString() == "1");
                            chk300AM.Checked = (ds.Tables[0].Rows[0]["AM300"].ToString() == "1");
                            chk400AM.Checked = (ds.Tables[0].Rows[0]["AM400"].ToString() == "1");
                            chk500AM.Checked = (ds.Tables[0].Rows[0]["AM500"].ToString() == "1");
                            chk600AM.Checked = (ds.Tables[0].Rows[0]["AM600"].ToString() == "1");
                            chk700AM.Checked = (ds.Tables[0].Rows[0]["AM700"].ToString() == "1");
                            chk800AM.Checked = (ds.Tables[0].Rows[0]["AM800"].ToString() == "1");
                            chk900AM.Checked = (ds.Tables[0].Rows[0]["AM900"].ToString() == "1");
                            chk1000AM.Checked = (ds.Tables[0].Rows[0]["AM1000"].ToString() == "1");
                            chk1100AM.Checked = (ds.Tables[0].Rows[0]["AM1100"].ToString() == "1");
                            chk1200PM.Checked = (ds.Tables[0].Rows[0]["PM1200"].ToString() == "1");
                            chk100PM.Checked = (ds.Tables[0].Rows[0]["PM100"].ToString() == "1");
                            chk200PM.Checked = (ds.Tables[0].Rows[0]["PM200"].ToString() == "1");
                            chk300PM.Checked = (ds.Tables[0].Rows[0]["PM300"].ToString() == "1");
                            chk400PM.Checked = (ds.Tables[0].Rows[0]["PM400"].ToString() == "1");
                            chk500PM.Checked = (ds.Tables[0].Rows[0]["PM500"].ToString() == "1");
                            chk600PM.Checked = (ds.Tables[0].Rows[0]["PM600"].ToString() == "1");
                            chk700PM.Checked = (ds.Tables[0].Rows[0]["PM700"].ToString() == "1");
                            chk800PM.Checked = (ds.Tables[0].Rows[0]["PM800"].ToString() == "1");
                            chk900PM.Checked = (ds.Tables[0].Rows[0]["PM900"].ToString() == "1");
                            chk1000PM.Checked = (ds.Tables[0].Rows[0]["PM1000"].ToString() == "1");
                            chk1100PM.Checked = (ds.Tables[0].Rows[0]["PM1100"].ToString() == "1");
                            txtGroupThreshold.Text = ds.Tables[0].Rows[0]["threshold"].ToString();
                            txtGroupMaximum.Text = ds.Tables[0].Rows[0]["maximum"].ToString();
                            chkGroupClustering.Checked = (ds.Tables[0].Rows[0]["clustering"].ToString() == "1");
                            chkGroupEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnGroupUpdate.Visible = true;
                            btnGroupUpdate.Attributes.Add("onclick", "return ValidateText('" + txtGroupName.ClientID + "','Please enter a name for this group')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                            btnGroupDelete.Visible = true;
                            btnGroupDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this group')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");

                            // Operating Systems
                            DataSet dsOperatingSystems = oAvamar.GetGroupOperatingSystems(intGroup);
                            foreach (DataRow drOperatingSystem in dsOperatingSystems.Tables[0].Rows)
                            {
                                foreach (ListItem item in chkGroupOS.Items)
                                {
                                    if (drOperatingSystem["osid"].ToString() == item.Value)
                                    {
                                        item.Selected = true;
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            btnGroupAdd.Visible = true;
                            btnGroupAdd.Attributes.Add("onclick", "return ValidateText('" + txtGroupName.ClientID + "','Please enter a name for this group')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        btnGroupCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                        chkGroupDaily.Attributes.Add("onclick", "ShowHideDiv('" + divGroupWeekly.ClientID + "','none');ShowHideDiv('" + divGroupMonthly.ClientID + "','none');");
                        chkGroupWeekly.Attributes.Add("onclick", "ShowHideDiv('" + divGroupWeekly.ClientID + "','inline');ShowHideDiv('" + divGroupMonthly.ClientID + "','none');");
                        chkGroupMonthly.Attributes.Add("onclick", "ShowHideDiv('" + divGroupWeekly.ClientID + "','none');ShowHideDiv('" + divGroupMonthly.ClientID + "','inline');");
                    }
                }
                else if (String.IsNullOrEmpty(Request.QueryString["location"]) == false)
                {
                    intLocation = Int32.Parse(Request.QueryString["location"]);
                    lblCrumbs.Text += strSpacer + "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("grid=" + intGrid.ToString()) + "\">" + oAvamar.GetGrid(intGrid, "name") + "</a>";
                    panLocation.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds = oAvamar.GetLocation(intLocation);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            intAddressID = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString());
                            lblCrumbs.Text += strSpacer + oLocation.GetFull(intAddressID);
                            chkLocationEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnLocationUpdate.Visible = true;
                            btnLocationUpdate.Attributes.Add("onclick", "return ValidateHidden0('" + hdnLocation.ClientID + "','ddlCommonLocation','Please select a location')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                            btnLocationDelete.Visible = true;
                            btnLocationDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this location')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        else
                        {
                            btnLocationAdd.Visible = true;
                            btnLocationAdd.Attributes.Add("onclick", "return ValidateHidden0('" + hdnLocation.ClientID + "','ddlCommonLocation','Please select a location')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        btnLocationCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                        strLocation = oLocation.LoadDDL("ddlStateLocation", "ddlCityLocation", "ddlAddressLocation", hdnLocation.ClientID, intAddressID, true, "ddlCommonLocation");
                    }
                }
                else if (String.IsNullOrEmpty(Request.QueryString["environment"]) == false)
                {
                    intEnv = Int32.Parse(Request.QueryString["environment"]);
                    lblCrumbs.Text += strSpacer + "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("grid=" + intGrid.ToString()) + "\">" + oAvamar.GetGrid(intGrid, "name") + "</a>";
                    panEnvironment.Visible = true;
                    if (!IsPostBack)
                    {
                        ddlClass.DataTextField = "name";
                        ddlClass.DataValueField = "id";
                        ddlClass.DataSource = oClass.GetForecasts(1);
                        ddlClass.DataBind();
                        ddlClass.Items.Insert(0, new ListItem("-- SELECT --", "0"));

                        DataSet ds = oAvamar.GetEnvironment(intEnv);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int intClassID = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                            try
                            {
                                ddlClass.SelectedValue = intClassID.ToString();
                            }
                            catch { }
                            if (ddlClass.SelectedIndex == 0)
                            {
                                // Class is not available, add it.
                                ddlClass.Items.Add(new ListItem(oClass.Get(intClassID, "name") + " *", intClassID.ToString()));
                                ddlClass.SelectedValue = intClassID.ToString();
                            }
                            int intEnvironmentID = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString());
                            hdnEnvironment.Value = intEnvironmentID.ToString();
                            ddlEnvironment.DataTextField = "name";
                            ddlEnvironment.DataValueField = "id";
                            ddlEnvironment.DataSource = oClass.GetEnvironment(intClassID, 1);
                            ddlEnvironment.DataBind();
                            ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                            ddlEnvironment.Enabled = true;
                            ddlEnvironment.SelectedValue = intEnvironmentID.ToString();
                            chkEnvironmentEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnEnvironmentUpdate.Visible = true;
                            btnEnvironmentUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                            " && ValidateHidden0('" + hdnEnvironment.ClientID + "','" + ddlEnvironment.ClientID + "','Please select an environment')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                            btnEnvironmentDelete.Visible = true;
                            btnEnvironmentDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this location')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        else
                        {
                            btnEnvironmentAdd.Visible = true;
                            btnEnvironmentAdd.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                            " && ValidateHidden0('" + hdnEnvironment.ClientID + "','" + ddlEnvironment.ClientID + "','Please select an environment')" +
                            " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        btnEnvironmentCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                        ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',1);");
                        ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                    }
                }
                else
                {
                    panGrid.Visible = true;
                    if (!IsPostBack)
                    {
                        //Menus
                        oTab = new Tab(hdnType.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Domains", "");
                        DataSet dsDomains = oAvamar.GetDomainsGrid(intGrid, 0, 0);
                        DataView dvDomains = dsDomains.Tables[0].DefaultView;
                        if (Request.QueryString["sort"] != null)
                            dvDomains.Sort = Request.QueryString["sort"];
                        else
                            dvDomains.Sort = "name";
                        rptDomains.DataSource = dvDomains;
                        rptDomains.DataBind();
                        lblDomains.Visible = (rptDomains.Items.Count == 0);

                        oTab.AddTab("Groups", "");
                        DataSet dsGroups = oAvamar.GetGroupsGrid(intGrid, 0);
                        DataView dvGroups = dsGroups.Tables[0].DefaultView;
                        if (Request.QueryString["sort"] != null)
                            dvGroups.Sort = Request.QueryString["sort"];
                        else
                            dvGroups.Sort = "name";
                        rptGroups.DataSource = dvGroups;
                        rptGroups.DataBind();
                        lblGroups.Visible = (rptGroups.Items.Count == 0);

                        oTab.AddTab("Locations", "");
                        DataSet dsLocations = oAvamar.GetLocations(intGrid, 0);
                        DataView dvLocations = dsLocations.Tables[0].DefaultView;
                        if (Request.QueryString["sort"] != null)
                            dvLocations.Sort = Request.QueryString["sort"];
                        else
                            dvLocations.Sort = "addressid";
                        rptLocations.DataSource = dvLocations;
                        rptLocations.DataBind();
                        lblLocations.Visible = (rptLocations.Items.Count == 0);

                        oTab.AddTab("Environments", "");
                        DataSet dsEnvironments = oAvamar.GetEnvironments(intGrid, 0);
                        DataView dvEnvironments = dsEnvironments.Tables[0].DefaultView;
                        if (Request.QueryString["sort"] != null)
                            dvEnvironments.Sort = Request.QueryString["sort"];
                        else
                            dvEnvironments.Sort = "classid";
                        rptEnvironments.DataSource = dvEnvironments;
                        rptEnvironments.DataBind();
                        lblEnvironments.Visible = (rptEnvironments.Items.Count == 0);

                        strMenuTab1 = oTab.GetTabs();

                        DataSet ds = oAvamar.GetGrid(intGrid);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            txtGridName.Text = ds.Tables[0].Rows[0]["name"].ToString();
                            lblCrumbs.Text += strSpacer + txtGridName.Text;
                            txtGridThreshold.Text = ds.Tables[0].Rows[0]["threshold"].ToString();
                            txtGridMaximum.Text = ds.Tables[0].Rows[0]["maximum"].ToString();
                            chkGridEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnGridUpdate.Visible = true;
                            btnGridUpdate.Attributes.Add("onclick", "return ValidateText('" + txtGridName.ClientID + "','Please enter a name for this grid')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");
                            btnGridDelete.Visible = true;
                            btnGridDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this server')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");
                        }
                        else
                        {
                            btnGridAdd.Visible = true;
                            btnGridAdd.Attributes.Add("onclick", "return ValidateText('" + txtGridName.ClientID + "','Please enter a name for this grid')" +
                                " && ProcessButton(this) && LoadWait()" +
                                ";");
                            btnAddDomain.Enabled = false;
                            btnAddLocation.Enabled = false;
                            btnAddEnvironment.Enabled = false;
                            btnAddGroup.Enabled = false;
                        }
                        btnGridCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                        strLocation = oLocation.LoadDDL("ddlStateServer", "ddlCityServer", "ddlAddressServer", hdnLocation.ClientID, intAddressID, true, "ddlCommonServer");
                    }
                }
            }
            else
            {
                panGrids.Visible = true;
                DataSet dsGrids = oAvamar.GetGrids(0);
                DataView dvGrids = dsGrids.Tables[0].DefaultView;
                if (Request.QueryString["sort"] != null)
                    dvGrids.Sort = Request.QueryString["sort"];
                else
                    dvGrids.Sort = "name";
                rptGrids.DataSource = dvGrids;
                rptGrids.DataBind();
                lblGrids.Visible = (rptGrids.Items.Count == 0);
            }
            hdnLocation.Value = intAddressID.ToString();
            btnAddDomain.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnAddLocation.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnAddEnvironment.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnAddGroup.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnAddGrid.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();

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

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

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


                btnAddWWPortName.Attributes.Add("onclick", "return ValidateText('" + txtWWPortName.ClientID + "','Please enter a World Wide Port name') && ProcessControlButton()" +
                                                ";");
            }
            else
            {
                pnlAllow.Visible  = false;
                pnlDenied.Visible = true;
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);

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

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

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

                        if (!IsPostBack)
                        {
                            LoadList();

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

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

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

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

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

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

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

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

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

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

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

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

                            // WWW
                            rptWWW.DataSource = oAsset.GetHBA(intAsset);
                            rptWWW.DataBind();
                            lblWWW.Visible = (rptWWW.Items.Count == 0);
                            oDataPoint.LoadButton(btnWWW, intProfile, fldWWW, "PHYSICAL_WWW", "return OpenWindow('ASSET_DEPLOY_HBAs','" + intAsset.ToString() + "');");
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnDeploy.Attributes.Add("onclick", oDataPoint.LoadValidation());
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Reload();
            }
            oPlatform         = new Platforms(intProfile, dsn);
            oOrganization     = new Organizations(intProfile, dsn);
            oRequestItem      = new RequestItems(intProfile, dsn);
            oUserAt           = new Users_At(intProfile, dsn);
            oCost             = new Costs(intProfile, dsn);
            oService          = new Services(intProfile, dsn);
            oRequestField     = new RequestFields(intProfile, dsn);
            oReport           = new Reports(intProfile, dsn);
            oSites            = new Sites(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRacks            = new Racks(intProfile, dsn);
            oBanks            = new Banks(intProfile, dsn);
            oDepot            = new Depot(intProfile, dsn);
            oShelf            = new Shelf(intProfile, dsn);
            oClasses          = new Classes(intProfile, dsn);
            oRooms            = new Rooms(intProfile, dsn);
            oFloor            = new Floor(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oSolution         = new Solution(intProfile, dsn);
            oConfidence       = new Confidence(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oField            = new Field(intProfile, dsn);
            oServiceDetail    = new ServiceDetails(intProfile, dsn);
            oDomainController = new DomainController(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oHost             = new Host(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oRestart          = new Restart(intProfile, dsn);
            oSegment          = new Segment(intProfile, dsn);
            oServiceEditor    = new ServiceEditor(intProfile, dsnServiceEditor);
            oProjectRequest   = new ProjectRequest(intProfile, dsn);
            oVMWare           = new VMWare(intProfile, dsn);
            oWorkstation      = new Workstations(intProfile, dsn);
            //oNew = new New(intProfile, dsn);
            oWhatsNew          = new WhatsNew(intProfile, dsn);
            oMaintenanceWindow = new MaintenanceWindow(intProfile, dsn);
            //oRecoveryLocations = new RecoveryLocations(intProfile, dsn);
            oTSM         = new TSM(intProfile, dsn);
            oDNS         = new DNS(intProfile, dsn);
            oSolaris     = new Solaris(intProfile, dsn);
            oZeus        = new Zeus(intProfile, dsn);
            oError       = new Errors(intProfile, dsn);
            oDesign      = new Design(intProfile, dsn);
            oResiliency  = new Resiliency(intProfile, dsn);
            oEnhancement = new Enhancements(intProfile, dsn);

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

            if (Request.QueryString["control"] != null)
            {
                strControl = Request.QueryString["control"];
            }
            btnSave.Attributes.Add("onclick", "return Update('hdnUpdateOrder','" + strControl + "');");
            btnClose.Attributes.Add("onclick", "return HidePanel();");
            imgOrderUp.Attributes.Add("onclick", "return MoveOrderUp(" + lstOrder.ClientID + ");");
            imgOrderDown.Attributes.Add("onclick", "return MoveOrderDown(" + lstOrder.ClientID + ");");
            LoadList();
        }
Exemplo n.º 13
0
        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);
            oServer     = new Servers(intProfile, dsn);
            oTSM        = new TSM(intProfile, dsn);
            oMnemonic   = new Mnemonic(intProfile, dsn);
            oLocation   = new Locations(intProfile, dsn);
            oResiliency = new Resiliency(intProfile, dsn);
            oFunctions  = new Functions(intProfile, dsn, 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["saved"] != null)
            {
                lblMessage.Text = oFunctions.BuildBox("/images/ico_check.gif", "Information Saved", "Your change has been saved successfully!", "box_green header");
            }
            if (Request.QueryString["deleted"] != null)
            {
                lblMessage.Text = oFunctions.BuildBox("/images/ico_check.gif", "Record Deleted", "The record has been deleted successfully!", "box_green header");
            }
            if (Request.QueryString["server"] != null && Request.QueryString["server"] != "")
            {
                intServer       = Int32.Parse(Request.QueryString["server"]);
                lblCrumbs.Text += "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("") + "\">Back to Home</a>";
                if (Request.QueryString["mnemonic"] != null && Request.QueryString["mnemonic"] != "")
                {
                    panMnemonic.Visible = true;
                    Int32.TryParse(Request.QueryString["mnemonic"], out intMnemonic);
                    if (!IsPostBack)
                    {
                        DataSet ds = oTSM.GetMnemonic(intMnemonic);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int intMnemonicID = Int32.Parse(ds.Tables[0].Rows[0]["mnemonicid"].ToString());
                            hdnMnemonic.Value          = intMnemonicID.ToString();
                            txtMnemonic.Text           = oMnemonic.Get(intMnemonicID, "factory_code") + " - " + oMnemonic.Get(intMnemonicID, "name");
                            chkMnemonicEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnMnemonicUpdate.Visible  = true;
                            btnMnemonicUpdate.Attributes.Add("onclick", "return ValidateHidden0('" + hdnMnemonic.ClientID + "','" + txtMnemonic.ClientID + "','Please enter a mnemonic\\n\\n(Start typing and a list will be presented...)')" +
                                                             " && ProcessButton(this)" +
                                                             ";");
                            btnMnemonicDelete.Visible = true;
                            btnMnemonicDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item') && ProcessButton(this);");
                        }
                        else
                        {
                            btnMnemonicAdd.Visible = true;
                            btnMnemonicAdd.Attributes.Add("onclick", "return ValidateHidden0('" + hdnMnemonic.ClientID + "','" + txtMnemonic.ClientID + "','Please enter a mnemonic\\n\\n(Start typing and a list will be presented...)')" +
                                                          " && ProcessButton(this)" +
                                                          ";");
                        }
                        btnMnemonicCancel.Attributes.Add("onclick", "return ProcessButton(this);");
                    }
                }
                else if (Request.QueryString["domain"] != null && Request.QueryString["domain"] != "")
                {
                    intDomain       = Int32.Parse(Request.QueryString["domain"]);
                    lblCrumbs.Text += strSpacer + "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("server=" + intServer.ToString()) + "\">" + oTSM.Get(intServer, "name") + "</a>";
                    if (Request.QueryString["schedule"] != null && Request.QueryString["schedule"] != "")
                    {
                        intSchedule         = Int32.Parse(Request.QueryString["schedule"]);
                        lblCrumbs.Text     += strSpacer + "<a href=\"" + oPage.GetFullLink(intPage) + FormURL("server=" + intServer.ToString() + "&domain=" + intDomain.ToString()) + "\">" + oTSM.GetDomain(intDomain, "name") + "</a>";
                        panSchedule.Visible = true;
                        if (!IsPostBack)
                        {
                            DataSet ds = oTSM.GetSchedule(intSchedule);
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                lblCrumbs.Text                += strSpacer + oTSM.GetSchedule(intSchedule, "name");
                                txtScheduleName.Text           = ds.Tables[0].Rows[0]["name"].ToString();
                                chkScheduleEngineering.Checked = (ds.Tables[0].Rows[0]["engineering"].ToString() == "1");
                                chkScheduleTest.Checked        = (ds.Tables[0].Rows[0]["test"].ToString() == "1");
                                chkScheduleQA.Checked          = (ds.Tables[0].Rows[0]["qa"].ToString() == "1");
                                chkScheduleProduction.Checked  = (ds.Tables[0].Rows[0]["prod"].ToString() == "1");
                                chkScheduleWindows.Checked     = (ds.Tables[0].Rows[0]["windows"].ToString() == "1");
                                chkScheduleUnix.Checked        = (ds.Tables[0].Rows[0]["unix"].ToString() == "1");
                                chkScheduleDaily.Checked       = (ds.Tables[0].Rows[0]["daily"].ToString() == "1");
                                chkScheduleWeekly.Checked      = (ds.Tables[0].Rows[0]["weekly"].ToString() == "1");
                                if (chkScheduleWeekly.Checked == true)
                                {
                                    divScheduleWeekly.Style["display"] = "inline";
                                }
                                ddlScheduleResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                                chkScheduleWeeklySunday.Checked     = (ds.Tables[0].Rows[0]["sunday"].ToString() == "1");
                                chkScheduleWeeklyMonday.Checked     = (ds.Tables[0].Rows[0]["monday"].ToString() == "1");
                                chkScheduleWeeklyTuesday.Checked    = (ds.Tables[0].Rows[0]["tuesday"].ToString() == "1");
                                chkScheduleWeeklyWednesday.Checked  = (ds.Tables[0].Rows[0]["wednesday"].ToString() == "1");
                                chkScheduleWeeklyThursday.Checked   = (ds.Tables[0].Rows[0]["thursday"].ToString() == "1");
                                chkScheduleWeeklyFriday.Checked     = (ds.Tables[0].Rows[0]["friday"].ToString() == "1");
                                chkScheduleWeeklySaturday.Checked   = (ds.Tables[0].Rows[0]["saturday"].ToString() == "1");
                                chkScheduleMonthly.Checked          = (ds.Tables[0].Rows[0]["monthly"].ToString() == "1");
                                chk1200AM.Checked          = (ds.Tables[0].Rows[0]["AM1200"].ToString() == "1");
                                chk1230AM.Checked          = (ds.Tables[0].Rows[0]["AM1230"].ToString() == "1");
                                chk100AM.Checked           = (ds.Tables[0].Rows[0]["AM100"].ToString() == "1");
                                chk130AM.Checked           = (ds.Tables[0].Rows[0]["AM130"].ToString() == "1");
                                chk200AM.Checked           = (ds.Tables[0].Rows[0]["AM200"].ToString() == "1");
                                chk230AM.Checked           = (ds.Tables[0].Rows[0]["AM230"].ToString() == "1");
                                chk300AM.Checked           = (ds.Tables[0].Rows[0]["AM300"].ToString() == "1");
                                chk330AM.Checked           = (ds.Tables[0].Rows[0]["AM330"].ToString() == "1");
                                chk400AM.Checked           = (ds.Tables[0].Rows[0]["AM400"].ToString() == "1");
                                chk430AM.Checked           = (ds.Tables[0].Rows[0]["AM430"].ToString() == "1");
                                chk500AM.Checked           = (ds.Tables[0].Rows[0]["AM500"].ToString() == "1");
                                chk530AM.Checked           = (ds.Tables[0].Rows[0]["AM530"].ToString() == "1");
                                chk600AM.Checked           = (ds.Tables[0].Rows[0]["AM600"].ToString() == "1");
                                chk630AM.Checked           = (ds.Tables[0].Rows[0]["AM630"].ToString() == "1");
                                chk700AM.Checked           = (ds.Tables[0].Rows[0]["AM700"].ToString() == "1");
                                chk730AM.Checked           = (ds.Tables[0].Rows[0]["AM730"].ToString() == "1");
                                chk800AM.Checked           = (ds.Tables[0].Rows[0]["AM800"].ToString() == "1");
                                chk830AM.Checked           = (ds.Tables[0].Rows[0]["AM830"].ToString() == "1");
                                chk900AM.Checked           = (ds.Tables[0].Rows[0]["AM900"].ToString() == "1");
                                chk930AM.Checked           = (ds.Tables[0].Rows[0]["AM930"].ToString() == "1");
                                chk1000AM.Checked          = (ds.Tables[0].Rows[0]["AM1000"].ToString() == "1");
                                chk1030AM.Checked          = (ds.Tables[0].Rows[0]["AM1030"].ToString() == "1");
                                chk1100AM.Checked          = (ds.Tables[0].Rows[0]["AM1100"].ToString() == "1");
                                chk1130AM.Checked          = (ds.Tables[0].Rows[0]["AM1130"].ToString() == "1");
                                chk1200PM.Checked          = (ds.Tables[0].Rows[0]["PM1200"].ToString() == "1");
                                chk1230PM.Checked          = (ds.Tables[0].Rows[0]["PM1230"].ToString() == "1");
                                chk100PM.Checked           = (ds.Tables[0].Rows[0]["PM100"].ToString() == "1");
                                chk130PM.Checked           = (ds.Tables[0].Rows[0]["PM130"].ToString() == "1");
                                chk200PM.Checked           = (ds.Tables[0].Rows[0]["PM200"].ToString() == "1");
                                chk230PM.Checked           = (ds.Tables[0].Rows[0]["PM230"].ToString() == "1");
                                chk300PM.Checked           = (ds.Tables[0].Rows[0]["PM300"].ToString() == "1");
                                chk330PM.Checked           = (ds.Tables[0].Rows[0]["PM330"].ToString() == "1");
                                chk400PM.Checked           = (ds.Tables[0].Rows[0]["PM400"].ToString() == "1");
                                chk430PM.Checked           = (ds.Tables[0].Rows[0]["PM430"].ToString() == "1");
                                chk500PM.Checked           = (ds.Tables[0].Rows[0]["PM500"].ToString() == "1");
                                chk530PM.Checked           = (ds.Tables[0].Rows[0]["PM530"].ToString() == "1");
                                chk600PM.Checked           = (ds.Tables[0].Rows[0]["PM600"].ToString() == "1");
                                chk630PM.Checked           = (ds.Tables[0].Rows[0]["PM630"].ToString() == "1");
                                chk700PM.Checked           = (ds.Tables[0].Rows[0]["PM700"].ToString() == "1");
                                chk730PM.Checked           = (ds.Tables[0].Rows[0]["PM730"].ToString() == "1");
                                chk800PM.Checked           = (ds.Tables[0].Rows[0]["PM800"].ToString() == "1");
                                chk830PM.Checked           = (ds.Tables[0].Rows[0]["PM830"].ToString() == "1");
                                chk900PM.Checked           = (ds.Tables[0].Rows[0]["PM900"].ToString() == "1");
                                chk930PM.Checked           = (ds.Tables[0].Rows[0]["PM930"].ToString() == "1");
                                chk1000PM.Checked          = (ds.Tables[0].Rows[0]["PM1000"].ToString() == "1");
                                chk1030PM.Checked          = (ds.Tables[0].Rows[0]["PM1030"].ToString() == "1");
                                chk1100PM.Checked          = (ds.Tables[0].Rows[0]["PM1100"].ToString() == "1");
                                chk1130PM.Checked          = (ds.Tables[0].Rows[0]["PM1130"].ToString() == "1");
                                chkScheduleEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                                btnScheduleUpdate.Visible  = true;
                                btnScheduleUpdate.Attributes.Add("onclick", "return ValidateText('" + txtScheduleName.ClientID + "','Please enter a name for this schedule')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                btnScheduleDelete.Visible = true;
                                btnScheduleDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this schedule')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                            }
                            else
                            {
                                btnScheduleAdd.Visible = true;
                                btnScheduleAdd.Attributes.Add("onclick", "return ValidateText('" + txtScheduleName.ClientID + "','Please enter a name for this schedule')" +
                                                              " && ProcessButton(this)" +
                                                              ";");
                            }
                            btnScheduleCancel.Attributes.Add("onclick", "return ProcessButton(this);");
                            chkScheduleWeekly.Attributes.Add("onclick", "ShowHideDiv2('" + divScheduleWeekly.ClientID + "');");
                        }
                    }
                    else
                    {
                        panDomain.Visible = true;
                        DataSet  dsSchedules = oTSM.GetSchedules(intDomain, 0);
                        DataView dvSchedules = dsSchedules.Tables[0].DefaultView;
                        if (Request.QueryString["sort"] != null)
                        {
                            dvSchedules.Sort = Request.QueryString["sort"];
                        }
                        else
                        {
                            dvSchedules.Sort = "name";
                        }
                        rptSchedules.DataSource = dvSchedules;
                        rptSchedules.DataBind();
                        lblSchedules.Visible = (rptSchedules.Items.Count == 0);
                        if (!IsPostBack)
                        {
                            LoadLists();
                            DataSet ds = oTSM.GetDomain(intDomain);
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                lblCrumbs.Text                   += strSpacer + oTSM.GetDomain(intDomain, "name");
                                txtDomainName.Text                = ds.Tables[0].Rows[0]["name"].ToString();
                                chkDomainEngineering.Checked      = (ds.Tables[0].Rows[0]["engineering"].ToString() == "1");
                                chkDomainTest.Checked             = (ds.Tables[0].Rows[0]["test"].ToString() == "1");
                                chkDomainQA.Checked               = (ds.Tables[0].Rows[0]["qa"].ToString() == "1");
                                chkDomainProduction.Checked       = (ds.Tables[0].Rows[0]["prod"].ToString() == "1");
                                chkDomainWindows.Checked          = (ds.Tables[0].Rows[0]["windows"].ToString() == "1");
                                chkDomainUnix.Checked             = (ds.Tables[0].Rows[0]["unix"].ToString() == "1");
                                ddlDomainResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                                chkDomainEnabled.Checked          = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                                btnDomainUpdate.Visible           = true;
                                btnDomainUpdate.Attributes.Add("onclick", "return ValidateText('" + txtDomainName.ClientID + "','Please enter a name for this domain')" +
                                                               " && ValidateDropDown('" + ddlDomainResiliency.ClientID + "','Please select a Resiliency')" +
                                                               " && ProcessButton(this)" +
                                                               ";");
                                btnDomainDelete.Visible = true;
                                btnDomainDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this domain')" +
                                                               " && ProcessButton(this)" +
                                                               ";");
                            }
                            else
                            {
                                btnDomainAdd.Visible = true;
                                btnDomainAdd.Attributes.Add("onclick", "return ValidateText('" + txtDomainName.ClientID + "','Please enter a name for this domain')" +
                                                            " && ValidateDropDown('" + ddlDomainResiliency.ClientID + "','Please select a Resiliency')" +
                                                            " && ProcessButton(this)" +
                                                            ";");
                                btnAddSchedule.Enabled = false;
                            }
                            btnDomainCancel.Attributes.Add("onclick", "return ProcessButton(this);");
                        }
                    }
                }
                else
                {
                    panServer.Visible = true;
                    DataSet  dsDomains = oTSM.GetDomains(intServer, 0);
                    DataView dvDomains = dsDomains.Tables[0].DefaultView;
                    if (Request.QueryString["sort"] != null)
                    {
                        dvDomains.Sort = Request.QueryString["sort"];
                    }
                    else
                    {
                        dvDomains.Sort = "name";
                    }
                    rptDomains.DataSource = dvDomains;
                    rptDomains.DataBind();
                    lblDomains.Visible = (rptDomains.Items.Count == 0);
                    // Mnemonics
                    rptMnemonics.DataSource = oTSM.GetMnemonics(intServer, 0);
                    rptMnemonics.DataBind();
                    lblMnemonics.Visible = (rptMnemonics.Items.Count == 0);
                    if (!IsPostBack)
                    {
                        int     intLocation = Int32.Parse(ConfigurationManager.AppSettings["OPSLocationID"]);
                        DataSet ds          = oTSM.Get(intServer);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            lblCrumbs.Text    += strSpacer + oTSM.Get(intServer, "name");
                            txtServerName.Text = ds.Tables[0].Rows[0]["name"].ToString();
                            txtServerPort.Text = ds.Tables[0].Rows[0]["port"].ToString();
                            Int32.TryParse(ds.Tables[0].Rows[0]["addressid"].ToString(), out intLocation);
                            txtServerPath.Text = ds.Tables[0].Rows[0]["path"].ToString();
                            if (txtServerPath.Text != "")
                            {
                                hypServerPath.NavigateUrl = txtServerPath.Text;
                            }
                            else
                            {
                                hypServerPath.Enabled = false;
                            }
                            chkServerEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                            btnServerUpdate.Visible  = true;
                            btnServerUpdate.Attributes.Add("onclick", "return ValidateText('" + txtServerName.ClientID + "','Please enter a name for this server')" +
                                                           " && ValidateNumber0('" + txtServerPort.ClientID + "','Please enter a port number')" +
                                                           " && ProcessButton(this)" +
                                                           ";");
                            btnServerDelete.Visible = true;
                            btnServerDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this server')" +
                                                           " && ProcessButton(this)" +
                                                           ";");
                        }
                        else
                        {
                            btnServerAdd.Visible = true;
                            btnServerAdd.Attributes.Add("onclick", "return ValidateText('" + txtServerName.ClientID + "','Please enter a name for this server')" +
                                                        " && ValidateNumber0('" + txtServerPort.ClientID + "','Please enter a port number')" +
                                                        " && ProcessButton(this)" +
                                                        ";");
                            btnAddDomain.Enabled   = false;
                            btnAddMnemonic.Enabled = false;
                        }
                        btnServerCancel.Attributes.Add("onclick", "return ProcessButton(this);");
                        strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
                        hdnLocation.Value = intLocation.ToString();
                    }
                    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("Domains", "");
                    oTab.AddTab("Associated Mnemonics", "");
                    strMenuTab1 = oTab.GetTabs();
                }
            }
            else
            {
                panServers.Visible = true;
                DataSet  dsTSM = oTSM.Gets(1, 0, 0);
                DataView dvTSM = dsTSM.Tables[0].DefaultView;
                if (Request.QueryString["sort"] != null)
                {
                    dvTSM.Sort = Request.QueryString["sort"];
                }
                else
                {
                    dvTSM.Sort = "name";
                }
                rptServers.DataSource = dvTSM;
                rptServers.DataBind();
                lblServers.Visible = (rptServers.Items.Count == 0);
            }
            Variables oVariable = new Variables(intEnvironment);

            txtMnemonic.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'500','195','" + divMnemonic.ClientID + "','" + lstMnemonic.ClientID + "','" + hdnMnemonic.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_mnemonics.aspx',2);");
            lstMnemonic.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnAddDomain.Attributes.Add("onclick", "return ProcessButton(this);");
            btnAddSchedule.Attributes.Add("onclick", "return ProcessButton(this);");
            btnAddServer.Attributes.Add("onclick", "return ProcessButton(this);");
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/forecast/build_locations_rdp.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");
            }
            oBuildLocation = new BuildLocation(intProfile, dsn);
            oClass         = new Classes(intProfile, dsn);
            oLocation      = new Locations(intProfile, dsn);
            oResiliency    = new Resiliency(intProfile, dsn);

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                LoopRepeater();
            }
            else
            {
                intID = Int32.Parse(Request.QueryString["id"]);
                if (intID == 0)
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                }
                else
                {
                    panAdd.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds       = oBuildLocation.GetRDP(intID);
                        int     intClass = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["classid"].ToString(), out intClass);
                        ddlClass.SelectedValue        = intClass.ToString();
                        ddlEnvironment.Enabled        = true;
                        ddlEnvironment.DataTextField  = "name";
                        ddlEnvironment.DataValueField = "id";
                        ddlEnvironment.DataSource     = oClass.GetEnvironment(intClass, 0);
                        ddlEnvironment.DataBind();
                        ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        int intEnv = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["environmentid"].ToString(), out intEnv);
                        ddlEnvironment.SelectedValue = intEnv.ToString();
                        hdnEnvironment.Value         = intEnv.ToString();
                        Int32.TryParse(ds.Tables[0].Rows[0]["addressid"].ToString(), out intLocation);
                        txtRDP_Schedule_WS.Text             = ds.Tables[0].Rows[0]["rdp_schedule_ws"].ToString();
                        txtRDP_Computer_WS.Text             = ds.Tables[0].Rows[0]["rdp_computer_ws"].ToString();
                        txtRDP_MDT_WS.Text                  = ds.Tables[0].Rows[0]["rdp_mdt_ws"].ToString();
                        txtJumpstartCGI.Text                = ds.Tables[0].Rows[0]["jumpstart_cgi"].ToString();
                        ddlJumpstartBuildType.SelectedValue = ds.Tables[0].Rows[0]["jumpstart_build_type"].ToString();
                        txtBladeVLAN.Text           = ds.Tables[0].Rows[0]["blade_vlan"].ToString();
                        txtVMwareVLAN.Text          = ds.Tables[0].Rows[0]["vmware_vlan"].ToString();
                        txtVSphereVLAN.Text         = ds.Tables[0].Rows[0]["vsphere_vlan"].ToString();
                        txtDellVLAN.Text            = ds.Tables[0].Rows[0]["dell_vlan"].ToString();
                        txtDellVmwareVLAN.Text      = ds.Tables[0].Rows[0]["dell_vmware_vlan"].ToString();
                        ddlResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                        ddlSource.SelectedValue     = ds.Tables[0].Rows[0]["source"].ToString();
                        chkServerAltiris.Checked    = (ds.Tables[0].Rows[0]["server_altiris"].ToString() == "1");
                        chkServerMDT.Checked        = (ds.Tables[0].Rows[0]["server_mdt"].ToString() == "1");
                        chkWorkstation.Checked      = (ds.Tables[0].Rows[0]["workstation"].ToString() == "1");
                        chkZones.Checked            = (ds.Tables[0].Rows[0]["zones"].ToString() == "1");
                        btnZones.Enabled            = chkZones.Checked;

                        chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text        = "Update";
                    }
                }
            }

            strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
            hdnLocation.Value = intLocation.ToString();
            ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
            ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            btnZones.Attributes.Add("onclick", "return OpenWindow('RDP_ZONES','','" + intID.ToString() + "',false,'650',500);");
        }