public void SetVirtualHarware(Error error) { memory = new VirtualMemory(memoryCapacity); register = new Register(); cpu = new VirtualCPU(); cpu.SetVirtualCPU(memory, register, error); this.error = error; }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/virtual_ram.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"); } oVirtualCPU = new VirtualCPU(intProfile, dsn); if (!IsPostBack) { LoopRepeater(); btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=VIRTUAL_RAM" + "',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?');"); }