Пример #1
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"] + "');");
        }