public ActionResult DeleteConfirmed(int id) { Solaris solaris = db.Solaris.Find(id); db.Solaris.Remove(solaris); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Filesystem,Blocks,Used,Available,Capacity,Mount,RunDate,ApplicationId")] Solaris solaris) { if (ModelState.IsValid) { db.Entry(solaris).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ApplicationId = new SelectList(db.Applications, "ApplicationId", "ApplicationName", solaris.ApplicationId); return(View(solaris)); }
public SolarisViewModel(Solaris disk) { Id = disk.Id; RunDate = disk.RunDate; Blocks = disk.Blocks; Capacity = disk.Capacity; ApplicationId = disk.ApplicationId; Mount = disk.Mount; Filesystem = disk.Filesystem; Used = disk.Used; Available = disk.Available; }
// GET: Solaris/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Solaris solaris = db.Solaris.Find(id); if (solaris == null) { return(HttpNotFound()); } return(View(solaris)); }
public void Begin() { datStart = DateTime.Now; arProcessing = new int[4] { 45, 47, 92, 124 }; // 92 = \, 124 = |, 47 = /, 45 = - strSSH = ""; oModel = new Models(0, dsn); oModelsProperties = new ModelsProperties(0, dsn); oServer = new Servers(0, dsn); oSetting = new Settings(0, dsn); oOnDemand = new OnDemand(0, dsn); oSolaris = new Solaris(0, dsn); oEventLog = new Log(0, dsn); oFunction = new Functions(0, dsn, intEnvironment); strTo = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_SUPPORT"); intModel = Int32.Parse(oServer.Get(intServer, "modelid")); if (intModel > 0) { strModel = oModelsProperties.Get(intModel, "name"); Int32.TryParse(oModelsProperties.Get(intModel, "modelid"), out intModelParent); if (intModelParent > 0) { Int32.TryParse(oModel.Get(intModelParent, "boot_groupid"), out intModelBootGroup); } } if (intModelBootGroup > 0) { string strUsername = oModel.GetBootGroup(intModelBootGroup, "username"); string strPassword = oModel.GetBootGroup(intModelBootGroup, "password"); strReturnToALOM = oModel.GetBootGroup(intModelBootGroup, "return_to_alom"); oEventLog.AddEvent(strName, strSerial, "Connecting to " + strILO + "... (U:" + strUsername + ", P:****)", LoggingType.Information); oSSHshell = new SshShell(strILO, strUsername, strPassword); oSSHshell.RemoveTerminalEmulationCharacters = true; oSSHshell.Connect(); oEventLog.AddEvent(strName, strSerial, "Connected to " + strILO + "...sending commands...", LoggingType.Information); ThreadStart oReadingDoneSSH = new ThreadStart(ReadingDoneSSH); Thread oJobReadingDoneSSH = new Thread(oReadingDoneSSH); oJobReadingDoneSSH.Start(); ReadingSSH(); } else { AddResult("The boot group of the model has not been configured ~ (ModelPropertyID = " + intModel.ToString() + ") (ModelID = " + intModelParent.ToString() + ") (ModelBootGroupID = " + intModelBootGroup.ToString() + ")"); } }
public ActionResult OracleDbServer([Bind(Include = "ApplicationId,Filesystem,Blocks,Mount,Used,Available,Capacity,RunDate")] SolarisViewModel model) { int sv = Helpers.parameters.OracleDatabaseServer; Session["SelectedApp"] = sv; Session["Username"] = solarisService.GetSuperUsername(sv); Session["Password"] = solarisService.GetSuperUserPassword(sv); Session["ServerIP"] = solarisService.GetServerIp(Convert.ToInt32(Session["SelectedApp"])); Session["ServerId"] = solarisService.GetServerId(Convert.ToInt32(Session["SelectedApp"])); var disk = new Solaris(); solarisService.SaveDiskInfo(disk); return(RedirectToAction("Index")); }
// GET: Solaris/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Solaris solaris = db.Solaris.Find(id); if (solaris == null) { return(HttpNotFound()); } ViewBag.ApplicationId = new SelectList(db.Applications, "ApplicationId", "ApplicationName", solaris.ApplicationId); return(View(solaris)); }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/asset/asset_models.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"); } oModel = new Models(intProfile, dsn); oType = new Types(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oHost = new Host(intProfile, dsn); oClass = new Classes(intProfile, dsn); oSolaris = new Solaris(intProfile, dsn); oVariable = new Variables(intEnvironment); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { panOne.Visible = true; intModel = Int32.Parse(Request.QueryString["id"]); lblModel.Text = oModel.Get(intModel, "name") + " Reservations"; LoadClasses(); treModel.ExpandDepth = 0; treModel.Attributes.Add("oncontextmenu", "return false;"); } else { panAll.Visible = true; if (!IsPostBack) { LoadList(); Load(); btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnParent.ClientID + "','" + hdnOrder.ClientID + "&type=A_MODEL" + "',false,400,400);"); btnParent.Attributes.Add("onclick", "return OpenWindow('TYPEBROWSER','" + 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();"); } } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/forecast/solaris_build_networks.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); if (!IsPostBack) { LoopRepeater(); btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=SOLARIS_BUILD_NETWORKS" + "',false,400,400);"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); btnCancel.Attributes.Add("onclick", "return Cancel();"); } }
public ActionResult QueryDiskInformation([Bind(Include = "ApplicationId,Filesystem,Blocks,Mount,Used,Available,Capacity,RunDate")] SolarisViewModel model) { if (!ModelState.IsValid) { solarisService.GetApps(model); return(View(model)); } //Get DropDown selected value var selectedValue = Request.Form["ApplicationId"].ToString(); var sv = Convert.ToInt32(selectedValue); Session["SelectedApp"] = sv; Session["Username"] = solarisService.GetSuperUsername(sv); Session["Password"] = solarisService.GetSuperUserPassword(sv); Session["ServerIP"] = solarisService.GetServerIp(sv); var disk = new Solaris(); solarisService.SaveDiskInfo(disk); return(RedirectToAction("Index")); }
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 = " (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"] + "');"); }
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; } }
protected void Page_Load(object sender, EventArgs e) { Models oModel = new Models(0, dsn); Solaris oSolaris = new Solaris(0, dsn); Variables oVariables = new Variables((int)CurrentEnvironment.PNCNT_QA); string strMAC = ""; string strUsername = oVariables.NexusUsername(); string strPassword = oVariables.NexusPassword(); string strExpects = "#"; string strLine = "show int eth 102/1/24 br"; //SshShell oSSHshell = new SshShell("P-PRDC-ZA08A-1", strUsername, strPassword); //oSSHshell.RemoveTerminalEmulationCharacters = true; //oSSHshell.Connect(); //if (oSSHshell.Connected == true && oSSHshell.ShellOpened == true) //{ // // Wait for "sc>" // string strBanner = oSSHshell.Expect(strExpects); // // Send Command : showsc sys_enetaddr // oSSHshell.WriteLine(strLine); // //WriteLine(oSSHshell, strLine); // // Wait for "sc>" // strMAC = oSSHshell.Expect(strExpects); // //strMAC = oSolaris.ParseOutput(strMAC, "macaddress = ", Environment.NewLine); //} //oSSHshell.Close(); //Response.Write("<p>" + strMAC + "</p>"); //SshExec oSSH = new SshExec("P-PRDC-ZA08A-1", strUsername, strPassword); //oSSH.Connect(); //string strMAC2 = oSSH.RunCommand(strLine); //oSSH.Close(); //Response.Write("<p>" + strMAC2 + "</p>"); //SshExec oSSHa = new SshExec("10.49.254.229", "admin", "nccSAN03"); //oSSHa.Connect(); //string strResult = oSSHa.RunCommand("config t"); //Response.Write(strResult); ////Response.Write(ExecuteSSH("config t", oSSHa)); //oSSHa.Close(); string strName = "HEALYTEST"; StringBuilder strSAN = new StringBuilder(); SshShell oSSHshellb = new SshShell("10.49.254.230", "admin", "nccSAN03"); oSSHshellb.RemoveTerminalEmulationCharacters = true; oSSHshellb.Connect(); if (oSSHshellb.Connected == true && oSSHshellb.ShellOpened == true) { string strBanner = oSSHshellb.Expect("#"); strSAN.Append("10.49.254.230..."); strSAN.Append(ExecuteSSH("config t", oSSHshellb)); strSAN.Append(ExecuteSSH("device-alias database", oSSHshellb)); strSAN.Append(ExecuteSSH("device-alias name " + strName + "b pwwn 50:06:0b:00:00:c3:5a:36", oSSHshellb)); strSAN.Append(ExecuteSSH("exit", oSSHshellb)); strSAN.Append(ExecuteSSH("device-alias commit", oSSHshellb)); System.Threading.Thread.Sleep(20000); // wait 20 seconds strSAN.Append(ExecuteSSH("zoneset name eng_cert vsan 1101", oSSHshellb)); strSAN.Append(ExecuteSSH("zone name " + strName + "b_vmax0425_01h1", oSSHshellb)); strSAN.Append(ExecuteSSH("member device-alias " + strName + "b", oSSHshellb)); strSAN.Append(ExecuteSSH("member device-alias vmax0425_01h1", oSSHshellb)); strSAN.Append(ExecuteSSH("exit", oSSHshellb)); strSAN.Append(ExecuteSSH("member " + strName + "b_vmax0425_01h1", oSSHshellb)); strSAN.Append(ExecuteSSH("exit", oSSHshellb)); strSAN.Append(ExecuteSSH("zoneset activate name eng_cert vsan 1101", oSSHshellb)); System.Threading.Thread.Sleep(10000); // wait 10 seconds strSAN.Append(ExecuteSSH("zone commit vsan 1101", oSSHshellb)); System.Threading.Thread.Sleep(20000); // wait 20 seconds strSAN.Append(ExecuteSSH("end", oSSHshellb)); strSAN.Append(ExecuteSSH("exit", oSSHshellb)); } oSSHshellb.Close(); Response.Write("<p>" + strSAN + "</p>"); }
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 = """ + strHeader.ToUpper() + """; 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; } }
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(); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); } if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } oDataPoint = new DataPoint(intProfile, dsn); oUser = new Users(intProfile, dsn); oServer = new Servers(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset); oForecast = new Forecast(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oOperatingSystem = new OperatingSystems(intProfile, dsn); oServicePack = new ServicePacks(intProfile, dsn); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1)) { panAllow.Visible = true; if (Request.QueryString["save"] != null) { panSave.Visible = true; } if (Request.QueryString["error"] != null) { panError.Visible = true; // -100: More than one device name // -10: No device names // -5: Improper Name Format // -1: ServerID = 0 if (Request.QueryString["error"] == "-100") { lblError.Text = "More than one name"; } else if (Request.QueryString["error"] == "-10") { lblError.Text = "User Cancelled Prompt"; } else if (Request.QueryString["error"] == "-5") { lblError.Text = "Name is in Incorrect Format"; } else if (Request.QueryString["error"] == "-1") { lblError.Text = "DeviceID = 0"; } else { lblError.Text = "Generic Error"; } } Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID); if (Request.QueryString["close"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>"); } else if (intID > 0) { DataSet ds = oDataPoint.GetAsset(intID); if (ds.Tables[0].Rows.Count == 1) { // Load General Information intAsset = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); lblAssetID.Text = "#" + intAsset.ToString(); string strSerial = ds.Tables[0].Rows[0]["serial"].ToString(); string strAsset = ds.Tables[0].Rows[0]["asset"].ToString(); string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial); lblHeader.Text = """ + strHeader.ToUpper() + """; Master.Page.Title = "DataPoint | VMware (" + strHeader + ")"; lblHeaderSub.Text = "Provides all the information about a VMware guest..."; int intMenuTab = 0; if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "") { intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]); } Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false); oTab.AddTab("Asset Information", ""); oTab.AddTab("Host Information", ""); oTab.AddTab("Resource Dependencies", ""); oTab.AddTab("Provisioning Information", ""); //oTab.AddTab("Network Adapter Configuration", ""); strMenuTab1 = oTab.GetTabs(); if (!IsPostBack) { //DataSet dsAssets = oServer.GetAsset(intAsset); //foreach (DataRow drAsset in dsAssets.Tables[0].Rows) //{ // if (drAsset["latest"].ToString() == "1") // { // intAsset = Int32.Parse(drAsset["assetid"].ToString()); // intAssetClass = Int32.Parse(drAsset["classid"].ToString()); // intAssetEnv = Int32.Parse(drAsset["environmentid"].ToString()); // break; // } //} // Asset Information oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "VMWARE_SERIAL", strSerial, "", false, true); oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "VMWARE_ASSET", strAsset, "", false, true); int intAssetAttribute = 0; Int32.TryParse(oAsset.Get(intAsset, "asset_attribute"), out intAssetAttribute); oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false); oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true); ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()"); ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');"); int intModel = 0; Int32.TryParse(oAsset.Get(intAsset, "modelid"), out intModel); hdnModel.Value = intModel.ToString(); int intModelParent = 0; Int32.TryParse(oModelsProperties.Get(intModel, "modelid"), out intModelParent); int intType = oModel.GetType(intModelParent); int intPlatform = oType.GetPlatform(intType); oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "VMWARE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true); oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "VMWARE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "VMWARE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "VMWARE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true); // Get Asset DataSet dsAsset = oAsset.GetGuest(intAsset); if (dsAsset.Tables[0].Rows.Count > 0) { oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, btnNameLookup, "/datapoint/asset/datapoint_asset_search.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["name"].ToString()), lblName, fldName, "VMWARE_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false); if (txtName.Text != "") { lblHeader.Text += " [" + txtName.Text + "]"; } lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString(); int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString()); int intEnv = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString()); hdnEnvironment.Value = intEnv.ToString(); oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "VMWARE_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true); oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "VMWARE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true); ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString(); ddlStatus.Enabled = (intAssetAttribute == (int)AssetAttribute.Ok); panStatus.Visible = (ddlStatus.Enabled == false); } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } // Get Original Detail VMWare oVMWare = new VMWare(intProfile, dsn); DataSet dsGuest = oVMWare.GetGuest(dsAsset.Tables[0].Rows[0]["name"].ToString()); if (dsGuest.Tables[0].Rows.Count > 0) { panVMWare.Visible = true; DataRow drGuest = dsGuest.Tables[0].Rows[0]; int intDatastore = Int32.Parse(drGuest["datastoreid"].ToString()); lblBuildDataStore.Text = oVMWare.GetDatastore(intDatastore, "name"); int intHost = Int32.Parse(drGuest["hostid"].ToString()); lblBuildHost.Text = oVMWare.GetHost(intHost, "name"); int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid")); lblBuildCluster.Text = oVMWare.GetCluster(intCluster, "name"); int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid")); lblBuildFolder.Text = oVMWare.GetFolder(intFolder, "name"); int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid")); lblBuildDataCenter.Text = oVMWare.GetDatacenter(intDataCenter, "name"); int intVirtualCenter = Int32.Parse(oVMWare.GetDatacenter(intDataCenter, "virtualcenterid")); lblBuildVirtualCenter.Text = oVMWare.GetVirtualCenter(intVirtualCenter, "name"); // Get Host if (Request.Cookies["host"] != null && Request.Cookies["host"].Value != "") { string strHost = ""; string strFind = txtName.Text; //strFind = "ohcleapp103d"; DateTime datStart = DateTime.Parse(Request.Cookies["host"].Value); Response.Cookies["host"].Value = ""; //VMWare oVMWare = new VMWare(intProfile, dsn); DataSet dsVirtualCenter = oVMWare.GetVirtualCenters(1); foreach (DataRow drVirtualCenter in dsVirtualCenter.Tables[0].Rows) { intVirtualCenter = Int32.Parse(drVirtualCenter["id"].ToString()); string strVirtualCenter = drVirtualCenter["name"].ToString(); string strVirtualCenterURL = drVirtualCenter["url"].ToString(); int intVirtualCenterEnv = Int32.Parse(drVirtualCenter["environment"].ToString()); DataSet dsDataCenter = oVMWare.GetDatacenters(intVirtualCenter, 1); foreach (DataRow drDataCenter in dsDataCenter.Tables[0].Rows) { intDataCenter = Int32.Parse(drDataCenter["id"].ToString()); string strDataCenter = drDataCenter["name"].ToString(); string strConnect = oVMWare.ConnectDEBUG(strVirtualCenterURL, intVirtualCenterEnv, strDataCenter); VimService _service = oVMWare.GetService(); ServiceContent _sic = oVMWare.GetSic(); try { ManagedObjectReference oVM = oVMWare.GetVM(strFind); GuestInfo ginfo = (GuestInfo)oVMWare.getObjectProperty(oVM, "guest"); lblGuestName.Text = ginfo.guestFullName; lblGuestState.Text = ginfo.guestState; GuestNicInfo[] nInfo = ginfo.net; foreach (GuestNicInfo nic in nInfo) { string[] strIPAddresses = nic.ipAddress; foreach (string strIPAddress in strIPAddresses) { if (lblIPAddress.Text != "") { lblIPAddress.Text += ", "; } lblIPAddress.Text += strIPAddress; } if (lblMACAddress.Text != "") { lblMACAddress.Text += ", "; } lblMACAddress.Text += nic.macAddress; if (lblNetwork.Text != "") { lblNetwork.Text += ", "; } lblNetwork.Text += nic.network; } VirtualMachineConfigInfo vminfo = (VirtualMachineConfigInfo)oVMWare.getObjectProperty(oVM, "config"); VirtualMachineSummary oVMSummary = (VirtualMachineSummary)oVMWare.getObjectProperty(oVM, "summary"); VirtualMachineConfigSummary oVMConfig = oVMSummary.config; lblRAM.Text = oVMConfig.memorySizeMB.ToString(); lblCPUs.Text = oVMConfig.numCpu.ToString(); lblPath.Text = oVMConfig.vmPathName; VirtualMachineRuntimeInfo oVMRuntime = oVMSummary.runtime; ManagedObjectReference oVMHost = oVMRuntime.host; strHost = (string)oVMWare.getObjectProperty(oVMHost, "name"); if (strHost.IndexOf(".") > -1) { strHost = strHost.Substring(0, strHost.IndexOf(".")); } lblVirtualCenter.Text = strVirtualCenter; lblDataCenter.Text = strDataCenter; break; } catch { } finally { if (_service != null) { _service.Abort(); if (_service.Container != null) { _service.Container.Dispose(); } try { _service.Logout(_sic.sessionManager); } catch { } _service.Dispose(); _service = null; _sic = null; } } } } if (strHost != "") { oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(strHost), lblHostName, fldHostName, "VMWARE_HOST", strHost, "", false, false); } else { panHostNo.Visible = true; } TimeSpan oSpan = DateTime.Now.Subtract(datStart); btnHostQuery.Enabled = false; btnHostQuery.Text = "Query Time: " + oSpan.TotalSeconds.ToString("0") + " seconds..."; } else { txtHostName.Visible = false; lblHostName.Text = "---"; lblDataCenter.Text = "---"; lblVirtualCenter.Text = "---"; } oDataPoint.LoadPanel(panHostQuery, intProfile, fldHostQuery, "VMWARE_HOST_QUERY"); } else { Solaris oSolaris = new Solaris(intProfile, dsn); DataSet dsServers = oServer.GetAssetsAsset(intAsset); foreach (DataRow drServer in dsServers.Tables[0].Rows) { DataSet dsSVE = oSolaris.GetSVEGuest(Int32.Parse(drServer["serverid"].ToString())); if (dsSVE.Tables[0].Rows.Count > 0) { panSVE.Visible = true; int intCluster = Int32.Parse(dsSVE.Tables[0].Rows[0]["clusterid"].ToString()); lblSVECluster.Text = oSolaris.GetSVECluster(intCluster, "name"); } } } // Resource Dependencies AssetOrder oAssetOrder = new AssetOrder(0, dsn, dsnAsset, intEnvironment); Services oService = new Services(0, dsn); ServiceRequests oServiceRequest = new ServiceRequests(0, dsn); rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false); rptServiceRequests.DataBind(); trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0); foreach (RepeaterItem ri in rptServiceRequests.Items) { Label lblServiceID = (Label)ri.FindControl("lblServiceID"); int intService = Int32.Parse(lblServiceID.Text); Label lblDetails = (Label)ri.FindControl("lblDetails"); Label lblProgress = (Label)ri.FindControl("lblProgress"); if (lblProgress.Text == "") { lblProgress.Text = "<i>Unavailable</i>"; } else { int intResource = Int32.Parse(lblProgress.Text); double dblAllocated = 0.00; double dblUsed = 0.00; int intStatus = 0; bool boolAssigned = false; DataSet dsResource = oDataPoint.GetServiceRequestResource(intResource); if (dsResource.Tables[0].Rows.Count > 0) { Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus); } foreach (DataRow drResource in dsResource.Tables[1].Rows) { boolAssigned = true; dblAllocated += double.Parse(drResource["allocated"].ToString()); dblUsed += double.Parse(drResource["used"].ToString()); intStatus = Int32.Parse(drResource["status"].ToString()); } if (intStatus == (int)ResourceRequestStatus.Closed) { lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true); } else if (intStatus == (int)ResourceRequestStatus.Cancelled) { lblProgress.Text = "Cancelled"; } else if (boolAssigned == false) { string strManager = ""; DataSet dsManager = oService.GetUser(intService, 1); // Managers foreach (DataRow drManager in dsManager.Tables[0].Rows) { if (strManager != "") { strManager += "\\n"; } int intManager = Int32.Parse(drManager["userid"].ToString()); strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]"; } lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>"; } else if (dblAllocated > 0.00) { lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true); } else { lblProgress.Text = "<i>N / A</i>"; } lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>"; } } // Provioning History rptHistory.DataSource = oAsset.GetProvisioningHistory(oDataPoint.AssetHistorySelect(intAsset)); rptHistory.DataBind(); lblHistory.Visible = (rptHistory.Items.Count == 0); oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "VMWARE_STATUS"); } } else { if (Request.QueryString["t"] != null && Request.QueryString["q"] != null) { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0"); } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } } } else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "") { string strQuery = oFunction.decryptQueryString(Request.QueryString["q"]); DataSet ds = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0); if (ds.Tables[0].Rows.Count == 1) { intID = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intID.ToString())); } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?multiple=true&t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"]); } } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } btnClose.Attributes.Add("onclick", "window.close();return false;"); btnPrint.Attributes.Add("onclick", "window.print();return false;"); btnName.Attributes.Add("onclick", "return OpenWindow('DEVICE_NAME','?assetid=" + intAsset.ToString() + "');"); btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()")); btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()")); ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);"); ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');"); btnHostQuery.Attributes.Add("onclick", "ProcessButton(this,'Querying... please be patient...','225') && ProcessControlButton();"); } else { panDenied.Visible = true; } }
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"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oProject = new Projects(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oService = new Services(intProfile, dsn); oRequestField = new RequestFields(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oOnDemandTasks = new OnDemandTasks(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oSolaris = new Solaris(intProfile, dsn); oMnemonic = new Mnemonic(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["rrid"] != null && Request.QueryString["rrid"] != "") { lblResourceWorkflow.Text = Request.QueryString["rrid"]; int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); DataSet ds = oResourceRequest.Get(intResourceParent); intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); int intStatus = 0; Int32.TryParse(oResourceRequest.GetWorkflow(intResourceWorkflow, "status"), out intStatus); // Workflow start bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); // Workflow end intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); lblService.Text = oService.Get(intService, "name"); int intApp = oRequestItem.GetItemApplication(intItem); double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent); txtHours.Text = dblUsed.ToString("F"); dblUsed = (dblUsed / dblAllocated) * 100; if (Request.QueryString["save"] != null && Request.QueryString["save"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>"); } if (Request.QueryString["status"] != null && Request.QueryString["status"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Weekly Status has been Added');<" + "/" + "script>"); } intProject = oRequest.GetProjectNumber(intRequest); hdnTab.Value = "D"; panWorkload.Visible = true; bool boolRed = LoadStatus(intResourceWorkflow); bool boolDone = LoadInformation(intResourceWorkflow); if (boolDone == true) { if (boolComplete == false) { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();"); } else { btnSave.ImageUrl = "/images/tool_save_dbl.gif"; btnSave.Enabled = false; btnReturn.ImageUrl = "/images/tool_return_dbl.gif"; btnReturn.Enabled = false; oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;"); } } else { btnComplete.ImageUrl = "/images/tool_complete_dbl.gif"; btnComplete.Enabled = false; } bool boolSLABreached = false; if (oService.Get(intService, "sla") != "" && oService.Get(intService, "sla") != "0") { oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla"); int intDays = oResourceRequest.GetSLA(intResourceParent); if (intDays < 1) { btnSLA.Style["border"] = "solid 2px #FF0000"; } else if (intDays < 3) { btnSLA.Style["border"] = "solid 2px #FF9999"; } boolSLABreached = (intDays < 0); btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');"); } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } if (boolRed == false && boolSLABreached == true) { btnComplete.Attributes.Add("onclick", "alert('NOTE: Your Service Level Agreement (SLA) has been breached!\\n\\nYou must provide a RED STATUS update with an explanation of why your SLA was breached for this request.\\n\\nOnce a RED STATUS update has been provided, you will be able to complete this request.');return false;"); } oFunction.ConfigureToolButton(btnEmail, "/images/tool_email"); btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=STORAGE');"); btnDenied.Attributes.Add("onclick", "return CloseWindow();"); oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); btnSave.Attributes.Add("onclick", "return ValidateNumber('" + txtHours.ClientID + "','Please enter a valid number of hours') && EnsureTextbox() && EnsureTextbox0() && EnsureStatus('" + hdnTab.ClientID + "','" + ddlStatus.ClientID + "','" + txtComments.ClientID + "') && ProcessControlButton();"); oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); // 6/1/2009 - Load ReadOnly View if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) { oFunction.ConfigureToolButtonRO(btnSave, btnComplete); //panDenied.Visible = true; } if (intStatus != (int)ResourceRequestStatus.AwaitingResponse) //Awaiting Client Response { oFunction.ConfigureToolButton(btnReturn, "/images/tool_return"); btnReturn.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_RETURN','?rrid=" + intResourceParent.ToString() + "&rrwfid=" + intResourceWorkflow.ToString() + "');"); } } else { panDenied.Visible = true; } }