public Vtero(string MemoryDump) : this() { MemFile = MemoryDump.ToLower(); if (MemFile.EndsWith(".dmp")) { var dump = new CrashDump(MemFile); if (dump.IsSupportedFormat()) { DetectedDesc = dump.PhysMemDesc; } } else if (MemFile.EndsWith(".vmss") || MemFile.EndsWith(".vmsn") || MemFile.EndsWith(".vmem")) { var dump = new VMWare(MemFile); if (dump.IsSupportedFormat()) { DetectedDesc = dump.PhysMemDesc; MemFile = dump.MemFile; } } scan = new Scanner(MemFile); FileSize = new FileInfo(MemFile).Length; }
protected void Page_Load(object sender, EventArgs e) { VMWare oVMWare = new VMWare(0, dsn); if (String.IsNullOrEmpty(Request.QueryString["id"]) == false) { Response.ContentType = "application/json"; DataSet ds = oVMWare.GetDatacenters(Int32.Parse(Request.QueryString["id"]), 0); StringBuilder sb = new StringBuilder(); sb.AppendLine("JsonReturn(["); foreach (DataRow dr in ds.Tables[0].Rows) { sb.Append("{"); sb.Append("\"id\":" + dr["id"].ToString()); sb.Append(","); sb.Append("\"name\":\"" + dr["name"].ToString() + "\""); sb.Append(","); sb.Append("\"build_folder\":\"" + dr["build_folder"].ToString() + "\""); sb.Append(","); sb.Append("\"enabled\":" + (dr["enabled"].ToString() == "1" ? "true" : "false")); sb.AppendLine("}"); } sb.AppendLine("])"); Response.Write(sb.ToString()); Response.End(); } }
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(); } oVMWare = new VMWare(intProfile, dsn); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); btnClose.Attributes.Add("onclick", "return HidePanel();"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intTemplate = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { LoadClasses(); if (intTemplate > 0) { lblName.Text = oVMWare.GetTemplate(intTemplate, "name"); } } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/vmware/folders.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); oEnvironment = new Environments(intProfile, dsn); oClass = new Classes(intProfile, dsn); oLocation = new Locations(intProfile, dsn); if (!IsPostBack) { LoadLists(); LoadVirtualCenters(); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); btnCancel.Attributes.Add("onclick", "return Cancel();"); btnLocations.Attributes.Add("onclick", "return OpenWindow('VMWARE_FOLDERS','" + hdnId.ClientID + "','',false,'650',500);"); strLocation = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon"); hdnLocation.Value = intLocation.ToString(); ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',1);"); ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');"); } }
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(); } oVMWare = new VMWare(intProfile, dsn); oOperatingSystems = new OperatingSystems(intProfile, dsn); btnClose.Attributes.Add("onclick", "return HidePanel();"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intCluster = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { Load(null); if (intCluster > 0) { lblName.Text = oVMWare.GetCluster(intCluster, "name"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn); oVMWare = new VMWare(intProfile, dsn); btnClose.Attributes.Add("onclick", "return HidePanel();"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { if (intID > 0) { lblName.Text = oVMWare.GetVlan(intID, "name"); } LoadClasses(); } } else { btnSave.Enabled = false; } }
public VirtualDeviceConfigSpec Disk(VMWare oVMWare, string _name, string _datastore, string _size, int _unit_number, int _controller_key, string _suffix) { // Get Datastores ManagedObjectReference datastoreRef = null; PropertySpec[] psDCarray = new PropertySpec[] { new PropertySpec() }; psDCarray[0].all = false; psDCarray[0].allSpecified = true; psDCarray[0].pathSet = new string[] { "datastore" }; psDCarray[0].type = "Datacenter"; PropertyFilterSpec spec = new PropertyFilterSpec(); spec.propSet = psDCarray; spec.objectSet = new ObjectSpec[] { new ObjectSpec() }; spec.objectSet[0].obj = oVMWare.GetDataCenter(); spec.objectSet[0].skip = true; ObjectContent[] ocary = oVMWare.GetService().RetrieveProperties(oVMWare.GetSic().propertyCollector, new PropertyFilterSpec[] { spec }); ManagedObjectReference[] datastores = null; foreach (ObjectContent oc in ocary) { datastores = (ManagedObjectReference[])oc.propSet[0].val; } if (datastores != null) { datastoreRef = datastores[0]; } // Create disk VirtualDisk disk = new VirtualDisk(); disk.key = 2000; disk.controllerKey = _controller_key; disk.controllerKeySpecified = true; disk.unitNumber = _unit_number; disk.unitNumberSpecified = true; VirtualDiskFlatVer2BackingInfo diskBack = new VirtualDiskFlatVer2BackingInfo(); diskBack.diskMode = "persistent"; diskBack.fileName = "[" + _datastore + "] " + _name.ToLower() + "/" + _name.ToLower() + _suffix + ".vmdk"; diskBack.datastore = datastoreRef; diskBack.thinProvisioned = false; diskBack.thinProvisionedSpecified = true; diskBack.writeThrough = false; diskBack.writeThroughSpecified = true; disk.backing = diskBack; disk.capacityInKB = long.Parse(_size); VirtualDeviceConfigSpec dcs = new VirtualDeviceConfigSpec(); dcs.device = disk; dcs.fileOperation = VirtualDeviceConfigSpecFileOperation.create; dcs.fileOperationSpecified = true; dcs.operation = VirtualDeviceConfigSpecOperation.add; dcs.operationSpecified = true; return(dcs); }
private void AddHosts() { VMWare oVMWare = new VMWare(intProfile, dsn); DataSet ds = oAssetSharedEnvOrder.GetHostSelection(Int32.Parse(hdnOrderId.Value)); foreach (DataRow dr in ds.Tables[0].Rows) { oVMWare.AddHost(Int32.Parse(dr["ClusterId"].ToString()), dr["Name"].ToString(), 10000, 1); } }
private void AddDataStores() { VMWare oVMWare = new VMWare(intProfile, dsn); DataSet ds = oAssetSharedEnvOrder.GetDataStoreSelection(Int32.Parse(hdnOrderId.Value)); foreach (DataRow dr in ds.Tables[0].Rows) { oVMWare.AddDatastore(Int32.Parse(dr["ClusterId"].ToString()), dr["Name"].ToString(), Int32.Parse(dr["Storage_Type"].ToString()), 0, Int32.Parse(dr["Replicated"].ToString()), 99999, 1, 0, 0, 0, 1); } }
protected void btnStep_Click(Object Sender, EventArgs e) { string strError = ""; int intWorkstation = Int32.Parse(lblWorkstation.Text); if (chkStep.Checked == true) { int intAsset2 = 0; int intStep = 0; DataSet ds = oWorkstation.GetVirtualErrors(intWorkstation); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["assetid"].ToString() != "") { intAsset2 = Int32.Parse(dr["assetid"].ToString()); } if (dr["fixed"].ToString() == "") { intStep = Int32.Parse(dr["step"].ToString()); } } if (intWorkstation > 0) { oWorkstation.UpdateVirtualError(intWorkstation, intStep, 0, 0); if (intAsset2 > 0) { string strSerial = oAsset.Get(intAsset2, "serial"); oZeus.UpdateResults(strSerial); } else { strError = "Warning: Invalid AssetID"; } } else { strError = "Error: Invalid WorkstationID"; } } if (chkStepVMWare.Checked == true) { VMWare oVMWare = new VMWare(0, dsn); int intWorkstationName = 0; Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "nameid"), out intWorkstationName); oVMWare.DeleteGuest(oWorkstation.GetName(intWorkstationName)); } oWorkstation.UpdateVirtualStep(intWorkstation, Int32.Parse(txtStep.Text)); Response.Redirect(Request.Path + "?q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&admin=true&menu_tab=6&result=" + oFunction.encryptQueryString((strError == "" ? "Success" : strError))); }
protected void Page_Load(object sender, EventArgs e) { string strResult = ""; Servers oServer = new Servers(0, dsn); OnDemand oOnDemand = new OnDemand(0, dsn); IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn); oVMWare = new VMWare(0, dsn); string strConnect = oVMWare.ConnectDEBUG("https://ohcleutl4001/sdk", 3, "Dalton"); if (strConnect == "") { VimService _service = oVMWare.GetService(); ServiceContent _sic = oVMWare.GetSic(); string strName = "txpv00001a"; ManagedObjectReference _vm_boot_order = oVMWare.GetVM(strName); OptionValue oValue = new OptionValue(); oValue.key = "bios.bootDeviceClasses"; // Set the PXE boot oValue.value = "allow:net"; // Remove the PXE boot oValue.value = ""; VirtualMachineConfigSpec _cs_boot_order = new VirtualMachineConfigSpec(); _cs_boot_order.extraConfig = new OptionValue[] { oValue }; ManagedObjectReference _task_boot_order = _service.ReconfigVM_Task(_vm_boot_order, _cs_boot_order); TaskInfo _inf_boot_order = (TaskInfo)oVMWare.getObjectProperty(_task_boot_order, "info"); while (_inf_boot_order.state == TaskInfoState.running) { _inf_boot_order = (TaskInfo)oVMWare.getObjectProperty(_task_boot_order, "info"); } if (_inf_boot_order.state == TaskInfoState.success) { strResult = "PXE Boot Forced"; } else { strResult = "PXE Boot NOT Forced"; } Response.Write(strResult); } else { Response.Write("LOGIN error"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oVMWare = new VMWare(intProfile, dsn); btnClose.Attributes.Add("onclick", "return HidePanel();"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { if (intID > 0) { lblName.Text = oVMWare.GetDatacenter(intID, "name"); } intParent = Int32.Parse(oVMWare.GetDatacenter(intID, "virtualcenterid")); rptLocations.DataSource = oVMWare.GetVirtualCentersID(intParent); rptLocations.DataBind(); lblNone.Visible = (rptLocations.Items.Count == 0); DataSet ds = oVMWare.GetDatacentersID(intID); foreach (DataRow dr in ds.Tables[0].Rows) { foreach (RepeaterItem ri in rptLocations.Items) { Label lblLocation = (Label)ri.FindControl("lblLocation"); Label lblClass = (Label)ri.FindControl("lblClass"); Label lblEnvironment = (Label)ri.FindControl("lblEnvironment"); if (lblClass.Text == dr["classid"].ToString() && lblEnvironment.Text == dr["environmentid"].ToString() && lblLocation.Text == dr["addressid"].ToString()) { CheckBox chkYes = (CheckBox)ri.FindControl("chkYes"); chkYes.Checked = true; } } } } } else { btnSave.Enabled = false; } }
private void LoadInformation() { lblView.Text = oAssetSharedEnvOrder.GetOrderBody(intRequest, intItem, intNumber); //Get the Execution Tab Details DataSet ds = oAssetSharedEnvOrder.Get(intRequest, intItem, intNumber); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; hdnOrderId.Value = dr["OrderId"].ToString(); VMWare oVMWare = new VMWare(intProfile, dsn); string strHeader = ""; if (dr["OrderType"].ToString() == "1")//Add Cluster -Get folder { strHeader = oVMWare.GetFolder(Int32.Parse(dr["ParentId"].ToString()), "name"); } else if (dr["OrderType"].ToString() == "2")//Add Host -Get Cluster { strHeader = oVMWare.GetCluster(Int32.Parse(dr["ParentId"].ToString()), "name"); } else if (dr["OrderType"].ToString() == "3")//Add Storage -Get Host { strHeader = oVMWare.GetHost(Int32.Parse(dr["ParentId"].ToString()), "name"); } LoadWMServiceTasks(); LoadDataStores(); DataSet dsDataStore = oAssetSharedEnvOrder.GetDataStoreSelection(Int32.Parse(hdnOrderId.Value)); if ((oWMServiceTasks.IsWMServiceTaskCompleted(intRequest, intService, intItem, intNumber) == false) || dsDataStore.Tables[0].Rows.Count < 1) { btnComplete.Visible = false; } else { btnComplete.Enabled = true; btnComplete.Visible = true; } } }
protected void btnAddDataStoreSelection_Click(Object Sender, EventArgs e) { //Get Parent DataSet ds = oAssetSharedEnvOrder.Get(intRequest, intItem, intNumber); int intOrderId = 0; int intOrderType = 0; int intClusterId = 0; if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; intOrderId = Int32.Parse(dr["OrderId"].ToString()); intOrderType = Int32.Parse(dr["OrderType"].ToString()); VMWare oVMWare = new VMWare(intProfile, dsn); Servers oServer = new Servers(intProfile, dsn); if (intOrderType == (int)AssetSharedEnvOrderType.AddCluster)//Add Cluster -Get folder { DataSet dsServer = oServer.GetRequests(intRequest, 0); if (dsServer.Tables[0].Rows.Count > 0) { intClusterId = Int32.Parse(dsServer.Tables[0].Rows[0]["vmware_clusterid"].ToString()); } } if (intOrderType == (int)AssetSharedEnvOrderType.AddHost || intOrderType == (int)AssetSharedEnvOrderType.AddStorage)//Add Host -Get Cluster { intClusterId = Int32.Parse(dr["ParentId"].ToString()); } oAssetSharedEnvOrder.AddDataStoreSelection( Int32.Parse(hdnOrderId.Value), intClusterId, txtDataStoreName.Text.Trim(), Int32.Parse(ddlDataStoreSelectionStorageType.SelectedValue), (chkDataStoreReplicated.Checked ? 1 : 0), intProfile); int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&div=E&save=true"); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/vmware/pools.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); if (!IsPostBack) { LoadVirtualCenters(); 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/vmware/virtual_centers.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); if (!IsPostBack) { LoopRepeater(); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); btnCancel.Attributes.Add("onclick", "return Cancel();"); btnLocations.Attributes.Add("onclick", "return OpenWindow('VMWARE_VIRTUALCENTERS','" + hdnId.ClientID + "','',false,'650',500);"); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/vmware/addhost.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); oClass = new Classes(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oServer = new Servers(intProfile, dsn); if (!IsPostBack) { LoopRepeater(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oVMWare = new VMWare(intProfile, dsn); btnClose.Attributes.Add("onclick", "return HidePanel();"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { LoadLists(); if (intID > 0) { lblName.Text = oVMWare.GetVirtualCenter(intID, "name"); } 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 + "');"); rptLocations.DataSource = oVMWare.GetVirtualCentersID(intID); rptLocations.DataBind(); lblNone.Visible = (rptLocations.Items.Count == 0); foreach (RepeaterItem ri in rptLocations.Items) { ((LinkButton)ri.FindControl("btnDelete")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); } } } else { btnAdd.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/vmware_templates.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); if (!IsPostBack) { LoopRepeater(); btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=VMWARE_TEMPLATE" + "',false,400,400);"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); btnCancel.Attributes.Add("onclick", "return Cancel();"); btnClassEnvironment.Attributes.Add("onclick", "return OpenWindow('VMWARETEMPLATECLASSENVIRONMENTS','" + hdnId.ClientID + "','',false,'500',500);"); } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPage = new Pages(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"] != "") { intId = Int32.Parse(Request.QueryString["id"]); } btnMoveGuest.Attributes.Add("onclick", "return ValidateDropDown('" + ddlHost.ClientID + "','Please select a host') && CheckSelectedGuests('');"); btnDecommissionGuests.Attributes.Add("onclick", "return CheckSelectedGuests('NOTE: This will turn off and decommission the guest immediately');"); btnDeleteWOdecommissionGuest.Attributes.Add("onclick", "return CheckSelectedGuests('NOTE: If the guests exist on a MS Virtual Workstation Host, they will not be removed');"); btnExpandCollapseTree.Attributes.Add("onclick", "return expandcollapseTreeNodes('" + tvVirtualHostnGuests.ClientID + "');"); if (!Page.IsPostBack) { } oVMWare = new VMWare(intProfile, dsn); ds = oVMWare.GetVirtualHostAndGuests(); //Load virtual host and guests LoadControls(); }
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(); } }
protected void Page_Load(object sender, EventArgs e) { oWorkstation = new Workstations(intProfile, dsn); oServer = new Servers(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oVMWare = new VMWare(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset, dsn); oError = new Errors(intProfile, dsn); oZeus = new Zeus(intProfile, dsnZeus); oVariable = new Variables(intEnvironment); oOperatingSystem = new OperatingSystems(intProfile, dsn); lblTitle.Text = "Provisioning Issue"; string strUser = Request.ServerVariables["logon_user"]; strUser = strUser.Substring(strUser.LastIndexOf("\\") + 1); intUser = oUser.GetId(strUser); if (intUser > 0) { if (Request.QueryString["fixed"] != null && Request.QueryString["fixed"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "fixed", "<script type=\"text/javascript\">alert('The issue has been saved and the device is queued to continue.\\n\\nThis window will now be closed.');window.close();<" + "/" + "script>"); } if (Request.QueryString["type"] != null && Request.QueryString["id"] != null) { try { intID = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["id"])); } catch { intID = 0; } if (intID > 0) { if (!IsPostBack) { bool boolVMware = false; if (Request.QueryString["type"] == "s") { lblType.Text = "Server"; lblLabel.Text = "Design ID:"; DataSet ds = oServer.GetErrors(intID); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["fixed"].ToString() == "") { lblName.Text = dr["servername"].ToString(); lblDate.Text = dr["created"].ToString(); lblIssue.Text = dr["reason"].ToString(); int intServer = 0; if (dr["serverid"].ToString() != "") { intServer = Int32.Parse(dr["serverid"].ToString()); } if (intServer > 0) { int intOS = 0; Int32.TryParse(oServer.Get(intServer, "osid"), out intOS); lblOS.Text = oOperatingSystem.Get(intOS, "name"); lblValue.Text = oServer.Get(intServer, "answerid"); } int intAsset = 0; if (dr["assetid"].ToString() != "") { intAsset = Int32.Parse(dr["assetid"].ToString()); } lblAsset.Text = intAsset.ToString(); lblStep.Text = dr["step"].ToString(); if (intAsset != 0) { string strILO = oAsset.GetServerOrBlade(intAsset, "ilo"); if (strILO != "") { panVMwareNo.Visible = true; lblConsole.Text = "<a href=\"https://" + strILO + "\" target=\"_blank\">" + strILO + "</a>"; } else { boolVMware = true; } } } } // Load Existing Errors Tab oTab = new Tab("", 0, "divMenu1", true, false); rptRelated.DataSource = oError.Gets(lblIssue.Text, intUser); rptRelated.DataBind(); int intTab = 0; foreach (RepeaterItem ri in rptRelated.Items) { intTab++; oTab.AddTab("Solution # " + intTab.ToString(), ""); ((Button)ri.FindControl("btnSelect")).Attributes.Add("onclick", "return confirm('Are you sure you want to select this solution as the fix?');"); Label lblAttach = (Label)ri.FindControl("lblAttach"); Panel panAttach = (Panel)ri.FindControl("panAttach"); if (lblAttach.Text != "") { panAttach.Visible = true; string strAttach = lblAttach.Text; if (strAttach.Contains("\\") == true) { strAttach = strAttach.Substring(strAttach.LastIndexOf("\\") + 1); } lblAttach.Text = "<a href=\"" + lblAttach.Text + "\" target=\"_blank\">" + strAttach + "</a>"; } } strMenuTab1 = oTab.GetTabs(); trNone.Visible = (rptRelated.Items.Count == 0); } else if (Request.QueryString["type"] == "w") { if (!IsPostBack) { lblType.Text = "Workstation"; lblLabel.Text = "Request ID:"; DataSet ds = oWorkstation.GetVirtualErrors(intID); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["fixed"].ToString() == "") { lblName.Text = dr["workstationname"].ToString(); lblDate.Text = dr["created"].ToString(); lblIssue.Text = dr["reason"].ToString(); int intWorkstation = 0; if (dr["workstationid"].ToString() != "") { intWorkstation = Int32.Parse(dr["workstationid"].ToString()); } if (intWorkstation > 0) { int intOS = 0; Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "osid"), out intOS); lblOS.Text = oOperatingSystem.Get(intOS, "name"); lblValue.Text = oWorkstation.GetVirtual(intWorkstation, "requestid"); } int intAsset = 0; if (dr["assetid"].ToString() != "") { intAsset = Int32.Parse(dr["assetid"].ToString()); } lblAsset.Text = intAsset.ToString(); lblStep.Text = dr["step"].ToString(); boolVMware = true; } } // Load Existing Errors Tab oTab = new Tab("", 0, "divMenu1", true, false); rptRelated.DataSource = oError.Gets(lblError.Text, 0); rptRelated.DataBind(); int intTab = 0; foreach (RepeaterItem ri in rptRelated.Items) { intTab++; oTab.AddTab("Solution # " + intTab.ToString(), ""); ((Button)ri.FindControl("btnSelect")).Attributes.Add("onclick", "return confirm('Are you sure you want to select this solution as the fix?');"); Label lblAttach = (Label)ri.FindControl("lblAttach"); Panel panAttach = (Panel)ri.FindControl("panAttach"); if (lblAttach.Text != "") { panAttach.Visible = true; string strAttach = lblAttach.Text; if (strAttach.Contains("\\") == true) { strAttach = strAttach.Substring(strAttach.LastIndexOf("\\") + 1); } lblAttach.Text = "<a href=\"" + lblAttach.Text + "\" target=\"_blank\">" + strAttach + "</a>"; } } strMenuTab1 = oTab.GetTabs(); trNone.Visible = (rptRelated.Items.Count == 0); } } if (boolVMware == true) { panVMware.Visible = true; DataSet dsGuest = oVMWare.GetGuest(lblName.Text); if (dsGuest.Tables[0].Rows.Count > 0) { DataRow drGuest = dsGuest.Tables[0].Rows[0]; int intDatastore = Int32.Parse(drGuest["datastoreid"].ToString()); lblDataStore.Text = oVMWare.GetDatastore(intDatastore, "name"); int intHost = Int32.Parse(drGuest["hostid"].ToString()); int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid")); lblCluster.Text = oVMWare.GetCluster(intCluster, "name"); int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid")); lblFolder.Text = oVMWare.GetFolder(intFolder, "name"); int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid")); lblDataCenter.Text = oVMWare.GetDatacenter(intDataCenter, "name"); int intVirtualCenter = Int32.Parse(oVMWare.GetDatacenter(intDataCenter, "virtualcenterid")); lblVirtualCenter.Text = oVMWare.GetVirtualCenter(intVirtualCenter, "name"); } } if (lblName.Text == "") { lblError.Text = "This device is not experiencing any provisioning issues at the moment (" + intID.ToString() + ")"; } // Load the case codes ddlCode.DataTextField = "name"; ddlCode.DataValueField = "id"; ddlCode.DataSource = oError.GetTypeTypes(2, 1); ddlCode.DataBind(); ddlCode.Items.Insert(0, new ListItem("-- SELECT --", "0")); } } else { lblError.Text = "Could not find record"; } } else { lblError.Text = "Invalid Parameter(s)"; } } else { lblError.Text = "Could not find a user account for userID = " + strUser; } if (lblError.Text == "") { panIssue.Visible = true; btnFixed.Attributes.Add("onclick", "return ValidateText('" + txtIssue.ClientID + "','Please enter the issue') && ValidateText('" + txtResolution.ClientID + "','Please enter the resolution') && ValidateDropDown('" + ddlCode.ClientID + "','Please select a case code') && confirm('Are you sure you want to mark this error as fixed?') && ProcessButton(this);"); radNew.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','inline');ShowHideDiv('" + divExisting.ClientID + "','none');"); radExisting.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','none');ShowHideDiv('" + divExisting.ClientID + "','inline');"); } else { panDenied.Visible = true; btnClose.Attributes.Add("onclick", "window.close();"); } }
protected void Page_Load(object sender, EventArgs e) { string strNetwork = "Desktop"; if (string.IsNullOrEmpty(Request.QueryString["n"]) == false) { strNetwork = Request.QueryString["n"]; } string strPortGroup = "dvPortGroupVLAN1000"; if (string.IsNullOrEmpty(Request.QueryString["g"]) == false) { strPortGroup = Request.QueryString["g"]; } Servers oServer = new Servers(0, dsn); OnDemand oOnDemand = new OnDemand(0, dsn); IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn); oVMWare = new VMWare(0, dsn); string strConnect = oVMWare.ConnectDEBUG("https://wssvt350a.pncbank.com/sdk", 999, "PNC-Pittsburgh"); if (strConnect == "") { VimService _service = oVMWare.GetService(); ServiceContent _sic = oVMWare.GetSic(); ManagedObjectReference datacenterRef = oVMWare.GetDataCenter(); ManagedObjectReference netFolderRef = (ManagedObjectReference)oVMWare.getObjectProperty(datacenterRef, "networkFolder"); ManagedObjectReference[] netList = (ManagedObjectReference[])oVMWare.getObjectProperty(netFolderRef, "childEntity"); ManagedObjectReference net = null; foreach (ManagedObjectReference network in netList) { if (((string)oVMWare.getObjectProperty(network, "name")) == strNetwork) { net = network; break; } } if (net != null) { ManagedObjectReference[] switchList = (ManagedObjectReference[])oVMWare.getObjectProperty(net, "childEntity"); foreach (ManagedObjectReference swit in switchList) { try { if (((string)oVMWare.getObjectProperty(swit, "name")) == strPortGroup) { DVPortgroupConfigInfo pgConfig = (DVPortgroupConfigInfo)oVMWare.getObjectProperty(swit, "config"); Response.Write("Num Ports = " + pgConfig.numPorts.ToString() + "<br/>"); ManagedObjectReference[] pgVM = (ManagedObjectReference[])oVMWare.getObjectProperty(swit, "vm"); Response.Write("Num Machines = " + pgVM.Length.ToString() + "<br/>"); int intAvailable = pgConfig.numPorts - pgVM.Length; Response.Write("Ports Available = " + intAvailable.ToString() + "<br/>"); break; } } catch { } } } // ManagedObjectReference[] oDatastores = oVMWare.GetDatastores("ohclexcv4004"); // foreach (ManagedObjectReference oDataStore in oDatastores) // { // DatastoreSummary oSummary = (DatastoreSummary)oVMWare.getObjectProperty(oDataStore, "summary"); // double oAvailable = double.Parse(oSummary.capacity.ToString()); // oAvailable = oAvailable / 1024.00; // oAvailable = oAvailable / 1024.00; // oAvailable = oAvailable / 1024.00; // double oFree = double.Parse(oSummary.freeSpace.ToString()); // oFree = oFree / 1024.00; // oFree = oFree / 1024.00; // oFree = oFree / 1024.00; // Response.Write(oSummary.name + " = " + oFree.ToString("F") + " GB / " + oAvailable.ToString("F") + " GB<br/>"); // } } else { Response.Write("LOGIN error"); } }
private bool LoadInformation(int _request_workflow) { if (intProject > 0) { lblName.Text = oProject.Get(intProject, "name"); lblNumber.Text = oProject.Get(intProject, "number"); lblType.Text = "Project"; } else { lblName.Text = oResourceRequest.GetWorkflow(_request_workflow, "name"); lblNumber.Text = "CVT" + intRequest.ToString(); lblType.Text = "Task"; } bool boolDone = false; DataSet ds = oOnDemandTasks.GetVMWareII(intRequest, intItem, intNumber); if (ds.Tables[0].Rows.Count > 0) { Forecast oForecast = new Forecast(intProfile, dsn); int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); if (oForecast.IsHARoom(intAnswer) == true) { DataSet dsServer = oServer.GetAnswer(intAnswer); foreach (DataRow drServer in dsServer.Tables[0].Rows) { int intHA = Int32.Parse(drServer["id"].ToString()); DataSet dsHA = oServer.GetHA(intHA); if (dsHA.Tables[0].Rows.Count > 0) { if (lblHA.Text != "") { lblHA.Text += "<br/>"; } lblHA.Text += oServer.GetName(intHA, true) + " = " + oServer.GetName(Int32.Parse(dsHA.Tables[0].Rows[0]["serverid_ha"].ToString()), true); panHA.Visible = true; } } } lblAnswer.Text = intAnswer.ToString(); btnView.Attributes.Add("onclick", "return OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');"); btnBirth.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');"); btnSC.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');"); lblView.Text = oOnDemandTasks.GetBody(intAnswer, intImplementorDistributed, intImplementorMidrange); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); Models oModel = new Models(intProfile, dsn); int intType = Int32.Parse(oModel.Get(intModel, "typeid")); Types oType = new Types(intProfile, dsn); string strExecute = oType.Get(intType, "forecast_execution_path"); if (strExecute != "") { btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');"); } chk1.Checked = (ds.Tables[0].Rows[0]["chk1"].ToString() == "1"); chk3.Checked = (ds.Tables[0].Rows[0]["chk3"].ToString() == "1"); chk4.Checked = (ds.Tables[0].Rows[0]["chk4"].ToString() == "1"); chk5.Checked = (ds.Tables[0].Rows[0]["chk5"].ToString() == "1"); chk6.Checked = (ds.Tables[0].Rows[0]["chk6"].ToString() == "1"); chk7.Checked = (ds.Tables[0].Rows[0]["chk7"].ToString() == "1"); chk8.Checked = (ds.Tables[0].Rows[0]["chk8"].ToString() == "1"); chk9.Checked = (ds.Tables[0].Rows[0]["chk9"].ToString() == "1"); chk10.Checked = (ds.Tables[0].Rows[0]["chk10"].ToString() == "1"); chk11.Checked = (ds.Tables[0].Rows[0]["chk11"].ToString() == "1"); int intNotifications = Int32.Parse(ds.Tables[0].Rows[0]["notifications"].ToString()); int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")); if (oClass.Get(intClass, "prod") != "1") { chk9.Checked = true; img9.ImageUrl = "/images/cancel.gif"; chk10.Checked = true; img10.ImageUrl = "/images/cancel.gif"; chk11.Checked = true; img11.ImageUrl = "/images/cancel.gif"; } boolDone = (chk1.Checked && chk3.Checked && chk4.Checked && chk5.Checked && chk6.Checked && chk7.Checked && chk8.Checked && chk9.Checked && chk10.Checked && chk11.Checked); img1.ImageUrl = "/images/green_arrow.gif"; if (chk1.Checked == true) { btnExecute.Enabled = false; img1.ImageUrl = "/images/check.gif"; img3.ImageUrl = "/images/green_arrow.gif"; chk3.Enabled = true; Servers oServer = new Servers(intProfile, dsn); DataSet dsAnswer = oServer.GetAnswer(intAnswer); foreach (DataRow drAnswer in dsAnswer.Tables[0].Rows) { if (lbl1.Text != "") { lbl1.Text += "<br/>"; } int intServer = Int32.Parse(drAnswer["id"].ToString()); int intServerName = Int32.Parse(drAnswer["nameid"].ToString()); ServerName oServerName = new ServerName(0, dsn); string strName = oServer.GetName(intServer, boolUsePNCNaming); lbl1.Text += "Server Name: " + strName + "<br/>"; Zeus oZeus = new Zeus(intProfile, dsnZeus); DataSet dsZeus = oZeus.GetBuildServer(intServer); if (dsZeus.Tables[0].Rows.Count > 0) { lbl1.Text += "Serial Number: " + dsZeus.Tables[0].Rows[0]["serial"].ToString() + "<br/>"; lbl1.Text += "Asset Tag: " + dsZeus.Tables[0].Rows[0]["asset"].ToString() + "<br/>"; } int intDomain = Int32.Parse(drAnswer["domainid"].ToString()); Domains oDomain = new Domains(intProfile, dsn); boolMove = (oDomain.Get(intDomain, "move") == "1"); if (boolMove == true) { lbl1.Text += "DHCP Address: " + drAnswer["dhcp"].ToString() + "<br/>"; } int intIPAddress = 0; IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn); lbl1.Text += "Assigned IP Address: " + oServer.GetIPs(intServer, 1, 0, 0, dsnIP, "", "") + "<br/>"; lbl1.Text += "Final IP Address: " + oServer.GetIPs(intServer, 0, 1, 0, dsnIP, "", "") + "<br/>"; Asset oAsset = new Asset(intProfile, dsnAsset); VMWare oVMWare = new VMWare(intProfile, dsn); int intAsset = 0; if (drAnswer["assetid"].ToString() != "") { intAsset = Int32.Parse(drAnswer["assetid"].ToString()); } if (intAsset > 0) { DataSet dsGuest = oVMWare.GetGuest(strName); if (dsGuest.Tables[0].Rows.Count > 0) { int intHost = Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString()); int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid")); int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid")); int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid")); lbl1.Text += "DataCenter: " + oVMWare.GetDatacenter(intDataCenter, "name") + "<br/>"; lbl1.Text += "Host: " + oVMWare.GetHost(intHost, "name") + "<br/>"; int intDatastore = Int32.Parse(dsGuest.Tables[0].Rows[0]["datastoreid"].ToString()); lbl1.Text += "DataStore: " + oVMWare.GetDatastore(intDatastore, "name") + "<br/>"; int intPool = Int32.Parse(dsGuest.Tables[0].Rows[0]["poolid"].ToString()); //lbl1.Text += "Pool: " + oVMWare.GetPool(intPool, "name") + "<br/>"; int intVlan = Int32.Parse(dsGuest.Tables[0].Rows[0]["vlanid"].ToString()); lbl1.Text += "VLAN: " + oVMWare.GetVlan(intVlan, "name") + "<br/>"; } } Storage oStorage = new Storage(intProfile, dsn); int intCluster2 = Int32.Parse(drAnswer["clusterid"].ToString()); int intCSMConfig2 = Int32.Parse(drAnswer["csmconfigid"].ToString()); int intNumber2 = Int32.Parse(drAnswer["number"].ToString()); DataSet dsLuns = oStorage.GetLuns(intAnswer, 0, intCluster2, intCSMConfig2, intNumber2); StringBuilder sbStorage = new StringBuilder(); int intRow = 0; bool boolOverride = (oForecast.GetAnswer(intAnswer, "storage_override") == "1"); foreach (DataRow drLun in dsLuns.Tables[0].Rows) { intRow++; sbStorage.Append("<tr>"); sbStorage.Append("<td>"); sbStorage.Append(intRow.ToString()); sbStorage.Append("</td>"); string strLetter = drLun["letter"].ToString(); if (strLetter == "") { if (drLun["driveid"].ToString() == "-1000") { strLetter = "E"; } else if (drLun["driveid"].ToString() == "-100") { strLetter = "F"; } else if (drLun["driveid"].ToString() == "-10") { strLetter = "P"; } else if (drLun["driveid"].ToString() == "-1") { strLetter = "Q"; } } if ((boolOverride == true && drLun["driveid"].ToString() == "0") || oForecast.IsOSMidrange(intAnswer) == true) { sbStorage.Append("<td>"); sbStorage.Append(drLun["path"].ToString()); sbStorage.Append("</td>"); } else { sbStorage.Append("<td>"); sbStorage.Append(strLetter); sbStorage.Append(":"); sbStorage.Append(drLun["path"].ToString()); sbStorage.Append("</td>"); } sbStorage.Append("<td>"); sbStorage.Append(drLun["performance"].ToString()); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["size"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_size"].ToString() == "-1" ? "Pending" : drLun["actual_size"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["size_qa"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_size_qa"].ToString() == "-1" ? "Pending" : drLun["actual_size_qa"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["size_test"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_size_test"].ToString() == "-1" ? "Pending" : drLun["actual_size_test"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["replicated"].ToString() == "0" ? "No" : "Yes"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_replicated"].ToString() == "-1" ? "Pending" : (drLun["actual_replicated"].ToString() == "0" ? "No" : "Yes")); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["size"].ToString() + " GB)"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_high_availability"].ToString() == "-1" ? "Pending" : (drLun["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["actual_size"].ToString() + " GB)")); sbStorage.Append("</td>"); sbStorage.Append("</tr>"); DataSet dsPoints = oStorage.GetMountPoints(Int32.Parse(drLun["id"].ToString())); int intPoint = 0; foreach (DataRow drPoint in dsPoints.Tables[0].Rows) { intRow++; intPoint++; sbStorage.Append("<tr>"); sbStorage.Append("<td>"); sbStorage.Append(intRow.ToString()); sbStorage.Append("</td>"); if (oForecast.IsOSMidrange(intAnswer) == true) { sbStorage.Append("<td>"); sbStorage.Append(drPoint["path"].ToString()); sbStorage.Append("</td>"); } else { sbStorage.Append("<td>"); sbStorage.Append(strLetter); sbStorage.Append(":\\SH"); sbStorage.Append(drLun["driveid"].ToString()); sbStorage.Append("VOL"); sbStorage.Append(intPoint < 10 ? "0" : ""); sbStorage.Append(intPoint.ToString()); sbStorage.Append("</td>"); } sbStorage.Append("<td>"); sbStorage.Append(drPoint["performance"].ToString()); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["size"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_size"].ToString() == "-1" ? "Pending" : drPoint["actual_size"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["size_qa"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_size_qa"].ToString() == "-1" ? "Pending" : drPoint["actual_size_qa"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["size_test"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_size_test"].ToString() == "-1" ? "Pending" : drPoint["actual_size_test"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["replicated"].ToString() == "0" ? "No" : "Yes"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_replicated"].ToString() == "-1" ? "Pending" : (drPoint["actual_replicated"].ToString() == "0" ? "No" : "Yes")); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["size"].ToString() + " GB)"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_high_availability"].ToString() == "-1" ? "Pending" : (drPoint["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["actual_size"].ToString() + " GB)")); sbStorage.Append("</td>"); sbStorage.Append("</tr>"); } } if (sbStorage.ToString() != "") { sbStorage.Insert(0, "<tr class=\"bold\"><td></td><td>Path</td><td>Performance</td><td>Requested<br/>Size in Prod</td><td>Actual<br/>Size in Prod</td><td>Requested<br/>Size in QA</td><td>Actual<br/>Size in QA</td><td>Requested<br/>Size in Test</td><td>Actual<br/>Size in Test</td><td>Requested<br/>Replication</td><td>Actual<br/>Replication</td><td>Requested<br/>High Availability</td><td>Actual<br/>High Availability</td></tr>"); sbStorage.Insert(0, "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">"); sbStorage.Append("</table>"); } lbl1.Text += sbStorage.ToString(); } } if (chk3.Checked == true) { img3.ImageUrl = "/images/check.gif"; img4.ImageUrl = "/images/green_arrow.gif"; chk4.Enabled = true; } if (chk4.Checked == true) { img4.ImageUrl = "/images/check.gif"; if (boolMove == true) { img5.ImageUrl = "/images/green_arrow.gif"; chk5.Enabled = true; } else { chk5.Checked = true; img7.ImageUrl = "/images/green_arrow.gif"; chk7.Enabled = true; } } if (chk5.Checked == true) { if (boolMove == true) { img5.ImageUrl = "/images/check.gif"; } else { img5.ImageUrl = "/images/cancel.gif"; } if (boolMove == true) { img6.ImageUrl = "/images/green_arrow.gif"; chk6.Enabled = true; } } if (chk6.Checked == true) { if (boolMove == true) { img6.ImageUrl = "/images/check.gif"; } else { img6.ImageUrl = "/images/cancel.gif"; } if (boolMove == true) { img7.ImageUrl = "/images/green_arrow.gif"; chk7.Enabled = true; } } if (chk7.Checked == true) { img7.ImageUrl = "/images/check.gif"; img8.ImageUrl = "/images/green_arrow.gif"; chk8.Enabled = true; } if (chk8.Checked == true) { img8.ImageUrl = "/images/check.gif"; img9.ImageUrl = "/images/green_arrow.gif"; chk9.Enabled = true; } if (chk9.Checked == true) { img9.ImageUrl = "/images/check.gif"; img10.ImageUrl = "/images/green_arrow.gif"; chk10.Enabled = true; } if (chk10.Checked == true) { img10.ImageUrl = "/images/check.gif"; img11.ImageUrl = "/images/green_arrow.gif"; chk11.Enabled = true; } if (chk11.Checked == true) { img11.ImageUrl = "/images/check.gif"; } } if (Request.QueryString["div"] != null) { switch (Request.QueryString["div"]) { case "E": boolExecution = true; break; } } if (boolDetails == false && boolExecution == false) { boolDetails = true; } return(boolDone); }
protected void Page_Load(object sender, EventArgs e) { oVMware = new VMWare(0, dsn); }
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(); } } }
private List <VMwareDisk> Disks() { List <VMwareDisk> disks = new List <VMwareDisk>(); VMWare oVMWare = new VMWare(0, dsn); string name = "WSCLV223A"; DataSet dsGuest = oVMWare.GetGuest(name); if (dsGuest.Tables[0].Rows.Count > 0) { DataRow drGuest = dsGuest.Tables[0].Rows[0]; int intDatastore = Int32.Parse(drGuest["datastoreid"].ToString()); int intHost = Int32.Parse(drGuest["hostid"].ToString()); int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid")); int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid")); int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid")); string strDataCenter = oVMWare.GetDatacenter(intDataCenter, "name"); int intVirtualCenter = Int32.Parse(oVMWare.GetDatacenter(intDataCenter, "virtualcenterid")); string strVirtualCenter = oVMWare.GetVirtualCenter(intVirtualCenter, "name"); string strVirtualCenterURL = oVMWare.GetVirtualCenter(intVirtualCenter, "url"); int intVirtualCenterEnv = Int32.Parse(oVMWare.GetVirtualCenter(intVirtualCenter, "environment")); string strConnect = oVMWare.ConnectDEBUG(strVirtualCenterURL, intVirtualCenterEnv, strDataCenter); VimService _service = oVMWare.GetService(); ServiceContent _sic = oVMWare.GetSic(); try { ManagedObjectReference oVM = oVMWare.GetVM(name); if (oVM != null) { VirtualMachineConfigInfo vminfo = (VirtualMachineConfigInfo)oVMWare.getObjectProperty(oVM, "config"); VirtualDevice[] devices = vminfo.hardware.device; List <VMwareController> controllers = new List <VMwareController>(); foreach (VirtualDevice device in devices) { // Try to cast to Controller try { VirtualController controller = (VirtualController)device; VMwareController Controller = new VMwareController(); Controller.busNumber = controller.busNumber; Controller.key = controller.key; controllers.Add(Controller); } catch { } // Try to cast to Disk try { VirtualDisk disk = (VirtualDisk)device; bool boolShared = false; string strLunID = null; try { VirtualDiskFlatVer2BackingInfo backingNonShared = (VirtualDiskFlatVer2BackingInfo)disk.backing; boolShared = false; strLunID = ""; } catch { // Not flat disk, so don't worry about it } if (strLunID != null) { VMwareDisk Disk = new VMwareDisk(); Disk.controllerKey = disk.controllerKey; Disk.label = disk.deviceInfo.label; Disk.capacityInKB = disk.capacityInKB; Disk.unitNumber = disk.unitNumber; Disk.lunUuid = strLunID; Disk.Shared = boolShared; disks.Add(Disk); } } catch { } } Storage oStorage = new Storage(0, dsn); // Match up disks with controllers for bus numbers foreach (VMwareDisk disk in disks) { disk.capacityInKB = ((disk.capacityInKB / 1024) / 1024); // convert KB to GB foreach (VMwareController controller in controllers) { if (disk.controllerKey == controller.key) { disk.busNumber = controller.busNumber; disk.Name = disk.capacityInKB.ToString() + " GB - SCSI(" + disk.busNumber.ToString() + ":" + disk.unitNumber.ToString() + ") " + disk.label; oStorage.AddLunDisk(0, disk.busNumber, disk.unitNumber, disk.lunUuid); 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; } } } return(disks); }
protected void Page_Load(object sender, EventArgs e) { bool boolError = true; if (Request.QueryString["name"] != null && Request.QueryString["name"] != "" & Request.QueryString["token"] != null && Request.QueryString["token"] != "") { Tokens oToken = new Tokens(0, dsn); string strName = Request.QueryString["name"]; string strToken = Request.QueryString["token"]; if (oToken.Get(strName, strToken) == true) { // Delete Token oToken.Update(strName, strToken); // Render Preview VMWare oVMWare = new VMWare(0, dsn); //strName = "WDBIX103A"; string strConnect = oVMWare.Connect(strName); VimService _service = oVMWare.GetService(); if (strConnect == "") { ManagedObjectReference vmRef = oVMWare.GetVM(strName); if (vmRef.Value != null) { try { VirtualMachineMksTicket oTicket = _service.AcquireMksTicket(vmRef); string strVMHost = oTicket.host; string strVMPort = oTicket.port.ToString(); string strVMPath = oTicket.cfgFile; string strVMTicket = oTicket.ticket; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "start_count", "<script type=\"text/javascript\">window.onload = new Function(\"connect('" + strVMHost + "','" + strVMPath + "','" + strVMTicket + "','" + strVMPort + "');\");<" + "/" + "script>"); boolError = false; } catch { } } } if (_service != null) { ServiceContent _sic = oVMWare.GetSic(); _service.Abort(); if (_service.Container != null) { _service.Container.Dispose(); } try { _service.Logout(_sic.sessionManager); } catch { } _service.Dispose(); _service = null; _sic = null; } } } if (boolError == true) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "start_count", "<script type=\"text/javascript\">window.onload = new Function(\"window.parent.VMWareNoPreview();\");<" + "/" + "script>"); } }
protected void Page_Load(object sender, EventArgs e) { Servers oServer = new Servers(0, dsn); VMWare oVMWare = new VMWare(0, dsn); Forecast oForecast = new Forecast(0, dsn); Environments oEnvironment = new Environments(0, dsn); OperatingSystems oOperatingSystem = new OperatingSystems(0, dsn); Classes oClass = new Classes(0, dsn); Requests oRequest = new Requests(0, dsn); Projects oProject = new Projects(0, dsn); ServerName oServerName = new ServerName(0, dsn); Locations oLocations = new Locations(0, dsn); ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); ServicePacks oServicePacks = new ServicePacks(0, dsn); Users oUser = new Users(0, dsn); Organizations oOrganization = new Organizations(0, dsn); IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn); ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); Domains oDomains = new Domains(0, dsn); oVariables = new Variables(intEnvironment); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { StringBuilder sbTable = new StringBuilder(strTable); int intServer = Int32.Parse(Request.QueryString["id"]); DataSet ds = oServer.Get(intServer); if (ds.Tables[0].Rows.Count > 0) { int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); int intName = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString()); string strName = oServer.GetName(intServer, boolUsePNCNaming); int intForecast = Int32.Parse(oForecast.GetAnswer(intAnswer, "forecastid")); int intRequest = Int32.Parse(oForecast.Get(intForecast, "requestid")); int intProject = oRequest.GetProjectNumber(intRequest); int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")); int intEnv = Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); string _save_location = oVariables.UploadsFolder() + "SC\\"; string strFileName = "SC_" + intServer.ToString() + "_" + oProject.Get(intProject, "number") + ".HTM"; if (Directory.Exists(_save_location) == false) { Directory.CreateDirectory(_save_location); } string strFile = _save_location + strFileName; StreamWriter fp = File.CreateText(strFile); string strDefault = "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">"; StringBuilder sbLeft1 = new StringBuilder(); string strLead = oProject.Get(intProject, "lead"); int intLead = 0; if (strLead != "") { intLead = Int32.Parse(strLead); } sbLeft1.Append("<fieldset>"); sbLeft1.Append("<legend><b>Who is this for?</b></legend>"); sbLeft1.Append(strDefault); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client XID:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Name:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Phone No.:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Department:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox("", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Fax:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox("", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Cost Center:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox("", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("</table>"); sbLeft1.Append("</fieldset>"); StringBuilder sbRight1 = new StringBuilder(); string strIE = oProject.Get(intProject, "engineer"); int intIE = 0; if (strIE != "") { intIE = Int32.Parse(strIE); } sbRight1.Append("<fieldset>"); sbRight1.Append("<legend><b>Requestor Information</b></legend>"); sbRight1.Append(strDefault); sbRight1.Append("<tr>"); sbRight1.Append("<td>Requested By Name:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox(intIE > 0 ? oUser.GetFullName(intIE) : "***ERROR**", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("<tr>"); sbRight1.Append("<td>Requested By Phone No.:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox(intIE > 0 ? oUser.Get(intIE, "phone") : "***ERROR**", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("<tr>"); sbRight1.Append("<td>Requested By Email:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox(intIE > 0 ? oUser.GetEmail(oUser.GetName(intIE), intEnvironment) : "***ERROR**", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("</table>"); sbRight1.Append("</fieldset>"); sbRight1.Append("<fieldset>"); sbRight1.Append("<legend><b>Location Information:</b></legend>"); sbRight1.Append(strDefault); sbRight1.Append("<tr>"); sbRight1.Append("<td>Location:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox("", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("<tr>"); sbRight1.Append("<td>Location Full Name:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox("", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("</table>"); sbRight1.Append("</fieldset>"); StringBuilder sbCenter1 = new StringBuilder(); sbCenter1.Append("<fieldset>"); sbCenter1.Append("<legend><b>Brief Desc:</b></legend>"); sbCenter1.Append(strDefault); sbCenter1.Append("<tr>"); sbCenter1.Append("<td>"); sbCenter1.Append(GetBox(oForecast.GetAnswer(intAnswer, "name") + " (" + strName + ")", 600)); sbCenter1.Append("</td>"); sbCenter1.Append("</tr>"); sbCenter1.Append("</table>"); sbCenter1.Append("</fieldset>"); StringBuilder sbLeft2 = new StringBuilder(); sbLeft2.Append("<fieldset>"); sbLeft2.Append("<legend><b>Project Information:</b></legend>"); sbLeft2.Append(strDefault); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project ID:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(oProject.Get(intProject, "number"), 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager XID:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project Name:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(oProject.Get(intProject, "name"), 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager Name:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project Budgeted:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(oProject.Get(intProject, "bd"), 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager Phone:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project Cost Ctr:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox("", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager Email:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetEmail(oUser.GetName(intLead), intEnvironment) : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("</table>"); sbLeft2.Append("</fieldset>"); OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn); int intImplementor = 0; DataSet dsTasks = oOnDemandTasks.GetPending(intAnswer); if (dsTasks.Tables[0].Rows.Count > 0) { intImplementor = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString()); intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intImplementor, "userid")); } else { intImplementor = -999; } sbTable = new StringBuilder("<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><b>NOTE:</b> ASSIGN THIS REQUEST TO: "); sbTable.Append(intImplementor > 0 || intImplementor == -999 ? oUser.GetFullName(intImplementor) + " (" + oUser.GetName(intImplementor) + ")" : "***ERROR**"); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(sbLeft1.ToString()); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(sbRight1.ToString()); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(sbCenter1.ToString()); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(sbLeft2.ToString()); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><p> </p></td>"); sbTable.Append("</tr>"); bool boolVirtual = false; if (boolVirtual == true) { sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION VIRTUAL SERVER GUEST</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Requested Server Completion Date:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Hardware Specifications:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("VIRTUAL SERVER GUEST VMWARE", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Operating System:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Environment:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Class:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Domain:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Backup Method:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TSM", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); string strHost = "***ERROR***"; DataSet dsGuest = oVMWare.GetGuest(strName); if (dsGuest.Tables[0].Rows.Count > 0) { strHost = oVMWare.GetHost(Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString()), "name").ToUpper(); } sbTable.Append("<tr>"); sbTable.Append("<td>Host Server Name:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(strHost, 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>"); sbTable.Append("</tr>"); bool boolSQL = false; bool boolIIS = false; DataSet dsComp = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow drComp in dsComp.Tables[0].Rows) { if (drComp["code"].ToString() == "IIS") { boolIIS = true; } if (drComp["code"].ToString() == "SQL") { boolSQL = true; } } sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TCP/IP", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Attached to SAN?:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server is Clustered:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Load Balanced:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Maximum Allowable Downtime:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("Not Applicable", 150) + "</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(GetBox("", 500)); sbTable.Append("</td>"); sbTable.Append("</tr>"); } else { sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION SERVER</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Requested Server Completion Date:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Hardware Specifications:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oModelsProperties.Get(intModel, "name"), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\" checked/> User re-deployable hardware if applicable</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>PO:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Operating System:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Environment:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Class:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Domain:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Location:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oLocations.GetFull(Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid"))).ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Backup Method:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TSM", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>"); sbTable.Append("</tr>"); bool boolSQL = false; bool boolIIS = false; DataSet dsComp = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow drComp in dsComp.Tables[0].Rows) { if (drComp["code"].ToString() == "IIS") { boolIIS = true; } if (drComp["code"].ToString() == "SQL") { boolSQL = true; } } sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TCP/IP", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Attached to SAN?:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server is Clustered:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Load Balanced:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Maximum Allowable Downtime:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("Not Applicable", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(GetBox("", 500)); sbTable.Append("</td>"); sbTable.Append("</tr>"); } sbTable.Append("</table>"); fp.WriteLine("<html>"); fp.WriteLine("<head>"); fp.WriteLine("<title>ClearView | Service Center Request Form</title>"); fp.WriteLine("<style type=\"text/css\">"); fp.WriteLine(".default {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;}"); fp.WriteLine(".header {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 16px;font-style: italic;font-weight: bold;}"); fp.WriteLine("</style>"); fp.WriteLine("<body leftmargin=\"0\" topmargin=\"0\">"); fp.WriteLine(sbTable.ToString()); fp.WriteLine("</body>"); fp.WriteLine("</html>"); fp.Close(); } strTable = sbTable.ToString(); } }
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); oAssetSharedEnvOrder = new AssetSharedEnvOrder(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); oVMWare = new VMWare(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"]); } if (intPlatform != 0) { pnlOrder.Visible = true; if (!IsPostBack) { PopulateLocations(); AddControlsAttributes(); LoadLists(intPlatform); LoadOS(); 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"]; LoadRequest(); } else { hdnOrderId.Value = Request.QueryString["orderid"]; LoadRequest(); } } } else { PopulateLocations(); Page.ClientScript.RegisterStartupScript(typeof(Page), "loadCurrentTab", "<script type=\"text/javascript\">window.top.LoadCurrentTab();<" + "/" + "script>"); } } else { pnlDenied.Visible = true; } }