コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/dell_configs.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");
     }
     oDell = new Dells(intProfile, dsn);
     if (Request.QueryString["id"] == null)
     {
         if (Request.QueryString["add"] == null)
         {
             LoopRepeater();
         }
         else
         {
             panAdd.Visible = true;
         }
     }
     else
     {
         panAdd.Visible = true;
         intID          = Int32.Parse(Request.QueryString["id"]);
         if (intID > 0)
         {
             if (!IsPostBack)
             {
                 DataSet ds = oDell.Get(intID);
                 txtName.Text       = ds.Tables[0].Rows[0]["name"].ToString();
                 txtSplit.Text      = ds.Tables[0].Rows[0]["xml_split"].ToString();
                 txtOperator.Text   = ds.Tables[0].Rows[0]["xml_operator"].ToString();
                 txtStart.Text      = ds.Tables[0].Rows[0]["xml_start"].ToString();
                 txtQueryPower.Text = ds.Tables[0].Rows[0]["query_power"].ToString();
                 txtQueryMAC1.Text  = ds.Tables[0].Rows[0]["query_mac1"].ToString();
                 txtQueryMAC2.Text  = ds.Tables[0].Rows[0]["query_mac2"].ToString();
                 txtPowerOn.Text    = ds.Tables[0].Rows[0]["success_power_on"].ToString();
                 txtPowerOff.Text   = ds.Tables[0].Rows[0]["success_power_off"].ToString();
                 txtUsername.Text   = ds.Tables[0].Rows[0]["username"].ToString();
                 txtPassword.Text   = ds.Tables[0].Rows[0]["password"].ToString();
                 chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                 btnAdd.Text        = "Update";
             }
         }
         else
         {
             btnDelete.Enabled = false;
         }
     }
     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
 }
コード例 #2
0
        protected void Page_Load()
        {
            Int32.TryParse(Request.QueryString["id"], out intAsset);
            if (intAsset > 0)
            {
                int   intModelProperty = 0;
                Asset oAsset           = new Asset(0, dsnAsset, dsn);
                if (Int32.TryParse(oAsset.Get(intAsset, "modelid"), out intModelProperty) == true)
                {
                    ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
                    if (oModelsProperties.IsDell(intModelProperty) == true)
                    {
                        int intDellConfig = 0;
                        Int32.TryParse(oModelsProperties.Get(intModelProperty, "dellconfigid"), out intDellConfig);
                        Dells   oDell  = new Dells(0, dsn);
                        DataSet dsDell = oDell.Get(intDellConfig);
                        if (dsDell.Tables[0].Rows.Count == 1)
                        {
                            DataRow drDell = dsDell.Tables[0].Rows[0];
                            strUser = drDell["username"].ToString();
                            strPass = drDell["password"].ToString();
                            strILO  = oAsset.GetServerOrBlade(intAsset, "ilo");

                            Functions oFunction = new Functions(0, dsn, intEnvironment);
                            Variables oVariable = new Variables(intEnvironment);

                            if (Request.QueryString["showimage"] != null)
                            {
                                Response.Redirect("/ondemand/ondemand_dell_image.aspx?showimage=https://" + strILO + Request.QueryString["showimage"]);
                            }
                            else if (Request.QueryString["bypass"] != null)
                            {
                                if (strUser == "" || strPass == "")
                                {
                                    strUser = oVariable.ADUser() + "@" + oVariable.FullyQualified();
                                    strPass = oFunction.AddPassword(50);
                                }
                            }
                        }
                    }
                }
            }
        }