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