protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/virtual_hdd.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"); } oVirtualHDD = new VirtualHDD(intProfile, dsn); if (!IsPostBack) { LoopRepeater(); btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=VIRTUAL_HDD" + "',false,400,400);"); 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) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPage = new Pages(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oClass = new Classes(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oOperatingSystems = new OperatingSystems(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(intProfile, dsn); oVirtualCPU = new VirtualCPU(intProfile, dsn); oService = new Services(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); 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["denied"] != null) { boolReqDenied = true; } if (Request.QueryString["rid"] != "" && Request.QueryString["rid"] != null) { if (!IsPostBack) { LoadLists(); } panNavigation.Visible = true; LoadValues(); int intItem = Int32.Parse(lblItem.Text); int intService = Int32.Parse(lblService.Text); int intApp = oRequestItem.GetItemApplication(intItem); string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); if (strDeliverable != "") { btnDeliverable.Visible = true; btnDeliverable.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','" + strDeliverable + "');"); } if (Request.QueryString["qty"] != null && Request.QueryString["qty"] != "") { if (Request.QueryString["qty"] == intMaxWorkstationsPerDay.ToString()) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations and cannot be allocated additional hardware until tomorrow.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else if (Request.QueryString["qty"] == "0") { int intDiff = intMaxWorkstationsPerDay - Int32.Parse(Request.QueryString["qty"]); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations. Please enter a quantity of " + intDiff.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nPlease enter a quantity of " + intMaxWorkstationsPerDay.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } } else if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); if (!IsPostBack) { DataSet dsAnswer = oForecast.GetAnswer(intAnswer); if (dsAnswer.Tables[0].Rows.Count > 0) { txtName.Text = dsAnswer.Tables[0].Rows[0]["name"].ToString(); ddlLocation.SelectedValue = dsAnswer.Tables[0].Rows[0]["addressid"].ToString(); ddlClass.SelectedValue = dsAnswer.Tables[0].Rows[0]["classid"].ToString(); txtQuantity.Text = dsAnswer.Tables[0].Rows[0]["quantity"].ToString(); dsAnswer = oForecast.GetWorkstation(intAnswer); if (dsAnswer.Tables[0].Rows.Count > 0) { ddlOS.SelectedValue = dsAnswer.Tables[0].Rows[0]["osid"].ToString(); ChangeOS(); chkDR.Checked = (dsAnswer.Tables[0].Rows[0]["recovery"].ToString() == "1"); radEmployee.SelectedValue = dsAnswer.Tables[0].Rows[0]["internal"].ToString(); ddlRam.SelectedValue = dsAnswer.Tables[0].Rows[0]["ramid"].ToString(); ddlHardDrive.SelectedValue = dsAnswer.Tables[0].Rows[0]["hddid"].ToString(); ddlCPU.SelectedValue = dsAnswer.Tables[0].Rows[0]["cpuid"].ToString(); } } } if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "") { panUpdate.Visible = true; panNavigation.Visible = false; if (boolReqDenied) { int intRequest = Int32.Parse(Request.QueryString["rid"]); int intNumber = Int32.Parse(lblNumber.Text); DataSet dsSelected2 = oService.GetSelected(intRequest, intService, intNumber); for (int ii = intNumber; ii > 0 && dsSelected2.Tables[0].Rows.Count == 0; ii--) { dsSelected2 = oService.GetSelected(intRequest, intService, ii - 1); } if (dsSelected2.Tables[0].Rows.Count > 0) { if (Int32.Parse(dsSelected2.Tables[0].Rows[0]["approved"].ToString()) < 0) { // Rejected lblReqDenyCommentValue.Text = oFunction.FormatText(dsSelected2.Tables[0].Rows[0]["reason"].ToString()); pnlReqDenied.Visible = true; } } } } } else { string strFormID = ""; if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "") { strFormID = "&formid=" + Request.QueryString["formid"]; } string strNumID = ""; if (Request.QueryString["num"] != null && Request.QueryString["num"] != "") { strNumID = "&num=" + Request.QueryString["num"]; } string strDenied = ""; if (Request.QueryString["denied"] != null && Request.QueryString["denied"] != "") { strDenied = "&denied=" + Request.QueryString["denied"]; } DataSet dsService = oForecast.GetAnswerService(Int32.Parse(Request.QueryString["rid"])); if (dsService.Tables[0].Rows.Count > 0) { Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + Request.QueryString["rid"] + strFormID + strNumID + strDenied + "&aid=" + dsService.Tables[0].Rows[0]["id"].ToString()); } } btnNext.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" + " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" + " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an Operating System')" + " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" + " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" + " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" + ";"); } btnCancelR.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this service request?');"); ddlOS.Attributes.Add("onchange", "LoadWait();"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oOperatingSystems = new OperatingSystems(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(intProfile, dsn); oVirtualCPU = new VirtualCPU(intProfile, dsn); oClass = new Classes(intProfile, dsn); if (Request.QueryString["parent"] != null && Request.QueryString["parent"] != "") { intForecast = Int32.Parse(Request.QueryString["parent"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["step"] != null && Request.QueryString["step"] != "") { panUpdate.Visible = true; } else { panNavigation.Visible = true; } if (intID > 0) { DataSet ds = oForecast.GetAnswer(intID); if (ds.Tables[0].Rows.Count > 0) { bool boolHundred = false; int intConfidence = Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString()); if (intConfidence > 0) { Confidence oConfidence = new Confidence(intProfile, dsn); string strConfidence = oConfidence.Get(intConfidence, "name"); if (strConfidence.Contains("100%") == true) { boolHundred = true; } } if (boolHundred == true) { panUpdate.Visible = false; panNavigation.Visible = false; btnHundred.Visible = true; } intPlatform = Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString()); int intStep = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString()); int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); int intEnv = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()); int intAddress = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString()); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); boolProduction = oClass.IsProd(Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString())); intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString()); DataSet dsSteps = oForecast.GetSteps(intPlatform, 1); if (dsSteps.Tables[0].Rows.Count == intStep) { btnNext.Text = "Finish"; } if (intStep == 0 || intStep == 1) { btnBack.Enabled = false; } if (Request.QueryString["type"] != null && Request.QueryString["type"] != "") { intType = Int32.Parse(Request.QueryString["type"]); if (!IsPostBack) { LoadPlatform(intPlatform, intType, intClass, intEnv, intAddress); } if (Request.QueryString["model"] != null && Request.QueryString["model"] != "") { intModel = Int32.Parse(Request.QueryString["model"]); ddlModels.SelectedValue = intModel.ToString(); int intParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); if (Int32.Parse(oModel.Get(intParent, "hostid")) > 0) { // Virtual - requires additional info panVirtual.Visible = true; if (boolProduction == true) { panProduction.Visible = true; } } } } else if (!IsPostBack) { if (intModel > 0) { ddlModels.SelectedValue = intModel.ToString(); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); intType = Int32.Parse(oModel.Get(intModel, "typeid")); LoadPlatform(intPlatform, intType, intClass, intEnv, intAddress); if (Int32.Parse(oModel.Get(intModel, "hostid")) > 0) { // Virtual - requires additional info panVirtual.Visible = true; DataSet dsVirtual = oForecast.GetWorkstation(intID); if (dsVirtual.Tables[0].Rows.Count > 0) { ddlRam.SelectedValue = dsVirtual.Tables[0].Rows[0]["ramid"].ToString(); ddlOS.SelectedValue = dsVirtual.Tables[0].Rows[0]["osid"].ToString(); ddlRecovery.SelectedValue = dsVirtual.Tables[0].Rows[0]["recovery"].ToString(); ddlCPU.SelectedValue = dsVirtual.Tables[0].Rows[0]["cpuid"].ToString(); ddlHardDrive.SelectedValue = dsVirtual.Tables[0].Rows[0]["hddid"].ToString(); } if (boolProduction == true) { panProduction.Visible = true; } } } else { LoadPlatform(intPlatform, intType, intClass, intEnv, intAddress); } } } } btnClose.Attributes.Add("onclick", "return window.close();"); btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + ddlModels.ClientID + "','Please select a model');"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPage = new Pages(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oClass = new Classes(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oOperatingSystems = new OperatingSystems(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(intProfile, dsn); oVirtualCPU = new VirtualCPU(intProfile, dsn); oVariable = new Variables(intEnvironment); oFunction = new Functions(0, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oDomain = new Domains(intProfile, dsn); oWorkstation = new Workstations(intProfile, dsn); oCostCenter = new CostCenter(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["rid"] != "" && Request.QueryString["rid"] != null) { if (!IsPostBack) { LoadLists(); } LoadValues(); int intItem = Int32.Parse(lblItem.Text); int intApp = oRequestItem.GetItemApplication(intItem); string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); if (strDeliverable != "") { panDeliverable.Visible = true; btnDeliverable.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','" + strDeliverable + "');"); } if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null) { Int32.TryParse(Request.QueryString["id"], out intWorkstation); } if (intWorkstation > 0) { panAccounts.Visible = true; } else { panAccountsNo.Visible = true; } if (Request.QueryString["userid"] != null && Request.QueryString["userid"] != "") { int intUser = Int32.Parse(Request.QueryString["userid"]); trAccountUpdate.Visible = true; lblXID.Text = oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")"; btnAddAccount.Text = "Update"; btnCancelAccount.Visible = true; } else { trNew.Visible = true; } if (Request.QueryString["accts"] != null && Request.QueryString["accts"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "accts", "<script type=\"text/javascript\">alert('Enter at least one account for this workstation');<" + "/" + "script>"); } if (Request.QueryString["qty"] != null && Request.QueryString["qty"] != "") { if (Request.QueryString["qty"] == intMaxWorkstationsPerDay.ToString()) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations and cannot be allocated additional hardware until tomorrow.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else if (Request.QueryString["qty"] == "0") { int intDiff = intMaxWorkstationsPerDay - Int32.Parse(Request.QueryString["qty"]); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations. Please enter a quantity of " + intDiff.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nPlease enter a quantity of " + intMaxWorkstationsPerDay.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } } else if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); if (!IsPostBack) { DataSet dsAnswer = oForecast.GetAnswer(intAnswer); if (dsAnswer.Tables[0].Rows.Count > 0) { txtName.Text = dsAnswer.Tables[0].Rows[0]["name"].ToString(); ddlLocation.SelectedValue = dsAnswer.Tables[0].Rows[0]["addressid"].ToString(); ddlClass.SelectedValue = dsAnswer.Tables[0].Rows[0]["classid"].ToString(); txtQuantity.Text = dsAnswer.Tables[0].Rows[0]["quantity"].ToString(); dsAnswer = oForecast.GetWorkstation(intAnswer); if (dsAnswer.Tables[0].Rows.Count > 0) { ddlRam.SelectedValue = dsAnswer.Tables[0].Rows[0]["ramid"].ToString(); ddlOS.SelectedValue = dsAnswer.Tables[0].Rows[0]["osid"].ToString(); chkDR.Checked = (dsAnswer.Tables[0].Rows[0]["recovery"].ToString() == "1"); radEmployee.SelectedValue = dsAnswer.Tables[0].Rows[0]["internal"].ToString(); ddlHardDrive.SelectedValue = dsAnswer.Tables[0].Rows[0]["hddid"].ToString(); ddlCPU.SelectedValue = dsAnswer.Tables[0].Rows[0]["cpuid"].ToString(); } } else { intAnswer = 0; } } } if (intAnswer == 0) { DataSet dsService = oForecast.GetAnswerService(Int32.Parse(Request.QueryString["rid"])); if (dsService.Tables[0].Rows.Count > 0) { Redirect("&aid=" + dsService.Tables[0].Rows[0]["id"].ToString() + "&menu_tab=2"); } } if (intWorkstation > 0) { DataSet dsWorkstation = oWorkstation.GetVirtual(intWorkstation); if (dsWorkstation.Tables[0].Rows.Count > 0) { // Load Workstation txtName.Text = dsWorkstation.Tables[0].Rows[0]["nickname"].ToString(); ddlLocation.SelectedValue = dsWorkstation.Tables[0].Rows[0]["addressid"].ToString(); int intClass = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["classid"].ToString()); ddlClass.SelectedValue = intClass.ToString(); txtQuantity.Text = dsWorkstation.Tables[0].Rows[0]["quantity"].ToString(); int intOS = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["osid"].ToString()); LoadOS(intOS); ddlOS.SelectedValue = intOS.ToString(); int intDomain = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["domainid"].ToString()); lblDomain.Text = oDomain.Get(intDomain, "name"); radEmployee.SelectedValue = dsWorkstation.Tables[0].Rows[0]["internal"].ToString(); chkDR.Checked = (dsWorkstation.Tables[0].Rows[0]["recovery"].ToString() == "1"); ddlRam.SelectedValue = dsWorkstation.Tables[0].Rows[0]["ramid"].ToString(); ddlHardDrive.SelectedValue = dsWorkstation.Tables[0].Rows[0]["hddid"].ToString(); ddlCPU.SelectedValue = dsWorkstation.Tables[0].Rows[0]["cpuid"].ToString(); int intManager = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["appcontact"].ToString()); txtManager.Text = oUser.GetFullName(intManager); hdnManager.Value = intManager.ToString(); int intCost = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["costcenterid"].ToString()); txtCostCenter.Text = oCostCenter.GetName(intCost); hdnCostCenter.Value = intCost.ToString(); // Load Accounts txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();"); chkAdmin.Attributes.Add("onclick", "CheckAdmin(this);"); rptAccounts.DataSource = oWorkstation.GetAccountsVMware(intWorkstation); rptAccounts.DataBind(); foreach (RepeaterItem ri in rptAccounts.Items) { LinkButton _delete = (LinkButton)ri.FindControl("btnDeleteAccount"); _delete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this account?') && LoadWait();"); } if (rptAccounts.Items.Count == 0) { lblNone.Visible = true; btnNext.Attributes.Add("onclick", "alert('Enter at least one account for this workstation');return false;"); } else { btnNext.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();"); } if (oClass.IsProd(intClass)) { panProduction.Visible = true; } else { panAdmin.Visible = true; } btnAddAccount.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name') && ProcessButton(this) && LoadWait();"); trUpdate.Visible = true; btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" + " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" + " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an Operating System')" + " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" + " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" + " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" + " && ValidateHidden0('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter the LAN ID of your user access administrator')" + " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center to be billed for this workstation')" + " && ProcessButton(this) && LoadWait()" + ";"); } else { intWorkstation = 0; } } if (intWorkstation == 0) { btnNext.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" + " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" + " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an Operating System')" + " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" + " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" + " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" + " && ValidateHidden0('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter the LAN ID of your user access administrator')" + " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center to be billed for this workstation')" + " && ProcessButton(this) && LoadWait()" + ";"); } } 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("Workstation Details", ""); oTab.AddTab("Account Configuration", ""); strMenuTab1 = oTab.GetTabs(); btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this service request?');"); ddlOS.Attributes.Add("onchange", "LoadWait();"); ddlRam.Attributes.Add("onchange", "LoadWait();"); ddlCPU.Attributes.Add("onchange", "LoadWait();"); ddlHardDrive.Attributes.Add("onchange", "LoadWait();"); txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstManager.Attributes.Add("ondblclick", "AJAXClickRow();"); btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');"); btnManager2.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');"); txtCostCenter.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'200','195','" + divCostCenter.ClientID + "','" + lstCostCenter.ClientID + "','" + hdnCostCenter.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_cost_centers.aspx',5);"); lstCostCenter.Attributes.Add("ondblclick", "AJAXClickRow();"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPage = new Pages(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oVariable = new Variables(intEnvironment); oWorkstation = new Workstations(intProfile, dsn); oUser = new Users(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oOperatingSystems = new OperatingSystems(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(intProfile, dsn); oVirtualCPU = new VirtualCPU(intProfile, dsn); oClass = new Classes(intProfile, dsn); oAD = new AD(intProfile, dsn, intEnvironment); //Menus 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("Pool Configurtion", ""); oTab.AddTab("Workstation History", ""); oTab.AddTab("Workstations Currently Available", ""); oTab.AddTab("Subscribed Users", ""); strMenuTab1 = oTab.GetTabs(); //End Menus 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); } lblTitle.Text = oPage.Get(intPage, "title"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { panPool.Visible = true; int intID = Int32.Parse(Request.QueryString["id"]); if (Request.QueryString["save"] != null) { panSave.Visible = true; } DataSet ds = oWorkstation.GetPool(intID); if (ds.Tables[0].Rows.Count > 0) { string strName = ds.Tables[0].Rows[0]["name"].ToString(); txtName.Text = strName; rptHistory.DataSource = oWorkstation.GetPoolWorkstationsStatus(strName); rptHistory.DataBind(); lblHistory.Visible = (rptHistory.Items.Count == 0); rptAvailable.DataSource = oWorkstation.GetPoolWorkstations(strName); rptAvailable.DataBind(); lblAvailable.Visible = (rptAvailable.Items.Count == 0); DirectoryEntry oEntry = oAD.GroupSearch("GSGwra_" + strName); if (oEntry != null) { if (oEntry.Properties.Contains("member") == true) { foreach (string strUser in oEntry.Properties["member"]) { DirectoryEntry oEntry2 = new DirectoryEntry("LDAP://" + oVariable.primaryDCName(dsn) + "/" + strUser, oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword()); strSubscribers += "<tr><td>" + oEntry2.Properties["displayname"].Value.ToString() + " (" + oEntry2.Properties["name"].Value.ToString() + ")</td></tr>"; } } else { strSubscribers += "<tr><td><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> There are no subscribers</td></tr>"; } } else { strSubscribers += "<tr><td><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> Could not find Active Directory Group <b>" + "GSGwra_" + strName + "</b></td></tr>"; } txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString(); int intContact1 = 0; int intContact2 = 0; if (ds.Tables[0].Rows[0]["contact1"].ToString() != "") { intContact1 = Int32.Parse(ds.Tables[0].Rows[0]["contact1"].ToString()); } if (ds.Tables[0].Rows[0]["contact2"].ToString() != "") { intContact2 = Int32.Parse(ds.Tables[0].Rows[0]["contact2"].ToString()); } if (intContact1 > 0) { txtContact1.Text = oUser.GetFullName(intContact1) + " (" + oUser.GetName(intContact1) + ")"; hdnContact1.Value = intContact1.ToString(); } if (intContact2 > 0) { txtContact2.Text = oUser.GetFullName(intContact2) + " (" + oUser.GetName(intContact2) + ")"; hdnContact2.Value = intContact2.ToString(); } chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1"); lstCurrent.DataValueField = "id"; lstCurrent.DataTextField = "name"; lstCurrent.DataSource = oWorkstation.GetPoolWorkstations(intID); lstCurrent.DataBind(); lstAvailable.DataValueField = "id"; lstAvailable.DataTextField = "name"; lstAvailable.DataSource = oWorkstation.GetPoolWorkstations(intProfile, intID); lstAvailable.DataBind(); string strWorkstations = ""; int intCount = 0; foreach (ListItem oItem in lstCurrent.Items) { strWorkstations = strWorkstations + oItem.Value + "_" + intCount.ToString() + "&"; intCount++; } hdnWorkstations.Value = strWorkstations; txtContact1.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divContact1.ClientID + "','" + lstContact1.ClientID + "','" + hdnContact1.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstContact1.Attributes.Add("ondblclick", "AJAXClickRow();"); txtContact2.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divContact2.ClientID + "','" + lstContact2.ClientID + "','" + hdnContact2.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstContact2.Attributes.Add("ondblclick", "AJAXClickRow();"); btnAdd.Attributes.Add("onclick", "return MoveList('" + lstAvailable.ClientID + "','" + lstCurrent.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');"); lstAvailable.Attributes.Add("ondblclick", "return MoveList('" + lstAvailable.ClientID + "','" + lstCurrent.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');"); btnRemove.Attributes.Add("onclick", "return MoveList('" + lstCurrent.ClientID + "','" + lstAvailable.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');"); lstCurrent.Attributes.Add("ondblclick", "return MoveList('" + lstCurrent.ClientID + "','" + lstAvailable.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');"); btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a name')" + " && ValidateText('" + txtDescription.ClientID + "','Please enter a description')" + " && ValidateHidden0('" + hdnContact1.ClientID + "','" + txtContact1.ClientID + "','Please enter a primary contact')" + " && ValidateHidden0('" + hdnContact2.ClientID + "','" + txtContact2.ClientID + "','Please enter a secondary contact')" + ";"); } } else if (Request.QueryString["create"] != null) { panCreate.Visible = true; LoadLists(); if (Request.QueryString["qty"] != null && Request.QueryString["qty"] != "") { if (Request.QueryString["qty"] == intMaxWorkstationsPerDay.ToString()) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations and cannot be allocated additional hardware until tomorrow.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else if (Request.QueryString["qty"] == "0") { int intDiff = intMaxWorkstationsPerDay - Int32.Parse(Request.QueryString["qty"]); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations. Please enter a quantity of " + intDiff.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nPlease enter a quantity of " + intMaxWorkstationsPerDay.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } } int intAddress = intLocation; if (intAddress > 0) { txtParent.Text = oLocation.GetFull(intAddress); } hdnParent.Value = intAddress.ToString(); btnContinue.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" + " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" + " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an operating system')" + " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" + " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" + ";"); } else if (Request.QueryString["rid"] != null) { int intRequest = Int32.Parse(Request.QueryString["rid"]); panExecute.Visible = true; DataSet dsService = oForecast.GetAnswerService(intRequest); if (dsService.Tables[0].Rows.Count > 0) { int intAnswer = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString()); int intType = oModelsProperties.GetType(intModelVirtual); string strExecute = oType.Get(intType, "forecast_execution_path"); if (strExecute != "") { btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');"); } else { btnExecute.Attributes.Add("onclick", "alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;"); } } else { btnExecute.Attributes.Add("onclick", "alert('There was a problem executing this request...please contact your ClearView administrator');return false;"); } } else { DataSet ds = oWorkstation.GetPools(0); panPools.Visible = true; rptPools.DataSource = ds; rptPools.DataBind(); foreach (RepeaterItem ri in rptPools.Items) { Label lblWorkstations = (Label)ri.FindControl("lblWorkstations"); lblWorkstations.Text = oWorkstation.GetPoolWorkstations(Int32.Parse(lblWorkstations.Text)).Tables[0].Rows.Count.ToString(); } lblPools.Visible = (rptPools.Items.Count == 0); } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPage = new Pages(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oLocation = new Locations(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oOperatingSystems = new OperatingSystems(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(intProfile, dsn); oVirtualCPU = new VirtualCPU(intProfile, dsn); oClass = new Classes(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["rid"] != "" && Request.QueryString["rid"] != null) { if (!IsPostBack) { LoadLists(); } LoadValues(); int intItem = Int32.Parse(lblItem.Text); int intApp = oRequestItem.GetItemApplication(intItem); string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); if (strDeliverable != "") { panDeliverable.Visible = true; btnDeliverable.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','" + strDeliverable + "');"); } int intAddress = 0; if (Request.QueryString["qty"] != null && Request.QueryString["qty"] != "") { if (Request.QueryString["qty"] == intMaxWorkstationsPerDay.ToString()) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations and cannot be allocated additional hardware until tomorrow.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else if (Request.QueryString["qty"] == "0") { int intDiff = intMaxWorkstationsPerDay - Int32.Parse(Request.QueryString["qty"]); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations. Please enter a quantity of " + intDiff.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nPlease enter a quantity of " + intMaxWorkstationsPerDay.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>"); } intAddress = intLocation; } else if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); if (!IsPostBack) { DataSet dsAnswer = oForecast.GetAnswer(intAnswer); if (dsAnswer.Tables[0].Rows.Count > 0) { txtName.Text = dsAnswer.Tables[0].Rows[0]["name"].ToString(); intAddress = Int32.Parse(dsAnswer.Tables[0].Rows[0]["addressid"].ToString()); txtQuantity.Text = dsAnswer.Tables[0].Rows[0]["quantity"].ToString(); } } } else { DataSet dsService = oForecast.GetAnswerService(Int32.Parse(Request.QueryString["rid"])); if (dsService.Tables[0].Rows.Count > 0) { Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + Request.QueryString["rid"] + "&aid=" + dsService.Tables[0].Rows[0]["id"].ToString()); } intAddress = intLocation; } if (intAddress > 0) { txtParent.Text = oLocation.GetFull(intAddress); } hdnParent.Value = intAddress.ToString(); btnNext.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" + " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" + " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an operating system')" + " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" + " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" + ";"); } btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this service request?');"); }
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); oWorkstation = new Workstations(intProfile, dsn); 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); oDomain = new Domains(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(intProfile, dsn); oZeus = new Zeus(intProfile, dsnZeus); oLog = new Log(intProfile, dsn); oService = new Services(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oResourceRequest = new ResourceRequest(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 Workstation (" + strHeader + ")"; lblHeaderSub.Text = "Provides all the information about a VMware Workstation..."; 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("Guest Information", ""); oTab.AddTab("Account Information", ""); oTab.AddTab("Resource Dependencies", ""); oTab.AddTab("Provisioning Information", ""); if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true) { oTab.AddTab("Administration", ""); panAdministration.Visible = true; } strMenuTab1 = oTab.GetTabs(); if (!IsPostBack) { // Asset Information oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "WORKSTATION_VMWARE_SERIAL", strSerial, "", false, true); oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "WORKSTATION_VMWARE_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")); hdnModel.Value = intModel.ToString(); int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); int intType = oModel.GetType(intModelParent); string strExecute = oType.Get(intType, "forecast_execution_path"); if (strExecute != "") { DataSet dsVirtual = oWorkstation.GetVirtualAsset(intAsset); if (dsVirtual.Tables[0].Rows.Count > 0) { btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + dsVirtual.Tables[0].Rows[0]["answerid"].ToString() + "');"); } else { btnExecute.Enabled = false; } } else { btnExecute.Enabled = false; } int intPlatform = oType.GetPlatform(intType); oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "WORKSTATION_VMWARE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true); oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "WORKSTATION_VMWARE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "WORKSTATION_VMWARE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "WORKSTATION_VMWARE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true); // Get Asset int intWorkstation = 0; DataSet dsAsset = oWorkstation.GetVirtualAsset(intAsset); if (dsAsset.Tables[0].Rows.Count > 0) { intWorkstation = Int32.Parse(dsAsset.Tables[0].Rows[0]["id"].ToString()); lblWorkstation.Text = intWorkstation.ToString(); txtStep.Text = dsAsset.Tables[0].Rows[0]["step"].ToString(); oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, null, "", lblName, fldName, "WORKSTATION_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(); // Administrative Functions if (Request.QueryString["admin"] != null) { if (Request.QueryString["result"] != null) { strAdministration = "<tr><td>" + oFunction.decryptQueryString(Request.QueryString["result"]) + "</td></tr>"; } if (Request.QueryString["output"] != null) { DataSet dsOutput = oWorkstation.GetVirtualOutput(intWorkstation); foreach (DataRow drOutput in dsOutput.Tables[0].Rows) { strAdministration += "<tr><td><a href=\"javascript:void(0);\" onclick=\"ShowHideDiv2('div" + drOutput["id"].ToString() + "');\">" + drOutput["type"].ToString() + "</a></td></tr>"; strAdministration += "<tr id=\"div" + drOutput["id"].ToString() + "\" style=\"display:none\"><td>" + oFunction.FormatText(drOutput["output"].ToString()) + "</td></tr>"; } if (lblStatus.Text != "") { strAdministration += "<tr><td>" + oLog.GetEvents(oLog.GetEventsByName(txtName.Text.ToUpper(), (int)LoggingType.Error), intEnvironment) + "</td></tr>"; } } } 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, "WORKSTATION_VMWARE_CLASS", "name", "id", oClass.GetWorkstationVMwares(1), intClass, false, false, true); oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "WORKSTATION_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); int intOS = Int32.Parse(dsAsset.Tables[0].Rows[0]["osid"].ToString()); bool boolXP = (oOperatingSystem.Get(intOS, "code") == "XP"); bool boolWin7 = (oOperatingSystem.Get(intOS, "code") == "7"); oDataPoint.LoadDropDown(ddlPlatformOS, intProfile, null, "", lblPlatformOS, fldPlatformOS, "WORKSTATION_VMWARE_OS", "name", "id", oOperatingSystem.Gets(1, 1), intOS, false, false, true); oDataPoint.LoadDropDown(ddlPlatformServicePack, intProfile, null, "", lblPlatformServicePack, fldPlatformServicePack, "WORKSTATION_VMWARE_SP", "name", "id", oOperatingSystem.GetServicePack(intOS), Int32.Parse(dsAsset.Tables[0].Rows[0]["spid"].ToString()), false, false, true); oDataPoint.LoadDropDown(ddlPlatformDomain, intProfile, null, "", lblPlatformDomain, fldPlatformDomain, "WORKSTATION_VMWARE_DOMAIN", "name", "id", oDomain.Gets(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["domainid"].ToString()), false, false, true); oDataPoint.LoadDropDown(ddlPlatformHDD, intProfile, null, "", lblPlatformHDD, fldPlatformHDD, "WORKSTATION_VMWARE_HDD", "name", "id", oVirtualHDD.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1), Int32.Parse(dsAsset.Tables[0].Rows[0]["hddid"].ToString()), false, false, true); oDataPoint.LoadDropDown(ddlPlatformRam, intProfile, null, "", lblPlatformRam, fldPlatformRam, "WORKSTATION_VMWARE_RAM", "name", "id", oVirtualRam.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1), Int32.Parse(dsAsset.Tables[0].Rows[0]["ramid"].ToString()), false, false, true); } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } // Get Host oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["hostname"].ToString()), lblHostName, fldHostName, "WORKSTATION_VMWARE_HOST", dsAsset.Tables[0].Rows[0]["hostname"].ToString(), "", false, false); if (Request.Cookies["virtual_guest"] != null && Request.Cookies["virtual_guest"].Value != "") { string strHost = ""; string strFind = txtName.Text; //strFind = "ohcleapp103d"; DateTime datStart = DateTime.Parse(Request.Cookies["virtual_guest"].Value); Response.Cookies["virtual_guest"].Value = ""; VMWare oVMWare = new VMWare(intProfile, dsn); string strConnect = oVMWare.Connect(strFind); VimService _service = oVMWare.GetService(); ServiceContent _sic = oVMWare.GetSic(); try { ManagedObjectReference oVM = oVMWare.GetVM(strFind); ManagedObjectReference oParent = (ManagedObjectReference)oVMWare.getObjectProperty(oVM, "parent"); ManagedObjectReference oDataCenter = (ManagedObjectReference)oVMWare.getObjectProperty(oParent, "parent"); string strDataCenter = (string)oVMWare.getObjectProperty(oDataCenter, "name"); GuestInfo ginfo = (GuestInfo)oVMWare.getObjectProperty(oVM, "guest"); 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; } // HDD GuestDiskInfo[] oVMDisks = ginfo.disk; foreach (GuestDiskInfo oDisk in oVMDisks) { if (lblHDD.Text != "") { lblHDD.Text += "<br/>"; } double dblCapacity = double.Parse(oDisk.capacity.ToString()); dblCapacity = dblCapacity / 1024.00; dblCapacity = dblCapacity / 1024.00; dblCapacity = dblCapacity / 1024.00; double dblAvailable = double.Parse(oDisk.freeSpace.ToString()); dblAvailable = dblAvailable / 1024.00; dblAvailable = dblAvailable / 1024.00; dblAvailable = dblAvailable / 1024.00; lblHDD.Text += oDisk.diskPath + " " + dblCapacity.ToString("F") + " GB (" + dblAvailable.ToString("F") + " GB available)"; } // Status VirtualMachineSummary oVMSummary = (VirtualMachineSummary)oVMWare.getObjectProperty(oVM, "summary"); ManagedEntityStatus oVMStatus = oVMSummary.overallStatus; //lblOverallStatus.Text = (string)oVMStatus; lblOverallStatus.Text = Enum.GetName(typeof(ManagedEntityStatus), (ManagedEntityStatus)oVMStatus); // RAM & CPUs & Host VirtualMachineConfigSummary oVMConfig = oVMSummary.config; lblRAM.Text = oVMConfig.memorySizeMB.ToString(); lblCPUs.Text = oVMConfig.numCpu.ToString(); 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 = oVMWare.VirtualCenter(); lblDataCenter.Text = oVMWare.DataCenter(); } 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 != "") { panGuestYes.Visible = true; oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(strHost), lblHostName, fldHostName, "WORKSTATION_VMWARE_HOST", strHost, "", false, false); } else { panGuestNo.Visible = true; } TimeSpan oSpan = DateTime.Now.Subtract(datStart); btnGuestQuery.Enabled = false; btnGuestQuery.Text = "Query Time: " + oSpan.TotalSeconds.ToString("0") + " seconds..."; } oDataPoint.LoadPanel(panGuestQuery, intProfile, fldHostQuery, "WORKSTATION_VMWARE_HOST_QUERY"); // Account Information DataSet dsAccounts = oWorkstation.GetAccountsVMware(intWorkstation); rptAccounts.DataSource = dsAccounts; rptAccounts.DataBind(); lblNone.Visible = (rptAccounts.Items.Count == 0); // Resource Dependencies rptServiceRequests.DataSource = ds.Tables[1]; rptServiceRequests.DataBind(); trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0); foreach (RepeaterItem ri in rptServiceRequests.Items) { Label lblRequestID = (Label)ri.FindControl("lblRequestID"); Label lblServiceID = (Label)ri.FindControl("lblServiceID"); Label lblNumber = (Label)ri.FindControl("lblNumber"); 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); //lblProgress.Text = oResourceRequest.GetStatus(Int32.Parse(lblRequestID.Text), Int32.Parse(lblServiceID.Text), Int32.Parse(lblNumber.Text), true, true, dsnServiceEditor, dsnAsset, intServiceDecommission); lblProgress.Text = oResourceRequest.GetStatus(null, null, Int32.Parse(lblRequestID.Text), Int32.Parse(lblServiceID.Text), null, Int32.Parse(lblNumber.Text), true, dsnServiceEditor)[0].status; /* * 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 = SqlHelper.ExecuteDataset(dsnAsset, CommandType.Text, oDataPoint.AssetHistorySelect(intAsset)); rptHistory.DataBind(); lblHistory.Visible = (rptHistory.Items.Count == 0); oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "WORKSTATION_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) { intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString()); Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString())); } } 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 + "');"); btnGuestQuery.Attributes.Add("onclick", "ProcessButton(this,'Querying... please be patient...','225') && ProcessControlButton();"); btnOutput.Attributes.Add("onclick", "return ProcessButton(this) && ProcessControlButton();"); } 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); oWorkstation = new Workstations(intProfile, dsn); 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); oDomain = new Domains(intProfile, dsn); oVirtualHDD = new VirtualHDD(intProfile, dsn); oVirtualRam = new VirtualRam(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 | Virtual Workstation (" + strHeader + ")"; lblHeaderSub.Text = "Provides all the information about a Microsoft Virtual Workstation..."; 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("Account Information", ""); oTab.AddTab("Provisioning Information", ""); strMenuTab1 = oTab.GetTabs(); if (!IsPostBack) { // Asset Information oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "WORKSTATION_VIRTUAL_SERIAL", strSerial, "", false, true); oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "WORKSTATION_VIRTUAL_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")); 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, "WORKSTATION_VIRTUAL_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true); oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "WORKSTATION_VIRTUAL_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "WORKSTATION_VIRTUAL_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "WORKSTATION_VIRTUAL_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true); // Get Asset DataSet dsAsset = oWorkstation.GetVirtualAsset(intAsset); if (dsAsset.Tables[0].Rows.Count > 0) { oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, null, "", lblName, fldName, "WORKSTATION_VIRTUAL_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, "WORKSTATION_VIRTUAL_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true); oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "WORKSTATION_VIRTUAL_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); int intOS = Int32.Parse(dsAsset.Tables[0].Rows[0]["osid"].ToString()); oDataPoint.LoadDropDown(ddlPlatformOS, intProfile, null, "", lblPlatformOS, fldPlatformOS, "WORKSTATION_VIRTUAL_OS", "name", "id", oOperatingSystem.Gets(1, 1), intOS, false, false, true); oDataPoint.LoadDropDown(ddlPlatformServicePack, intProfile, null, "", lblPlatformServicePack, fldPlatformServicePack, "WORKSTATION_VIRTUAL_SP", "name", "id", oOperatingSystem.GetServicePack(intOS), Int32.Parse(dsAsset.Tables[0].Rows[0]["spid"].ToString()), false, false, true); oDataPoint.LoadDropDown(ddlPlatformDomain, intProfile, null, "", lblPlatformDomain, fldPlatformDomain, "WORKSTATION_VIRTUAL_DOMAIN", "name", "id", oDomain.Gets(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["domainid"].ToString()), false, false, true); oDataPoint.LoadDropDown(ddlPlatformHDD, intProfile, null, "", lblPlatformHDD, fldPlatformHDD, "WORKSTATION_VIRTUAL_HDD", "name", "id", oVirtualHDD.GetVirtuals(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["hddid"].ToString()), false, false, true); oDataPoint.LoadDropDown(ddlPlatformRam, intProfile, null, "", lblPlatformRam, fldPlatformRam, "WORKSTATION_VIRTUAL_RAM", "name", "id", oVirtualRam.GetVirtuals(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["ramid"].ToString()), false, false, true); lblCPUs.Text = "1"; } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } // Get Host oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["hostname"].ToString()), lblHostName, fldHostName, "WORKSTATION_VIRTUAL_HOST", dsAsset.Tables[0].Rows[0]["hostname"].ToString(), "", false, false); // Account Information DataSet dsAccounts = oWorkstation.GetAccountsVirtual(intAsset); rptAccounts.DataSource = dsAccounts; rptAccounts.DataBind(); lblNone.Visible = (rptAccounts.Items.Count == 0); // Provioning History rptHistory.DataSource = SqlHelper.ExecuteDataset(dsnAsset, CommandType.Text, oDataPoint.AssetHistorySelect(intAsset)); rptHistory.DataBind(); lblHistory.Visible = (rptHistory.Items.Count == 0); oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "WORKSTATION_VIRTUAL_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) { intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString()); Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString())); } } 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 + "');"); } else { panDenied.Visible = true; } }