public void Begin() { datStart = DateTime.Now; arProcessing = new int[4] { 45, 47, 92, 124 }; // 92 = \, 124 = |, 47 = /, 45 = - strSSH = ""; oModel = new Models(0, dsn); oModelsProperties = new ModelsProperties(0, dsn); oServer = new Servers(0, dsn); oSetting = new Settings(0, dsn); oOnDemand = new OnDemand(0, dsn); oSolaris = new Solaris(0, dsn); oEventLog = new Log(0, dsn); oFunction = new Functions(0, dsn, intEnvironment); strTo = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_SUPPORT"); intModel = Int32.Parse(oServer.Get(intServer, "modelid")); if (intModel > 0) { strModel = oModelsProperties.Get(intModel, "name"); Int32.TryParse(oModelsProperties.Get(intModel, "modelid"), out intModelParent); if (intModelParent > 0) { Int32.TryParse(oModel.Get(intModelParent, "boot_groupid"), out intModelBootGroup); } } if (intModelBootGroup > 0) { string strUsername = oModel.GetBootGroup(intModelBootGroup, "username"); string strPassword = oModel.GetBootGroup(intModelBootGroup, "password"); strReturnToALOM = oModel.GetBootGroup(intModelBootGroup, "return_to_alom"); oEventLog.AddEvent(strName, strSerial, "Connecting to " + strILO + "... (U:" + strUsername + ", P:****)", LoggingType.Information); oSSHshell = new SshShell(strILO, strUsername, strPassword); oSSHshell.RemoveTerminalEmulationCharacters = true; oSSHshell.Connect(); oEventLog.AddEvent(strName, strSerial, "Connected to " + strILO + "...sending commands...", LoggingType.Information); ThreadStart oReadingDoneSSH = new ThreadStart(ReadingDoneSSH); Thread oJobReadingDoneSSH = new Thread(oReadingDoneSSH); oJobReadingDoneSSH.Start(); ReadingSSH(); } else { AddResult("The boot group of the model has not been configured ~ (ModelPropertyID = " + intModel.ToString() + ") (ModelID = " + intModelParent.ToString() + ") (ModelBootGroupID = " + intModelBootGroup.ToString() + ")"); } }
protected string LoadGroup(int _platformid, DataTable _demand, string _additional_filter) { string strGroup = ""; //DataSet dsTypes = oType.Gets(_platformid, 1); DataSet dsTypes = oType.Gets(intPlatformServer, 1); int intDemand = 0; foreach (DataRow drType in dsTypes.Tables[0].Rows) { DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } int intModel = Int32.Parse(drModel["id"].ToString()); int intPorts = Int32.Parse(oModelsProperties.Get(intModel, "network_ports")); DataRow[] drModels = _demand.Select("model = " + intModel.ToString() + strFilter + _additional_filter); if (intHost == 0) { int intModels = drModels.Length; intModels = intModels * intPorts; intDemand += intModels; } } } strGroup += "<tr class=\"" + (intDemand > 0 ? "greendefault" : (intDemand < 0 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Ports:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((double.Parse(intDemand.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + intDemand.ToString() + "</td></tr>"; if (strGroup != "") { strGroup = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">" + strGroup + "</table>"; } return(strGroup); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oAsset = new Asset(0, dsnAsset); oIPAddresses = new IPAddresses(0, dsnIP, dsn); oModel = new Models(0, dsn); oModelsProperties = new ModelsProperties(0, dsn); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["add"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add", "<script type=\"text/javascript\">alert('The HBA was successfully added');<" + "/" + "script>"); } if (Request.QueryString["delete"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "delete", "<script type=\"text/javascript\">alert('The HBA was successfully deleted');<" + "/" + "script>"); } if (!IsPostBack) { DataSet ds = oAsset.Get(intID); if (ds.Tables[0].Rows.Count > 0) { lblTracking.Text = ds.Tables[0].Rows[0]["tracking"].ToString(); lblSerial.Text = ds.Tables[0].Rows[0]["serial"].ToString(); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); lblModel.Text = ds.Tables[0].Rows[0]["modelname"].ToString(); lblAsset.Text = ds.Tables[0].Rows[0]["asset"].ToString(); rptHBA.DataSource = oAsset.GetHBA(intID); rptHBA.DataBind(); lblHBA.Visible = (rptHBA.Items.Count == 0); foreach (RepeaterItem ri in rptHBA.Items) { LinkButton btnDelete = (LinkButton)ri.FindControl("btnDelete"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); } btnAdd.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a name')" + ";"); txtName.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnAdd.ClientID + "').click();return false;}} else {return true}; "); } else { btnAdd.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { oModelsProperties = new ModelsProperties(0, dsn); if (Request.QueryString["u"] != null && Request.QueryString["u"] == "GET") { XmlDocument oDoc = new XmlDocument(); oDoc.Load(Request.InputStream); int intModel = Int32.Parse(Server.UrlDecode(oDoc.ChildNodes[0].ChildNodes[0].InnerText)); string strAssetCategory = oModelsProperties.Get(intModel, "asset_category"); Response.ContentType = "text/xml"; Response.Write("<values><value>" + strAssetCategory + "</value></values>"); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { oModelsProperties = new ModelsProperties(0, dsn); if (Request.QueryString["mid"] != null && Request.QueryString["mid"] != "") { intModel = Int32.Parse(Request.QueryString["mid"]); if (intModel > 0) { lblName.Text = oModelsProperties.Get(intModel, "name"); } } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); if (IsPostBack == false) { panOne.Visible = true; DataSet ds = oModelsProperties.GetThreshold(intID); if (ds.Tables[0].Rows.Count > 0) { txtFrom.Text = ds.Tables[0].Rows[0]["qty_from"].ToString(); txtTo.Text = ds.Tables[0].Rows[0]["qty_to"].ToString(); txtNumber.Text = ds.Tables[0].Rows[0]["number_days"].ToString(); chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1"); btnSubmit.Text = "Update"; } else { btnSubmit.Text = "Add"; } } } else if (intModel > 0) { panAll.Visible = true; rptView.DataSource = oModelsProperties.GetThresholds(intModel, 0); rptView.DataBind(); lblNone.Visible = (rptView.Items.Count == 0); } btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtFrom.ClientID + "','Please enter a valid number for the quantity')" + " && ValidateNumber0('" + txtTo.ClientID + "','Please enter a valid number for the quantity')" + " && ValidateNumber0('" + txtNumber.ClientID + "','Please enter a valid number for the number of days')" + ";"); }
protected void Page_Load() { Int32.TryParse(Request.QueryString["id"], out intAsset); if (intAsset > 0) { int intModelProperty = 0; Asset oAsset = new Asset(0, dsnAsset, dsn); if (Int32.TryParse(oAsset.Get(intAsset, "modelid"), out intModelProperty) == true) { ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); if (oModelsProperties.IsDell(intModelProperty) == true) { int intDellConfig = 0; Int32.TryParse(oModelsProperties.Get(intModelProperty, "dellconfigid"), out intDellConfig); Dells oDell = new Dells(0, dsn); DataSet dsDell = oDell.Get(intDellConfig); if (dsDell.Tables[0].Rows.Count == 1) { DataRow drDell = dsDell.Tables[0].Rows[0]; strUser = drDell["username"].ToString(); strPass = drDell["password"].ToString(); strILO = oAsset.GetServerOrBlade(intAsset, "ilo"); Functions oFunction = new Functions(0, dsn, intEnvironment); Variables oVariable = new Variables(intEnvironment); if (Request.QueryString["showimage"] != null) { Response.Redirect("/ondemand/ondemand_dell_image.aspx?showimage=https://" + strILO + Request.QueryString["showimage"]); } else if (Request.QueryString["bypass"] != null) { if (strUser == "" || strPass == "") { strUser = oVariable.ADUser() + "@" + oVariable.FullyQualified(); strPass = oFunction.AddPassword(50); } } } } } } }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); 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); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); intRequest = oForecast.GetRequestID(intID, true); } if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "") { intRequest = Int32.Parse(Request.QueryString["rid"]); } if (intRequest > 0) { DataSet ds = oForecast.GetAnswerRequest(intRequest); if (ds.Tables[0].Rows.Count > 0) { int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); int intModel = oForecast.GetModelAsset(intAnswer); if (intModel == 0) { intModel = oForecast.GetModel(intAnswer); } intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); oForecast.UpdateAnswer(intAnswer, intRequest); oForecast.DeleteReset(intAnswer); int intType = oModel.GetType(intModel); string strPath = oType.Get(intType, "ondemand_execution_path"); if (strPath != "") { PHStep.Controls.Add((Control)LoadControl(strPath)); } } } }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); } if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } oDataPoint = new DataPoint(intProfile, dsn); oUser = new Users(intProfile, dsn); oServer = new Servers(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset); oForecast = new Forecast(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oOperatingSystem = new OperatingSystems(intProfile, dsn); oServicePack = new ServicePacks(intProfile, dsn); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); oResiliency = new Resiliency(intProfile, dsn); 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; lblError.Text = "Name Already Exists"; } 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 | Enclosure (" + strHeader + ")"; lblHeaderSub.Text = "Provides all the information about an enclosure..."; int intMenuTab = 0; if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "") { intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]); } Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false); oTab.AddTab("Asset Information", ""); oTab.AddTab("Location Information", ""); oTab.AddTab("Virtual Connect IPs", ""); oTab.AddTab("Resource Dependencies", ""); oTab.AddTab("Provisioning History", ""); oTab.AddTab("Blades", ""); //oTab.AddTab("Network Adapter Configuration", ""); strMenuTab1 = oTab.GetTabs(); if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true) { panOldLocationInfo.Visible = true; } if (!IsPostBack) { //DataSet dsAssets = oServer.GetAsset(intAsset); //foreach (DataRow drAsset in dsAssets.Tables[0].Rows) //{ // if (drAsset["latest"].ToString() == "1") // { // intAsset = Int32.Parse(drAsset["assetid"].ToString()); // intAssetClass = Int32.Parse(drAsset["classid"].ToString()); // intAssetEnv = Int32.Parse(drAsset["environmentid"].ToString()); // break; // } //} // Asset Information oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "ENCLOSURE_SERIAL", strSerial, "", false, true); oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "ENCLOSURE_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, "ENCLOSURE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true); oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "ENCLOSURE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "ENCLOSURE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "ENCLOSURE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true); // Get Asset DataSet dsAsset = oAsset.GetEnclosure(intAsset); if (dsAsset.Tables[0].Rows.Count > 0) { oDataPoint.LoadTextBox(txtName, intProfile, null, "", lblName, fldName, "ENCLOSURE_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, "ENCLOSURE_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true); oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "ENCLOSURE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true); oDataPoint.LoadTextBox(txtPlatformVLAN, intProfile, null, "", lblPlatformVLAN, fldPlatformVLAN, "ENCLOSURE_VLAN", dsAsset.Tables[0].Rows[0]["vlan"].ToString(), "", false, true); if (dsAsset.Tables[0].Rows[0]["oa_ip"].ToString() != "") { oDataPoint.LoadTextBox(txtPlatformOA, intProfile, btnOA, "https://" + dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), lblPlatformOA, fldPlatformOA, "ENCLOSURE_OA", dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), "", false, true); } else { oDataPoint.LoadTextBox(txtPlatformOA, intProfile, null, "", lblPlatformOA, fldPlatformOA, "ENCLOSURE_OA", dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), "", false, true); } int intResiliency = 0; Int32.TryParse(dsAsset.Tables[0].Rows[0]["resiliencyid"].ToString(), out intResiliency); oDataPoint.LoadDropDown(ddlPlatformResiliency, intProfile, null, "", lblPlatformResiliency, fldPlatformResiliency, "ENCLOSURE_RESILIENCY", "name", "id", oResiliency.Gets(1), intResiliency, false, false, true); lblOldlocation.Text = dsAsset.Tables[0].Rows[0]["OldLocation"].ToString(); lblOldRoom.Text = dsAsset.Tables[0].Rows[0]["OldRoom"].ToString(); lblOldRack.Text = dsAsset.Tables[0].Rows[0]["OldRack"].ToString(); txtLocation.Text = dsAsset.Tables[0].Rows[0]["Location"].ToString(); txtRoom.Text = dsAsset.Tables[0].Rows[0]["Room"].ToString(); txtZone.Text = dsAsset.Tables[0].Rows[0]["Zone"].ToString(); txtRack.Text = dsAsset.Tables[0].Rows[0]["Rack"].ToString(); txtRackPosition.Text = dsAsset.Tables[0].Rows[0]["Rackposition"].ToString(); oDataPoint.LoadTextBox(txtRackPosition, intProfile, null, "", lblRackPositionValue, fldLocation, "CHANGE_LOCATION", dsAsset.Tables[0].Rows[0]["rackposition"].ToString(), "", false, true); hdnRackId.Value = dsAsset.Tables[0].Rows[0]["NewRackId"].ToString(); oDataPoint.LoadButton(btnSelectLocation, intProfile, fldLocation, "CHANGE_LOCATION", "return LoadLocationRoomRack('" + "rack" + "','" + hdnRackId.ClientID + "', '" + txtLocation.ClientID + "','" + txtRoom.ClientID + "','" + txtZone.ClientID + "','" + txtRack.ClientID + "');"); //DR Counterpart int intDR = oAsset.GetDR(intAsset); string strDR = oAsset.Get(intDR, "serial"); if (intDR > 0) { oDataPoint.LoadTextBox(txtPlatformDRCounterPart, intProfile, btnPlatformDRCounterPart, "/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(strDR) + "&id=" + oFunction.encryptQueryString(intDR.ToString()), lblPlatformDRCounterPart, fldPlatformDRCounterPart, "BLADE_DR", strDR, "", true, false); } else { oDataPoint.LoadTextBox(txtPlatformDRCounterPart, intProfile, null, "", lblPlatformDRCounterPart, fldPlatformDRCounterPart, "BLADE_DR", "", "", true, false); } ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString(); ddlStatus.Enabled = (intAssetAttribute == (int)AssetAttribute.Ok); panStatus.Visible = (ddlStatus.Enabled == false); } else { Response.Redirect("/datapoint/asset/enclosure_deploy.aspx?t=serial&q=" + oFunction.encryptQueryString(strSerial) + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&r=0"); } // Resource Dependencies AssetOrder oAssetOrder = new AssetOrder(0, dsn, dsnAsset, intEnvironment); Services oService = new Services(0, dsn); ServiceRequests oServiceRequest = new ServiceRequests(0, dsn); rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false); rptServiceRequests.DataBind(); trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0); foreach (RepeaterItem ri in rptServiceRequests.Items) { Label lblServiceID = (Label)ri.FindControl("lblServiceID"); int intService = Int32.Parse(lblServiceID.Text); Label lblDetails = (Label)ri.FindControl("lblDetails"); Label lblProgress = (Label)ri.FindControl("lblProgress"); if (lblProgress.Text == "") { lblProgress.Text = "<i>Unavailable</i>"; } else { int intResource = Int32.Parse(lblProgress.Text); double dblAllocated = 0.00; double dblUsed = 0.00; int intStatus = 0; bool boolAssigned = false; DataSet dsResource = oDataPoint.GetServiceRequestResource(intResource); if (dsResource.Tables[0].Rows.Count > 0) { Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus); } foreach (DataRow drResource in dsResource.Tables[1].Rows) { boolAssigned = true; dblAllocated += double.Parse(drResource["allocated"].ToString()); dblUsed += double.Parse(drResource["used"].ToString()); intStatus = Int32.Parse(drResource["status"].ToString()); } if (intStatus == (int)ResourceRequestStatus.Closed) { lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true); } else if (intStatus == (int)ResourceRequestStatus.Cancelled) { lblProgress.Text = "Cancelled"; } else if (boolAssigned == false) { string strManager = ""; DataSet dsManager = oService.GetUser(intService, 1); // Managers foreach (DataRow drManager in dsManager.Tables[0].Rows) { if (strManager != "") { strManager += "\\n"; } int intManager = Int32.Parse(drManager["userid"].ToString()); strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]"; } lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>"; } else if (dblAllocated > 0.00) { lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true); } else { lblProgress.Text = "<i>N / A</i>"; } lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>"; } } // Provioning History rptHistory.DataSource = oAsset.GetProvisioningHistory(oDataPoint.AssetHistorySelect(intAsset)); rptHistory.DataBind(); lblHistory.Visible = (rptHistory.Items.Count == 0); oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "ENCLOSURE_STATUS"); // Virtual Connects rptVirtualConnect.DataSource = oAsset.GetEnclosureVCs(intAsset, 1); rptVirtualConnect.DataBind(); lblVirtualConnect.Visible = (rptVirtualConnect.Items.Count == 0); oDataPoint.LoadButton(btnVC, intProfile, fldVC, "ENCLOSURE_VC", "return OpenWindow('ASSET_DEPLOY_VCs','" + intAsset.ToString() + "');"); if (Request.QueryString["highlight"] != null && Request.QueryString["highlight"] != "") { intHighlight = Int32.Parse(Request.QueryString["highlight"]); } // Blades rptBlades.DataSource = oAsset.GetEnclosureBlades(intAsset); rptBlades.DataBind(); lblBlades.Visible = (rptBlades.Items.Count == 0); // Redeploy oDataPoint.LoadButton(btnRedeploy, intProfile, fldRedeploy, "ENCLOSURE_REDEPLOY"); if (rptBlades.Items.Count == 0) { btnRedeploy.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy this enclosure?') && confirm('WARNING! Redeploying an asset means that ALL the information regarding this asset will be erased.\\n\\nAre you sure you want to redeploy this enclosure?');"); } else { btnRedeploy.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy this enclosure?\\n\\WARNING: The blades associated with this enclosure have not been redployed!\\nIt is STRONGLY recommended that you redeploy the blades first to avoid corrupting the asset database.\\n\\nAre you sure you want to continue?');"); } oDataPoint.LoadButton(btnRedeployBlades, intProfile, fldRedeployBlades, "ENCLOSURE_REDEPLOY_BLADES"); if (rptBlades.Items.Count == 0) { btnRedeployBlades.Attributes.Add("onclick", "alert('All blades have already been redeployed');return false;;"); } else { btnRedeployBlades.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy ALL the blades in this enclosure?') && confirm('WARNING! Redeploying an asset means that ALL the information regarding this asset will be erased.\\n\\nAre you sure you want to redeploy ALL the blades in this enclosure?');"); } } } 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?multiple=true&t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"]); } } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } btnClose.Attributes.Add("onclick", "window.close();return false;"); btnPrint.Attributes.Add("onclick", "window.print();return false;"); btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation()); btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation()); ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);"); ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');"); //ddlLocationState.Attributes.Add("onchange", "LoadLocationCity('" + ddlLocationCity.ClientID + "');LoadLocationAddress('" + ddlLocationAddress.ClientID + "');PopulateCitys('" + ddlLocationState.ClientID + "','" + ddlLocationCity.ClientID + "');ResetDropDownHidden('" + hdnAddress.ClientID + "');"); //ddlLocationCity.Attributes.Add("onchange", "LoadLocationAddress('" + ddlLocationAddress.ClientID + "');PopulateAddresss('" + ddlLocationCity.ClientID + "','" + ddlLocationAddress.ClientID + "');ResetDropDownHidden('" + hdnAddress.ClientID + "');"); //ddlLocationAddress.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlLocationAddress.ClientID + "','" + hdnAddress.ClientID + "');"); } else { panDenied.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oForecast = new Forecast(intProfile, dsn); oServerName = new ServerName(intProfile, dsn); oServer = new Servers(intProfile, dsn); oPage = new Pages(intProfile, dsn); oOperatingSystem = new OperatingSystems(intProfile, dsn); if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["action"] != null && Request.QueryString["action"] != "") { panFinish.Visible = true; } else { if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intAnswer = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { if (intAnswer > 0) { DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { Projects oProject = new Projects(intProfile, dsn); Requests oRequest = new Requests(intProfile, dsn); Organizations oOrganization = new Organizations(intProfile, dsn); Segment oSegment = new Segment(intProfile, dsn); Platforms oPlatform = new Platforms(intProfile, dsn); ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn); Confidence oConfidence = new Confidence(intProfile, dsn); Classes oClass = new Classes(intProfile, dsn); Environments oEnvironment = new Environments(intProfile, dsn); Locations oLocation = new Locations(intProfile, dsn); Users oUser = new Users(intProfile, dsn); lblID.Text = intAnswer.ToString(); int intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString()); int intRequest = Int32.Parse(oForecast.Get(intForecast, "requestid")); int intProject = oRequest.GetProjectNumber(intRequest); lblName.Text = oProject.Get(intProject, "name"); lblNumber.Text = oProject.Get(intProject, "number"); lblPortfolio.Text = oOrganization.GetName(Int32.Parse(oProject.Get(intProject, "organization"))); lblSegment.Text = oSegment.GetName(Int32.Parse(oProject.Get(intProject, "segmentid"))); lblPlatform.Text = oPlatform.GetName(Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString())); lblNickname.Text = ds.Tables[0].Rows[0]["name"].ToString(); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); if (intModel == 0) { intModel = oForecast.GetModelAsset(intAnswer); } if (intModel == 0) { intModel = oForecast.GetModel(intAnswer); } lblModel.Text = oModelsProperties.Get(intModel, "name"); lblCommitment.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToLongDateString(); lblQuantity.Text = ds.Tables[0].Rows[0]["quantity"].ToString(); lblConfidence.Text = oConfidence.Get(Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString()), "name"); int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); lblClass.Text = oClass.Get(intClass, "name"); if (oClass.IsProd(intClass)) { panTest.Visible = true; lblTest.Text = (ds.Tables[0].Rows[0]["test"].ToString() == "1" ? "Yes" : "No"); } lblEnvironment.Text = oEnvironment.Get(Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()), "name"); lblLocation.Text = oLocation.GetFull(Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString())); lblIP.Text = ds.Tables[0].Rows[0]["workstation"].ToString(); lblDesignedBy.Text = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString())); lblRequestor.Text = ds.Tables[0].Rows[0]["userid"].ToString(); lblDesignedOn.Text = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToString(); lblUpdated.Text = DateTime.Parse(ds.Tables[0].Rows[0]["modified"].ToString()).ToString(); panShow.Visible = true; btnSave.Enabled = true; // Load Components rptApproval.DataSource = oServerName.GetComponentDetailUserApprovalsByUser(intProfile, intAnswer, 0); rptApproval.DataBind(); foreach (RepeaterItem ri in rptApproval.Items) { int intServer = Int32.Parse(((Label)ri.FindControl("lblServer")).Text); int intDetail = Int32.Parse(((Label)ri.FindControl("lblDetail")).Text); RadioButton radApprove = (RadioButton)ri.FindControl("radApprove"); RadioButton radDeny = (RadioButton)ri.FindControl("radDeny"); HtmlTableRow trLicense = (HtmlTableRow)ri.FindControl("trLicense"); HtmlTableRow trComments = (HtmlTableRow)ri.FindControl("trComments"); TextBox txtLicense = (TextBox)ri.FindControl("txtLicense"); TextBox txtComments = (TextBox)ri.FindControl("txtComments"); Label lblOS = (Label)ri.FindControl("lblOS"); int intOS = 0; Int32.TryParse(oServer.Get(intServer, "osid"), out intOS); lblOS.Text = oOperatingSystem.Get(intOS, "name"); radApprove.Attributes.Add("onclick", "ShowHideDiv('" + trLicense.ClientID + "','inline');ShowHideDiv('" + trComments.ClientID + "','inline');"); radDeny.Attributes.Add("onclick", "ShowHideDiv('" + trLicense.ClientID + "','none');ShowHideDiv('" + trComments.ClientID + "','inline');"); DataSet dsResult = oServerName.GetComponentDetailUserApprovals(intServer, intDetail); if (dsResult.Tables[0].Rows.Count > 0) { // Load previous information DataRow drResult = dsResult.Tables[0].Rows[0]; if (drResult["approved"].ToString() == "1") { radApprove.Checked = true; txtLicense.Text = drResult["license"].ToString(); trLicense.Style["display"] = "inline"; txtComments.Text = drResult["comments"].ToString(); trComments.Style["display"] = "inline"; } if (drResult["approved"].ToString() == "0") { radDeny.Checked = true; txtComments.Text = drResult["comments"].ToString(); trComments.Style["display"] = "inline"; } } } } } } } }
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); 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; } int intCount = 0; 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()); bool boolOverride = (ds.Tables[0].Rows[0]["override"].ToString() == "1" || ds.Tables[0].Rows[0]["override"].ToString() == "-1"); 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"]); } else if (!IsPostBack) { if (intModel > 0) { if (boolOverride == true) { ddlModels.SelectedValue = intModel.ToString(); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); } else { ddlModels.SelectedValue = intModel.ToString(); } intType = Int32.Parse(oModel.Get(intModel, "typeid")); } } if (!IsPostBack) { intCount = 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) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oAsset = new Asset(0, dsnAsset); oIPAddresses = new IPAddresses(0, dsnIP, dsn); oModel = new Models(0, dsn); oModelsProperties = new ModelsProperties(0, dsn); oSolaris = new Solaris(intProfile, dsn); oResiliency = new Resiliency(intProfile, dsn); oOperatingSystem = new OperatingSystems(intProfile, dsn); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["save"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Asset Deployed Successfully!');window.close();<" + "/" + "script>"); } if (!IsPostBack) { DataSet ds = oAsset.Get(intID); if (ds.Tables[0].Rows.Count > 0) { lblTracking.Text = ds.Tables[0].Rows[0]["tracking"].ToString(); lblSerial.Text = ds.Tables[0].Rows[0]["serial"].ToString(); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); int intParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); ddlModels.DataTextField = "name"; ddlModels.DataValueField = "id"; ddlModels.DataSource = oModelsProperties.GetModels(1, intParent, 1); ddlModels.DataBind(); ddlModels.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlModels.SelectedValue = intModel.ToString(); //lblModel.Text = ds.Tables[0].Rows[0]["modelname"].ToString(); lblAsset.Text = ds.Tables[0].Rows[0]["asset"].ToString(); lblHBA.Text = " (Currently = " + oAsset.GetHBA(intID).Tables[0].Rows.Count.ToString() + ")"; if (oModelsProperties.IsTypeBlade(intModel) == true) { panBlade.Visible = true; ddlEnclosure.DataValueField = "id"; ddlEnclosure.DataTextField = "name"; ddlEnclosure.DataSource = oAsset.GetEnclosures((int)AssetStatus.InUse); ddlEnclosure.DataBind(); ddlEnclosure.Items.Insert(0, new ListItem("-- SELECT --", "0")); btnSubmit.Attributes.Add("onclick", "return ValidateDropDown('" + ddlStatus.ClientID + "','Please select a status')" + " && ValidateDropDown('" + ddlModels.ClientID + "','Please select a model')" + " && ValidateDropDown('" + ddlEnclosure.ClientID + "','Please select an enclosure')" + " && ValidateNumber0('" + txtSlot.ClientID + "','Please enter a valid slot number')" + " && ValidateRadioButtons('" + radSpareYes.ClientID + "','" + radSpareNo.ClientID + "','Please select whether or not this blade is a spare')" + " && ValidateText('" + txtILO.ClientID + "','Please enter an ILO address')" + " && ValidateText('" + txtDummy.ClientID + "','Please enter a dummy name')" + " && ValidateText('" + txtMAC.ClientID + "','Please enter a mac address')" + " && ValidateNumber0('" + txtVLAN.ClientID + "','Please enter a valid original VLAN')" + ";"); } else { panServer.Visible = true; LoadLists(); ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);"); ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');"); btnSubmit.Attributes.Add("onclick", "return ValidateDropDown('" + ddlStatus.ClientID + "','Please select a status')" + " && ValidateDropDown('" + ddlModels.ClientID + "','Please select a model')" + " && ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" + " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please select an environment')" + " && ValidateHidden0('" + hdnRackId.ClientID + "','" + btnChangeLocation.ClientID + "','Please select a location details')" + " && ValidateHidden0('" + hdnRackPosition.ClientID + "','" + btnChangeLocation.ClientID + "','Please enter a rack position')" + " && ValidateText('" + txtILO.ClientID + "','Please enter an ILO address')" + " && ValidateText('" + txtDummy.ClientID + "','Please enter a dummy name')" + " && ValidateText('" + txtMAC.ClientID + "','Please enter a mac address')" + " && ValidateNumber0('" + txtVLAN.ClientID + "','Please enter a valid original VLAN')" + ";"); } } } btnClose.Attributes.Add("onclick", "return parent.HidePanel();"); btnHBAs.Attributes.Add("onclick", "return OpenWindow('ASSET_DEPLOY_HBAs','" + Request.QueryString["id"] + "');"); }
protected void btnUpload_Click(Object Sender, EventArgs e) { int intSuccess = 0; int intDuplicate = 0; int intError = 0; ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); if (oFile.PostedFile != null && oFile.FileName != "") { string strPhysical = oVariable.DocumentsFolder() + "xml\\"; if (Directory.Exists(strPhysical) == false) { lblResults.Text = "<b>Created XML directory "" + strPhysical + ""...SUCCESS!</b><br/><br/>"; Directory.CreateDirectory(strPhysical); } else { lblResults.Text = "<b>XML directory "" + strPhysical + "" already exists...</b><br/><br/>"; } lblResults.Text += "<b>Results of File "" + oFile.FileName + ""</b><br/>"; string strFile = strPhysical + oFile.FileName; oFile.PostedFile.SaveAs(strFile); DataSet ds = new DataSet(); ds.ReadXml(strFile); switch (oFile.FileName[0]) { case 'E': // Existing foreach (DataRow dr in ds.Tables[0].Rows) { int intModel = 0; try { intModel = Int32.Parse(dr["svrModel"].ToString()); } catch { intModel = oModelsProperties.Get(dr["svrModel"].ToString()); } if (intModel > 0) { if (oAsset.Get(dr["svrSerial"].ToString().Trim().ToUpper(), intModel).Tables[0].Rows.Count > 0) { lblResults.Text += "DUPLICATE: " + dr["svrSerial"].ToString().Trim().ToUpper() + " [" + dr["svrAsset"].ToString().Trim().ToUpper() + "]<br/>"; intDuplicate++; } else { int intAsset = oAsset.Add("", intModel, dr["svrSerial"].ToString().Trim().ToUpper(), dr["svrAsset"].ToString().Trim().ToUpper(), (int)AssetStatus.Arrived, -1, DateTime.Now, 0, 1); lblResults.Text += "success: " + dr["svrSerial"].ToString().Trim().ToUpper() + " [" + dr["svrAsset"].ToString().Trim().ToUpper() + "]<br/>"; intSuccess++; } } else { ErrorMessage(dr["svrModel"].ToString()); lblResults.Text += "### ERROR ###: " + dr["svrModel"].ToString().Trim().ToUpper() + " does not exist<br/>"; intError++; } } lblResults.Text += "<p><hr size=1 noshade/></p>"; lblResults.Text += "Successful: " + intSuccess.ToString() + "<br/>"; lblResults.Text += "Duplicates: " + intDuplicate.ToString() + "<br/>"; lblResults.Text += "Errors: " + intError.ToString() + "<br/>"; break; case 'S': // New foreach (DataRow dr in ds.Tables[0].Rows) { int intModel = 0; try { intModel = Int32.Parse(dr["svrModel"].ToString()); } catch { intModel = oModelsProperties.Get(dr["svrModel"].ToString()); } if (intModel > 0) { if (oAsset.Get(dr["svrSerial"].ToString().Trim().ToUpper(), intModel).Tables[0].Rows.Count > 0) { lblResults.Text += "DUPLICATE: " + dr["svrSerial"].ToString().Trim().ToUpper() + " [" + dr["svrAsset"].ToString().Trim().ToUpper() + "]<br/>"; intDuplicate++; } else { int intAsset = oAsset.Add(dr["svrTracking"].ToString().Trim().ToUpper(), intModel, dr["svrSerial"].ToString().Trim().ToUpper(), dr["svrAsset"].ToString().Trim().ToUpper(), (int)AssetStatus.Arrived, -1, DateTime.Now, 0, 1); oOrder.UpdateReceived(dr["svrTracking"].ToString().Trim().ToUpper(), 1); lblResults.Text += "success: " + dr["svrSerial"].ToString().Trim().ToUpper() + " [" + dr["svrAsset"].ToString().Trim().ToUpper() + "]<br/>"; intSuccess++; } } else { ErrorMessage(dr["svrModel"].ToString()); lblResults.Text += "### ERROR ###: " + dr["svrModel"].ToString().Trim().ToUpper() + " does not exist<br/>"; intError++; } } lblResults.Text += "<p><hr size=1 noshade/></p>"; lblResults.Text += "Successful: " + intSuccess.ToString() + "<br/>"; lblResults.Text += "Duplicates: " + intDuplicate.ToString() + "<br/>"; lblResults.Text += "Errors: " + intError.ToString() + "<br/>"; break; default: lblResults.Text = "Invalid XML File"; break; } } }
private void LoadLists() { ddlLocation.Enabled = true; ddlLocation.DataValueField = "id"; ddlLocation.DataTextField = "name"; ddlLocation.DataSource = oLocation.GetAddressCommon(); ddlLocation.DataBind(); ddlLocation.Items.Add(new ListItem("-- NOT LISTED --", "-1")); ddlLocation.Items.Insert(0, new ListItem("-- SELECT --", "0")); int intAddress = 0; if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAddress = Int32.Parse(Request.QueryString["aid"]); } if (oLocation.GetAddress(intAddress).Tables[0].Rows.Count > 0) { ddlLocation.SelectedValue = intAddress.ToString(); hdnParent.Value = intAddress.ToString(); if (ddlLocation.SelectedItem.Value == "0") { ddlLocation.SelectedValue = "-1"; panLocation.Visible = true; txtParent.Text = oLocation.GetFull(intAddress); } ddlOS.Enabled = true; ddlOS.DataValueField = "id"; ddlOS.DataTextField = "name"; ddlOS.DataSource = oOperatingSystems.Gets(0, 1); ddlOS.DataBind(); ddlOS.Items.Insert(0, new ListItem("-- SELECT --", "0")); int intOS = 0; if (Request.QueryString["osid"] != null && Request.QueryString["osid"] != "") { intOS = Int32.Parse(Request.QueryString["osid"]); } if (oOperatingSystems.Get(intOS).Tables[0].Rows.Count > 0) { ddlOS.SelectedValue = intOS.ToString(); ddlSP.Enabled = true; ddlSP.DataValueField = "id"; ddlSP.DataTextField = "name"; ddlSP.DataSource = oOperatingSystems.GetServicePack(intOS); ddlSP.DataBind(); ddlSP.Items.Insert(0, new ListItem("-- SELECT --", "0")); int intSP = 0; if (Request.QueryString["spid"] != null && Request.QueryString["spid"] != "") { intSP = Int32.Parse(Request.QueryString["spid"]); } if (oServicePacks.Get(intSP).Tables[0].Rows.Count > 0) { ddlSP.SelectedValue = intSP.ToString(); ddlClass.Enabled = true; ddlClass.DataValueField = "id"; ddlClass.DataTextField = "name"; ddlClass.DataSource = oServerName.GetCodeClasses(intAddress); ddlClass.DataBind(); lblConfig.Visible = (ddlClass.Items.Count == 0); ddlClass.Items.Insert(0, new ListItem("-- SELECT --", "0")); int intClass = 0; if (Request.QueryString["cid"] != null && Request.QueryString["cid"] != "") { intClass = Int32.Parse(Request.QueryString["cid"]); } if (oClass.Get(intClass).Tables[0].Rows.Count > 0) { ddlClass.SelectedValue = intClass.ToString(); ddlEnvironment.Enabled = true; Environments oEnvironment = new Environments(intProfile, dsn); ddlEnvironment.DataValueField = "id"; ddlEnvironment.DataTextField = "name"; ddlEnvironment.DataSource = oServerName.GetCodeEnvironments(intAddress, intClass); ddlEnvironment.DataBind(); lblConfig.Visible = (lblConfig.Visible || ddlEnvironment.Items.Count == 0); ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0")); int intEnv = 0; if (Request.QueryString["eid"] != null && Request.QueryString["eid"] != "") { intEnv = Int32.Parse(Request.QueryString["eid"]); } if (oEnvironment.Get(intEnv).Tables[0].Rows.Count > 0) { ddlEnvironment.SelectedValue = intEnv.ToString(); // Load Models trModels.Visible = true; LoadTypes(oTreeModels); int intModel = 0; if (Request.QueryString["mid"] != null && Request.QueryString["mid"] != "") { intModel = Int32.Parse(Request.QueryString["mid"]); } if (oModelsProperties.Get(intModel).Tables[0].Rows.Count > 0) { lblModel.Text = oModelsProperties.Get(intModel, "name"); ExpandTreeview(oTreeModels, intModel.ToString(), true); // Load Applications ddlApplication.DataValueField = "id"; ddlApplication.DataTextField = "name"; ddlApplication.DataSource = oServerName.GetApplicationPermissionsOS(intOS); ddlApplication.DataBind(); ddlApplication.Items.Insert(0, new ListItem("-- NONE --", "0")); // Load Components panComponents.Visible = true; frmComponents.Attributes.Add("src", "/frame/ondemand/config_server_components.aspx?cid=" + intClass.ToString() + "&eid=" + intEnv.ToString() + "&mid=" + intModel.ToString() + "&osid=" + intOS.ToString() + "&spid=" + intSP.ToString()); // Load Clustering ddlCluster.Items.Add(new ListItem("-- SELECT --", "0")); ddlCluster.Items.Add(new ListItem("Node of a Cluster (Example: NSQ)", "1")); if (oOperatingSystems.Get(intOS, "cluster_name") == "1") { ddlCluster.Items.Add(new ListItem("Cluster Name (Example: CLU)", "2")); } ddlCluster.Items.Add(new ListItem("Cluster Instance Name (Example: CSQ)", "3")); ddlCluster.Items.Add(new ListItem("None of the Above", "4")); btnSubmit.Enabled = true; } else { lblModel.Text = "<i>Please select a Model</i>"; ddlApplication.Enabled = false; ddlApplication.Items.Insert(0, new ListItem("-- Please select a Model --", "0")); ddlCluster.Enabled = false; ddlCluster.Items.Insert(0, new ListItem("-- Please select a Model --", "0")); } } else { lblModel.Text = "<i>Please select an Environment</i>"; ddlApplication.Enabled = false; ddlApplication.Items.Insert(0, new ListItem("-- Please select an Environment --", "0")); ddlCluster.Enabled = false; ddlCluster.Items.Insert(0, new ListItem("-- Please select an Environment --", "0")); } } else { ddlEnvironment.Enabled = false; ddlEnvironment.Items.Insert(0, new ListItem("-- Please select a Class --", "0")); lblModel.Text = "<i>Please select a Class</i>"; ddlApplication.Enabled = false; ddlApplication.Items.Insert(0, new ListItem("-- Please select a Class --", "0")); ddlCluster.Enabled = false; ddlCluster.Items.Insert(0, new ListItem("-- Please select a Class --", "0")); txtName.Enabled = false; } } else { ddlClass.Enabled = false; ddlClass.Items.Insert(0, new ListItem("-- Please select a Service Pack --", "0")); ddlEnvironment.Enabled = false; ddlEnvironment.Items.Insert(0, new ListItem("-- Please select a Service Pack --", "0")); lblModel.Text = "<i>Please select a Service Pack</i>"; ddlApplication.Enabled = false; ddlApplication.Items.Insert(0, new ListItem("-- Please select a Service Pack --", "0")); ddlCluster.Enabled = false; ddlCluster.Items.Insert(0, new ListItem("-- Please select a Service Pack --", "0")); txtName.Enabled = false; } } else { ddlSP.Enabled = false; ddlSP.Items.Insert(0, new ListItem("-- Please select an Operating System --", "0")); ddlClass.Enabled = false; ddlClass.Items.Insert(0, new ListItem("-- Please select an Operating System --", "0")); ddlEnvironment.Enabled = false; ddlEnvironment.Items.Insert(0, new ListItem("-- Please select an Operating System --", "0")); lblModel.Text = "<i>Please select an Operating System</i>"; ddlApplication.Enabled = false; ddlApplication.Items.Insert(0, new ListItem("-- Please select an Operating System --", "0")); ddlCluster.Enabled = false; ddlCluster.Items.Insert(0, new ListItem("-- Please select an Operating System --", "0")); txtName.Enabled = false; } } else { ddlLocation.SelectedValue = intAddress.ToString(); if (intAddress == -1) { panLocation.Visible = true; hdnParent.Value = "0"; } ddlOS.Enabled = false; ddlOS.Items.Insert(0, new ListItem("-- Please select a Location --", "0")); ddlSP.Enabled = false; ddlSP.Items.Insert(0, new ListItem("-- Please select a Location --", "0")); ddlClass.Enabled = false; ddlClass.Items.Insert(0, new ListItem("-- Please select a Location --", "0")); ddlEnvironment.Enabled = false; ddlEnvironment.Items.Insert(0, new ListItem("-- Please select a Location --", "0")); lblModel.Text = "<i>Please select a Location</i>"; ddlApplication.Enabled = false; ddlApplication.Items.Insert(0, new ListItem("-- Please select a Location --", "0")); ddlCluster.Enabled = false; ddlCluster.Items.Insert(0, new ListItem("-- Please select a Location --", "0")); txtName.Enabled = false; } }
protected void btnUpload_Click(Object Sender, EventArgs e) { //Populate already saved assets against this order LoadAssetsForOrder(); boolDetails = false; boolExecution = true; boolStatusUpdates = false; boolChange = false; boolDocuments = false; int intSuccess = 0; int intDuplicate = 0; int intError = 0; ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); if (oFile.PostedFile != null && oFile.FileName != "") { string strPhysical = oVariable.DocumentsFolder() + "xml\\"; if (Directory.Exists(strPhysical) == false) { lblResults.Text = "<b>Created XML directory "" + strPhysical + ""...SUCCESS!</b><br/><br/>"; Directory.CreateDirectory(strPhysical); } else { lblResults.Text = "<b>XML directory "" + strPhysical + "" already exists...</b><br/><br/>"; } lblResults.Text += "<b>Results of File "" + oFile.FileName + ""</b><br/>"; string strFile = strPhysical + oFile.FileName; oFile.PostedFile.SaveAs(strFile); DataSet ds = new DataSet(); ds.ReadXml(strFile); DataTable dtAssetImport = ds.Tables[0]; dtAssetImport.Columns.Add("ValidAsset", System.Type.GetType("System.Int32")); dtAssetImport.Columns.Add("Comments", System.Type.GetType("System.String")); DataRow[] drSelect = null; drSelect = dtAssetImport.Select("svrModel = " + Int32.Parse(hdnModel.Value)); switch (oFile.FileName[0]) { case 'E': // Existing foreach (DataRow dr in drSelect) { int intModel = 0; try { intModel = Int32.Parse(dr["svrModel"].ToString()); } catch { intModel = oModelsProperties.Get(dr["svrModel"].ToString()); } if (intModel > 0) { if (oAsset.Get(dr["svrSerial"].ToString().Trim().ToUpper(), intModel).Tables[0].Rows.Count > 0) { dr["ValidAsset"] = 0; dr["Comments"] = "DUPLICATE: " + dr["svrSerial"].ToString().Trim().ToUpper() + " [" + dr["svrAsset"].ToString().Trim().ToUpper() + "]"; intDuplicate++; } else { dr["ValidAsset"] = 1; intSuccess++; } } else { dr["ValidAsset"] = 0; dr["Comments"] = "### ERROR ###: " + dr["svrModel"].ToString().Trim().ToUpper() + " does not exist"; intError++; } } lblResults.Text += "<p><hr size=1 noshade/></p>"; lblResults.Text += "Duplicates: " + intDuplicate.ToString() + " " + " Errors: " + intError.ToString() + "<br/>"; foreach (DataRow dr in drSelect) { DataRow drAsset = dtAsset.NewRow(); drAsset["Serial"] = dr["svrSerial"].ToString(); drAsset["AssetTag"] = dr["svrAsset"].ToString(); drAsset["ValidAsset"] = dr["ValidAsset"]; drAsset["Comments"] = dr["Comments"]; drAsset["ScanDateTime"] = DateTime.Parse(dr["timeStamp"].ToString()); dtAsset.Rows.Add(drAsset); } dlAssetList.DataSource = dtAsset; dlAssetList.DataBind(); break; case 'S': // New foreach (DataRow dr in drSelect) { int intModel = 0; try { intModel = Int32.Parse(dr["svrModel"].ToString()); } catch { intModel = oModelsProperties.Get(dr["svrModel"].ToString()); } if (intModel > 0) { if (oAsset.Get(dr["svrSerial"].ToString().Trim().ToUpper(), intModel).Tables[0].Rows.Count > 0) { dr["ValidAsset"] = 0; dr["Comments"] = "DUPLICATE: " + dr["svrSerial"].ToString().Trim().ToUpper() + " [" + dr["svrAsset"].ToString().Trim().ToUpper() + "]"; intDuplicate++; } else { dr["ValidAsset"] = 1; intSuccess++; } } else { dr["ValidAsset"] = 0; dr["Comments"] = "### ERROR ###: " + dr["svrModel"].ToString().Trim().ToUpper() + " does not exist"; intError++; } } lblResults.Text += "<p><hr size=1 noshade/></p>"; lblResults.Text += "Duplicates: " + intDuplicate.ToString() + " " + " Errors: " + intError.ToString() + "<br/>"; foreach (DataRow dr in drSelect) { DataRow drAsset = dtAsset.NewRow(); drAsset["Serial"] = dr["svrSerial"].ToString(); drAsset["AssetTag"] = dr["svrAsset"].ToString(); drAsset["ValidAsset"] = dr["ValidAsset"]; drAsset["Comments"] = dr["Comments"]; drAsset["ScanDateTime"] = DateTime.Parse(dr["timeStamp"].ToString()); dtAsset.Rows.Add(drAsset); } dlAssetList.DataSource = dtAsset; dlAssetList.DataBind(); break; default: lblResults.Text = "Invalid XML File"; break; } } }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/asset/asset_switches.aspx"; Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30); if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); } else { Response.Redirect("/admin/login.aspx"); } oAsset = new Asset(intProfile, dsnAsset, dsn); oEnvironment = new Environments(intProfile, dsn); oClass = new Classes(intProfile, dsn); oRacksNew = new RacksNew(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); if (!IsPostBack) { LoadLists(); } if (Request.QueryString["id"] == null) { if (Request.QueryString["parent"] == null) { LoadSwitches(); } else { panAdd.Visible = true; int intParent = Int32.Parse(Request.QueryString["parent"]); if (!IsPostBack) { hdnParent.Value = intParent.ToString(); if (intParent > 0) { lblParent.Text = oRacksNew.Get(intParent, "rack"); } else { lblParent.Text = "** Please Select **"; } txtBlades.Text = "0"; txtPorts.Text = "0"; } } } else { panAdd.Visible = true; intID = Int32.Parse(Request.QueryString["id"]); if (!IsPostBack) { DataSet ds = oAsset.GetSwitch(intID); int intParent = Int32.Parse(ds.Tables[0].Rows[0]["rackid"].ToString()); hdnParent.Value = intParent.ToString(); txtSerial.Text = ds.Tables[0].Rows[0]["serial"].ToString(); txtAsset.Text = ds.Tables[0].Rows[0]["asset"].ToString(); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); hdnModel.Value = intModel.ToString(); int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); int intType = oModel.GetType(intModelParent); int intPlatform = oType.GetPlatform(intType); if (intPlatform > 0) { ddlPlatform.SelectedValue = intPlatform.ToString(); // Load Types LoadDDL(ddlType, "name", "id", oType.Gets(intPlatform, 1), intType.ToString()); if (intType > 0) { // Load Models LoadDDL(ddlModel, "name", "id", oModel.Gets(intType, 1), intModelParent.ToString()); if (intModelParent > 0) { // Load Model Properties LoadDDL(ddlModelProperty, "name", "id", oModelsProperties.GetModels(1, intModelParent, 1), intModel.ToString()); } } } txtName.Text = ds.Tables[0].Rows[0]["name"].ToString(); lblParent.Text = ds.Tables[0].Rows[0]["rack"].ToString(); txtRackPosition.Text = ds.Tables[0].Rows[0]["rackposition"].ToString(); txtBlades.Text = ds.Tables[0].Rows[0]["blades"].ToString(); txtPorts.Text = ds.Tables[0].Rows[0]["ports"].ToString(); chkIsIOS.Checked = (ds.Tables[0].Rows[0]["is_ios"].ToString() == "1"); chkIsNexus.Checked = (ds.Tables[0].Rows[0]["nexus"].ToString() == "1"); chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1"); } } btnParent.Attributes.Add("onclick", "LoadLocationRoomRack('" + "rack" + "','" + hdnParent.ClientID + "', '', '','', '" + lblParent.ClientID + "');return false;"); ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',1);"); ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');"); ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlType.ClientID + "','" + ddlModel.ClientID + "','" + ddlModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlType.ClientID + "','" + ddlModel.ClientID + "','" + ddlModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlModel.ClientID + "','" + ddlModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlModelProperty.ClientID + "','" + hdnModel.ClientID + "');"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); }
protected void Page_Load(object sender, EventArgs e) { OnDemand oOnDemand = new OnDemand(0, dsn); Forecast oForecast = new Forecast(0, dsn); Workstations oWorkstation = new Workstations(0, dsn); Models oModel = new Models(0, dsn); Users oUser = new Users(0, dsn); ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); Functions oFunction = new Functions(0, dsn, intEnvironment); Asset oAsset = new Asset(0, dsnAsset); Tokens oToken = new Tokens(0, dsn); string strOnLoad = ""; string strError = ""; if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { int intWorkstation = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["id"])); DataSet ds = oWorkstation.GetVirtual(intWorkstation); if (ds.Tables[0].Rows.Count > 0) { int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); int intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString()); if (intAsset > 0 && oAsset.Get(intAsset, "name") != "") { strName = oAsset.Get(intAsset, "name"); } else { strName = "Device " + Request.QueryString["c"]; } int intModel = oForecast.GetModelAsset(intAnswer); if (intModel == 0) { intModel = oForecast.GetModel(intAnswer); } intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); int intType = oModel.GetType(intModel); int intCurrent = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString()); int intCurrentWithError = oWorkstation.GetVirtualStep(intWorkstation); strPreviewName = strName; DataSet dsSteps = oOnDemand.GetSteps(intType, 1); if (dsSteps.Tables[0].Rows.Count >= intCurrent) { int intNewStep = Int32.Parse(dsSteps.Tables[0].Rows[intCurrent - 1]["id"].ToString()); DataSet dsStep = oOnDemand.GetStep(intNewStep); if (dsStep.Tables[0].Rows.Count > 0) { string strPath = dsStep.Tables[0].Rows[0]["path"].ToString(); if (dsStep.Tables[0].Rows[0]["show_build"].ToString() == "1") { chkPreview.Disabled = false; if (!IsPostBack && Request.QueryString["preview"] != null) { intShowBuild = 1; chkPreview.Checked = true; // Token strPreviewToken = oToken.Add(strPreviewName, 50); } } else { chkPreview.Disabled = true; } if (strPath != "") { Control oControl = (Control)LoadControl(strPath); PH.Controls.Add(oControl); strOnLoad = "redirectWait();"; } else { strOnLoad = "redirectAJAX('" + intWorkstation.ToString() + "','" + intCurrentWithError.ToString() + "');"; } } } else { panDone.Visible = true; if (ds.Tables[0].Rows[0]["completed"].ToString() != "") { lblCompleted.Text = DateTime.Parse(ds.Tables[0].Rows[0]["completed"].ToString()).ToString(); } else { lblCompleted.Text = DateTime.Now.ToString(); } } int intStep = 0; StringBuilder sbStep = new StringBuilder(); bool boolError = false; foreach (DataRow drStep in dsSteps.Tables[0].Rows) { intStep++; string strClass = "cantclose"; if (drStep["type"].ToString() == "1") { strClass = "canclose"; } if (drStep["type"].ToString() == "-1") { strClass = "default"; } DataSet dsResult = oOnDemand.GetStepDoneWorkstation(intWorkstation, intStep); if (intStep < intCurrent) { string strImage = "<img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\">"; string strDone = ""; string strMessage = ""; if (dsResult.Tables[0].Rows.Count > 0) { foreach (DataRow drResult in dsResult.Tables[0].Rows) { strMessage += drResult["result"].ToString(); } if (dsResult.Tables[0].Rows[0]["finished"].ToString() != "") { strDone = " (" + DateTime.Parse(dsResult.Tables[0].Rows[0]["finished"].ToString()).ToString() + ")"; } } sbStep.Append("<tr><td>"); sbStep.Append(strImage); sbStep.Append("</td><td nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHideResult('divResult_"); sbStep.Append(intAnswer.ToString()); sbStep.Append("_"); sbStep.Append(intStep.ToString()); sbStep.Append("');\">"); sbStep.Append(drStep["title"].ToString()); sbStep.Append("</a>"); sbStep.Append(strDone); sbStep.Append("</td></tr>"); sbStep.Append("<tr id=\"divResult_"); sbStep.Append(intAnswer.ToString()); sbStep.Append("_"); sbStep.Append(intStep.ToString()); sbStep.Append("\" style=\"display:none\"><td></td><td>"); sbStep.Append(strMessage == "" ? "No information" : strMessage); sbStep.Append("</td></tr>"); } else if (intStep == intCurrent) { strError = ""; if (dsResult.Tables[0].Rows.Count > 0) { if (dsResult.Tables[0].Rows[0]["error"].ToString() == "1") { boolError = true; sbStep.Append("<tr><td><img src=\"/images/error.gif\" border=\"0\" align=\"absmiddle\"></td><td class=\""); sbStep.Append(strClass); sbStep.Append("\" nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHideResult('divResult_"); sbStep.Append(intAnswer.ToString()); sbStep.Append("_"); sbStep.Append(intStep.ToString()); sbStep.Append("');\">"); sbStep.Append(drStep["title"].ToString()); sbStep.Append("</a></td></tr>"); sbStep.Append("<tr id=\"divResult_"); sbStep.Append(intAnswer.ToString()); sbStep.Append("_"); sbStep.Append(intStep.ToString()); sbStep.Append("\" style=\"display:none\"><td></td><td>"); strError = dsResult.Tables[0].Rows[0]["result"].ToString(); if (strError.Contains("~") == true) { strError = strError.Substring(0, strError.IndexOf("~")); } sbStep.Append(strError); DataSet dsError = oWorkstation.GetVirtualError(intWorkstation, intStep); string incident = ""; int assigned = 0; if (dsError.Tables[0].Rows.Count > 0) { incident = dsError.Tables[0].Rows[0]["incident"].ToString(); Int32.TryParse(dsError.Tables[0].Rows[0]["assigned"].ToString(), out assigned); if (string.IsNullOrEmpty(incident) == false) { sbStep.Append("<br/><br/>Tracking # " + incident); bool IncidentFound = false; DataSet dsKey = oFunction.GetSetupValuesByKey("INCIDENTS"); if (dsKey.Tables[0].Rows.Count > 0) { string incidents = dsKey.Tables[0].Rows[0]["Value"].ToString(); StreamReader theReader = new StreamReader(incidents); string theContents = theReader.ReadToEnd(); string[] theLines = theContents.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string theLine in theLines) { if (theLine.Contains(incident)) { IncidentFound = true; string[] theFields = theLine.Split(new char[] { ',' }, StringSplitOptions.None); string person = theFields[5].Replace("\"", ""); if (String.IsNullOrEmpty(person) == false) { sbStep.Append("<br/>Assigned To: " + person); } string group = theFields[4].Replace("\"", ""); if (String.IsNullOrEmpty(group) == false) { sbStep.Append("<br/>Group: " + group); } break; } } } if (IncidentFound == false) { if (assigned > 0) { sbStep.Append("<br/>Assigned To: " + oUser.GetFullNameWithLanID(assigned)); } } } } if (strError != "") { sbStep.Append("<br/><br/><a class='build_error' href=\"javascript:void(0);\" onclick=\"OpenWindow('PROVISIONING_ERROR', '"); sbStep.Append(oFunction.encryptQueryString(dsResult.Tables[0].Rows[0]["result"].ToString())); sbStep.Append("');\"><img src='/images/plus.gif' border='0' align='absmiddle'/> For more information about this error, click here</a>"); } sbStep.Append("</td></tr>"); } } if (boolError == false) { if (drStep["interact_path"].ToString() == "") { sbStep.Append("<tr><td><img src=\"/images/green_arrow.gif\" border=\"0\" align=\"absmiddle\"></td><td class=\""); sbStep.Append(strClass); sbStep.Append("\" nowrap><b>"); sbStep.Append(drStep["title"].ToString()); sbStep.Append("</b></td></tr>"); } else { sbStep.Append("<tr><td><img src=\"/images/alert.gif\" border=\"0\" align=\"absmiddle\"></td><td class=\""); sbStep.Append(strClass); sbStep.Append("\" nowrap><b>"); sbStep.Append(drStep["title"].ToString()); sbStep.Append("</b></td></tr>"); sbStep.Append("<tr><td></td><td><input type=\"button\" onclick=\"OpenWindow('NEW_WINDOW','"); sbStep.Append(drStep["interact_path"].ToString()); sbStep.Append("?id="); sbStep.Append(intWorkstation.ToString()); sbStep.Append("');\" value=\"Click Here\" class=\"default\" style=\"width:100px\"></td></tr>"); } } } else if (intStep > intCurrent) { sbStep.Append("<tr><td></td><td class=\""); sbStep.Append(strClass); sbStep.Append("\">"); sbStep.Append(drStep["title"].ToString()); sbStep.Append("</td></tr>"); } } sbStep.Insert(0, "<p><table border=\"0\" cellpadding=\"4\" cellspacing=\"3\">"); sbStep.Append("</table></p>"); strResult += sbStep.ToString(); //DateTime datSubmitted = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()); //lblDate.Text = datSubmitted.ToString(); //Holidays oHoliday = new Holidays(0, dsn); //lblDelivered.Text = oHoliday.GetDays(10.00, datSubmitted).ToString(); } } else { Response.Write("Invalid Configuration - validate host configuration"); } if (strOnLoad != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "start_count", "<script type=\"text/javascript\">window.onload = new Function(\"" + strOnLoad + "\");" + (strError == "" ? "" : "LoadError('" + strError.Replace("'", "") + "');") + "<" + "/" + "script>"); } }
private void CheckResults(string strQuery) { DataSet ds = oServer.Get(strQuery, false); if (ds.Tables[0].Rows.Count == 1) { panSearch.Visible = true; lblServer.Text = strQuery.ToUpper(); int intAnswer = 0; int intProject = 0; if (ds.Tables[0].Rows[0]["answerid"].ToString() != "") { intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); } if (ds.Tables[0].Rows[0]["projectid"].ToString() != "") { intProject = Int32.Parse(ds.Tables[0].Rows[0]["projectid"].ToString()); } if (intProject > 0 && intAnswer > 0) { ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn); Types oType = new Types(intProfile, dsn); int intServer = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); strResults += "<tr><td nowrap>Server Name Generation:</td><td width=\"100%\">Generated via On-Demand Server Auto-Provisioning</td></tr>"; strResults += "<tr><td nowrap>Project ID:</td><td width=\"100%\">" + intProject.ToString() + "</td></tr>"; strResults += "<tr><td nowrap>Project Name:</td><td width=\"100%\">" + ds.Tables[0].Rows[0]["name"].ToString() + "</td></tr>"; strResults += "<tr><td nowrap>Project Number:</td><td width=\"100%\">" + ds.Tables[0].Rows[0]["number"].ToString() + "</td></tr>"; int intLead = 0; if (ds.Tables[0].Rows[0]["lead"].ToString() != "") { intLead = Int32.Parse(ds.Tables[0].Rows[0]["lead"].ToString()); } strResults += "<tr><td nowrap>Project Lead:</td><td width=\"100%\">" + oUser.GetFullName(intLead) + " (" + oUser.GetName(intLead) + ")</td></tr>"; int intEngineer = 0; if (ds.Tables[0].Rows[0]["engineer"].ToString() != "") { intEngineer = Int32.Parse(ds.Tables[0].Rows[0]["engineer"].ToString()); } strResults += "<tr><td nowrap>Integration Engineer:</td><td width=\"100%\">" + oUser.GetFullName(intEngineer) + " (" + oUser.GetName(intEngineer) + ")</td></tr>"; strResults += "<tr><td nowrap>Implementor:</td><td width=\"100%\">" + GetImplementor(intProject, intAnswer) + "</td></tr>"; int intBackup = Int32.Parse(oForecast.GetAnswer(intAnswer, "backup")); DataSet dsBackup = oOnDemandTasks.GetServerBackup(intAnswer); if (dsBackup.Tables[0].Rows.Count > 0) { int intRequestB = Int32.Parse(dsBackup.Tables[0].Rows[0]["requestid"].ToString()); int intItemB = Int32.Parse(dsBackup.Tables[0].Rows[0]["itemid"].ToString()); int intNumberB = Int32.Parse(dsBackup.Tables[0].Rows[0]["number"].ToString()); DataSet dsResourceB = oResourceRequest.Get(intRequestB, intItemB, intNumberB); if (dsResourceB.Tables[0].Rows.Count > 0) { strResults += "<tr><td nowrap>Backup:</td>"; string strUsersB = ""; foreach (DataRow drResourceB in dsResourceB.Tables[0].Rows) { int intUserB = Int32.Parse(drResourceB["userid"].ToString()); if (strUsersB != "") { strUsersB += ", "; } strUsersB += oUser.GetFullName(intUserB) + " (" + (dsBackup.Tables[0].Rows[0]["chk1"].ToString() == "1" ? "Complete" : "Incomplete") + ")"; } strResults += "<td width=\"100%\">" + strUsersB + "</td></tr>"; } else { strResults += "<tr><td nowrap>Backup:</td><td width=\"100%\">Pending Assignment</td></tr>"; } } else { strResults += "<tr><td nowrap>Backup:</td><td width=\"100%\">Not Submitted (" + (intBackup == 1 ? "Client <b>DID</b> Request a Backup" : "Client <b>DID NOT</b> Request a Backup") + ")</td></tr>"; } if (oModelsProperties.IsTypeVMware(intModel) == false) { int intStorage = Int32.Parse(oForecast.GetAnswer(intAnswer, "storage")); DataSet dsStorageT = oOnDemandTasks.GetServerStorage(intAnswer, 0); if (dsStorageT.Tables[0].Rows.Count > 0) { int intRequestST = Int32.Parse(dsStorageT.Tables[0].Rows[0]["requestid"].ToString()); int intItemST = Int32.Parse(dsStorageT.Tables[0].Rows[0]["itemid"].ToString()); int intNumberST = Int32.Parse(dsStorageT.Tables[0].Rows[0]["number"].ToString()); DataSet dsResourceST = oResourceRequest.Get(intRequestST, intItemST, intNumberST); if (dsResourceST.Tables[0].Rows.Count > 0) { strResults += "<tr><td nowrap>Storage (TEST):</td>"; string strUsersST = ""; foreach (DataRow drResourceST in dsResourceST.Tables[0].Rows) { int intUserST = Int32.Parse(drResourceST["userid"].ToString()); if (strUsersST != "") { strUsersST += ", "; } strUsersST += oUser.GetFullName(intUserST) + " (" + (dsStorageT.Tables[0].Rows[0]["chk1"].ToString() == "1" ? "Complete" : "Incomplete") + ")"; } strResults += "<td width=\"100%\">" + strUsersST + "</td></tr>"; } else { strResults += "<tr><td nowrap>Storage (TEST):</td><td width=\"100%\">Pending Assignment</td></tr>"; } } else { strResults += "<tr><td nowrap>Storage (TEST):</td><td width=\"100%\">Not Submitted (" + (intStorage == 1 ? "Client <b>DID</b> Request TEST Storage" : "Client <b>DID NOT</b> Request TEST Storage") + ")</td></tr>"; } DataSet dsStorageP = oOnDemandTasks.GetServerStorage(intAnswer, 1); if (dsStorageP.Tables[0].Rows.Count > 0) { int intRequestSP = Int32.Parse(dsStorageP.Tables[0].Rows[0]["requestid"].ToString()); int intItemSP = Int32.Parse(dsStorageP.Tables[0].Rows[0]["itemid"].ToString()); int intNumberSP = Int32.Parse(dsStorageP.Tables[0].Rows[0]["number"].ToString()); DataSet dsResourceSP = oResourceRequest.Get(intRequestSP, intItemSP, intNumberSP); if (dsResourceSP.Tables[0].Rows.Count > 0) { strResults += "<tr><td nowrap>Storage (PROD):</td>"; string strUsersSP = ""; foreach (DataRow drResourceSP in dsResourceSP.Tables[0].Rows) { int intUserSP = Int32.Parse(drResourceSP["userid"].ToString()); if (strUsersSP != "") { strUsersSP += ", "; } strUsersSP += oUser.GetFullName(intUserSP) + " (" + (dsStorageP.Tables[0].Rows[0]["chk1"].ToString() == "1" ? "Complete" : "Incomplete") + ")"; } strResults += "<td width=\"100%\">" + strUsersSP + "</td></tr>"; } else { strResults += "<tr><td nowrap>Storage (PROD):</td><td width=\"100%\">Pending Assignment</td></tr>"; } } else { strResults += "<tr><td nowrap>Storage (PROD):</td><td width=\"100%\">Not Submitted (" + (intStorage == 1 ? "Client <b>DID</b> Request PROD Storage" : "Client <b>DID NOT</b> Request PROD Storage") + ")</td></tr>"; } } else { strResults += "<tr><td nowrap>Storage (TEST):</td><td width=\"100%\">VMware Does Not Require Storage Configuration</td></tr>"; strResults += "<tr><td nowrap>Storage (PROD):</td><td width=\"100%\">VMware Does Not Require Storage Configuration</td></tr>"; } strResults += "<tr><td nowrap>Model:</td><td width=\"100%\">" + oModelsProperties.Get(intModel, "name") + "</td></tr>"; strResults += "<tr><td nowrap>NickName:</td><td width=\"100%\">" + oForecast.GetAnswer(intAnswer, "name") + "</td></tr>"; strResults += "<tr><td nowrap>Current State:</td><td width=\"100%\">" + (ds.Tables[0].Rows[0]["step"].ToString() == "0" ? "Awaiting Execution" : (ds.Tables[0].Rows[0]["step"].ToString() == "999" ? "Completed Build" : "Building...")) + "</td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_tsm.aspx?id=" + intAnswer.ToString() + "\">Click here to view the TSM Registration Form</a></td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_san.aspx?id=" + intAnswer.ToString() + "\">Click here to view the SAN Registration Form (TEST)</a></td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_san.aspx?id=" + intAnswer.ToString() + "&prod=true\">Click here to view the SAN Registration Form (PROD)</a></td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/html.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_sc.aspx?id=" + intServer.ToString() + "\">Click here to view the Service Center Request</a></td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_birth.aspx?id=" + intAnswer.ToString() + "\">Click here to view the Birth Certificate</a></td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/file.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');\">Click here to view the design</a></td></tr>"; strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/file.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"" + oPage.GetFullLink(intDesignBuilder) + "?id=" + oForecast.GetAnswer(intAnswer, "forecastid") + "&highlight=" + intAnswer.ToString() + "\" target=\"_blank\">Click here to view the OVERALL design</a></td></tr>"; int intType = oModelsProperties.GetType(intModel); string strExecute = oType.Get(intType, "forecast_execution_path"); if (strExecute != "") { strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/user.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=2&view=true');\">Click here to view the application configuration</a></td></tr>"; if (oForecast.IsOSDistributed(intAnswer) == true) { if (oForecast.IsHACluster(intAnswer) == true) { strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>"; } else { strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>"; } strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/calendar.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=4&view=true');\">Click here to view the production go live date</a></td></tr>"; } else { if (oForecast.IsHACluster(intAnswer) == true) { strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>"; } else { strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>"; } strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/calendar.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=4&view=true');\">Click here to view the production go live date</a></td></tr>"; } strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');\">Click here to view the execution</a></td></tr>"; } strResults += "<tr><td nowrap colspan=\"2\" class=\"header\"><b>Asset History:</b></td></tr>"; string strAssets = ""; DataSet dsAssets = oServer.GetAssets(intServer); foreach (DataRow drAsset in dsAssets.Tables[0].Rows) { strAssets += "<tr><td>" + drAsset["serial"].ToString() + "</td><td>" + drAsset["asset"].ToString() + "</td><td>" + drAsset["model"].ToString() + "</td><td>" + drAsset["class"].ToString() + "</td><td>" + drAsset["environment"].ToString() + "</td><td>" + drAsset["datestamp"].ToString() + "</td></tr>"; } if (strAssets == "") { strAssets += "<tr><td colspan=\"6\"><img src=\"/images/alert.gif\" border=\"0\" align=\"absmiddle\"/> There are no assets</td></tr>"; } strAssets = "<tr class=\"bold\"><td>Serial</td><td>Asset</td><td>Model</td><td>Class</td><td>Environment</td><td>DateStamp</td></tr>" + strAssets; strAssets = "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\">" + strAssets + "</table>"; strResults += "<tr><td nowrap colspan=\"2\">" + strAssets + "</td></tr>"; } else { strResults += "<tr><td nowrap>Server Name Generation:</td><td width=\"100%\">Generated via Custom Functions, Server Names</td></tr>"; int intUser = Int32.Parse(ds.Tables[0].Rows[0]["servernameuserid"].ToString()); strResults += "<tr><td nowrap>Implementor:</td><td width=\"100%\">" + oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")</td></tr>"; strResults += "<tr><td nowrap>Description:</td><td width=\"100%\">" + ds.Tables[0].Rows[0]["description"].ToString() + "</td></tr>"; } } else { panMultiple.Visible = true; foreach (DataRow dr in ds.Tables[0].Rows) { strMultiple += "<tr onmouseover=\"CellRowOver(this);\" onmouseout=\"CellRowOut(this);\" onclick=\"window.navigate('" + oPage.GetFullLink(intPage) + "?name=" + oFunctions.encryptQueryString(dr["servername"].ToString()) + "');\">"; int intAnswer = 0; int intProject = 0; if (dr["answerid"].ToString() != "") { intAnswer = Int32.Parse(dr["answerid"].ToString()); } if (dr["projectid"].ToString() != "") { intProject = Int32.Parse(dr["projectid"].ToString()); } strMultiple += "<td>" + dr["servername"].ToString() + "</td>"; if (intAnswer == 0 && intProject == 0) { int intImplementor = Int32.Parse(dr["servernameuserid"].ToString()); strMultiple += "<td>" + oUser.GetFullName(intImplementor) + " (" + oUser.GetName(intImplementor) + ")" + "</td>"; strMultiple += "<td>Custom Function</td>"; } else if (intAnswer > 0 && intProject > 0) { strMultiple += "<td>" + GetImplementor(intProject, intAnswer) + "</td>"; strMultiple += "<td>Design Builder Execution</td>"; } else { strMultiple += "<td>*** ERROR ***</td>"; strMultiple += "<td>???</td>"; } strMultiple += "<td>" + dr["name"].ToString() + "</td>"; strMultiple += "<td>" + dr["number"].ToString() + "</td>"; strMultiple += "</tr>"; } } }
private bool LoadInformation(int _request_workflow) { if (intProject > 0) { lblName.Text = oProject.Get(intProject, "name"); lblNumber.Text = oProject.Get(intProject, "number"); lblType.Text = "Project"; } else { lblName.Text = oResourceRequest.GetWorkflow(_request_workflow, "name"); lblNumber.Text = "CVT" + intRequest.ToString(); lblType.Text = "Task"; } bool boolDone = false; DataSet ds = oOnDemandTasks.GetVMWareII(intRequest, intItem, intNumber); if (ds.Tables[0].Rows.Count > 0) { Forecast oForecast = new Forecast(intProfile, dsn); int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); if (oForecast.IsHARoom(intAnswer) == true) { DataSet dsServer = oServer.GetAnswer(intAnswer); foreach (DataRow drServer in dsServer.Tables[0].Rows) { int intHA = Int32.Parse(drServer["id"].ToString()); DataSet dsHA = oServer.GetHA(intHA); if (dsHA.Tables[0].Rows.Count > 0) { if (lblHA.Text != "") { lblHA.Text += "<br/>"; } lblHA.Text += oServer.GetName(intHA, true) + " = " + oServer.GetName(Int32.Parse(dsHA.Tables[0].Rows[0]["serverid_ha"].ToString()), true); panHA.Visible = true; } } } lblAnswer.Text = intAnswer.ToString(); btnView.Attributes.Add("onclick", "return OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');"); btnBirth.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');"); btnSC.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');"); lblView.Text = oOnDemandTasks.GetBody(intAnswer, intImplementorDistributed, intImplementorMidrange); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); Models oModel = new Models(intProfile, dsn); int intType = Int32.Parse(oModel.Get(intModel, "typeid")); Types oType = new Types(intProfile, dsn); string strExecute = oType.Get(intType, "forecast_execution_path"); if (strExecute != "") { btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');"); } chk1.Checked = (ds.Tables[0].Rows[0]["chk1"].ToString() == "1"); chk3.Checked = (ds.Tables[0].Rows[0]["chk3"].ToString() == "1"); chk4.Checked = (ds.Tables[0].Rows[0]["chk4"].ToString() == "1"); chk5.Checked = (ds.Tables[0].Rows[0]["chk5"].ToString() == "1"); chk6.Checked = (ds.Tables[0].Rows[0]["chk6"].ToString() == "1"); chk7.Checked = (ds.Tables[0].Rows[0]["chk7"].ToString() == "1"); chk8.Checked = (ds.Tables[0].Rows[0]["chk8"].ToString() == "1"); chk9.Checked = (ds.Tables[0].Rows[0]["chk9"].ToString() == "1"); chk10.Checked = (ds.Tables[0].Rows[0]["chk10"].ToString() == "1"); chk11.Checked = (ds.Tables[0].Rows[0]["chk11"].ToString() == "1"); int intNotifications = Int32.Parse(ds.Tables[0].Rows[0]["notifications"].ToString()); int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")); if (oClass.Get(intClass, "prod") != "1") { chk9.Checked = true; img9.ImageUrl = "/images/cancel.gif"; chk10.Checked = true; img10.ImageUrl = "/images/cancel.gif"; chk11.Checked = true; img11.ImageUrl = "/images/cancel.gif"; } boolDone = (chk1.Checked && chk3.Checked && chk4.Checked && chk5.Checked && chk6.Checked && chk7.Checked && chk8.Checked && chk9.Checked && chk10.Checked && chk11.Checked); img1.ImageUrl = "/images/green_arrow.gif"; if (chk1.Checked == true) { btnExecute.Enabled = false; img1.ImageUrl = "/images/check.gif"; img3.ImageUrl = "/images/green_arrow.gif"; chk3.Enabled = true; Servers oServer = new Servers(intProfile, dsn); DataSet dsAnswer = oServer.GetAnswer(intAnswer); foreach (DataRow drAnswer in dsAnswer.Tables[0].Rows) { if (lbl1.Text != "") { lbl1.Text += "<br/>"; } int intServer = Int32.Parse(drAnswer["id"].ToString()); int intServerName = Int32.Parse(drAnswer["nameid"].ToString()); ServerName oServerName = new ServerName(0, dsn); string strName = oServer.GetName(intServer, boolUsePNCNaming); lbl1.Text += "Server Name: " + strName + "<br/>"; Zeus oZeus = new Zeus(intProfile, dsnZeus); DataSet dsZeus = oZeus.GetBuildServer(intServer); if (dsZeus.Tables[0].Rows.Count > 0) { lbl1.Text += "Serial Number: " + dsZeus.Tables[0].Rows[0]["serial"].ToString() + "<br/>"; lbl1.Text += "Asset Tag: " + dsZeus.Tables[0].Rows[0]["asset"].ToString() + "<br/>"; } int intDomain = Int32.Parse(drAnswer["domainid"].ToString()); Domains oDomain = new Domains(intProfile, dsn); boolMove = (oDomain.Get(intDomain, "move") == "1"); if (boolMove == true) { lbl1.Text += "DHCP Address: " + drAnswer["dhcp"].ToString() + "<br/>"; } int intIPAddress = 0; IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn); lbl1.Text += "Assigned IP Address: " + oServer.GetIPs(intServer, 1, 0, 0, dsnIP, "", "") + "<br/>"; lbl1.Text += "Final IP Address: " + oServer.GetIPs(intServer, 0, 1, 0, dsnIP, "", "") + "<br/>"; Asset oAsset = new Asset(intProfile, dsnAsset); VMWare oVMWare = new VMWare(intProfile, dsn); int intAsset = 0; if (drAnswer["assetid"].ToString() != "") { intAsset = Int32.Parse(drAnswer["assetid"].ToString()); } if (intAsset > 0) { DataSet dsGuest = oVMWare.GetGuest(strName); if (dsGuest.Tables[0].Rows.Count > 0) { int intHost = Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString()); int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid")); int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid")); int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid")); lbl1.Text += "DataCenter: " + oVMWare.GetDatacenter(intDataCenter, "name") + "<br/>"; lbl1.Text += "Host: " + oVMWare.GetHost(intHost, "name") + "<br/>"; int intDatastore = Int32.Parse(dsGuest.Tables[0].Rows[0]["datastoreid"].ToString()); lbl1.Text += "DataStore: " + oVMWare.GetDatastore(intDatastore, "name") + "<br/>"; int intPool = Int32.Parse(dsGuest.Tables[0].Rows[0]["poolid"].ToString()); //lbl1.Text += "Pool: " + oVMWare.GetPool(intPool, "name") + "<br/>"; int intVlan = Int32.Parse(dsGuest.Tables[0].Rows[0]["vlanid"].ToString()); lbl1.Text += "VLAN: " + oVMWare.GetVlan(intVlan, "name") + "<br/>"; } } Storage oStorage = new Storage(intProfile, dsn); int intCluster2 = Int32.Parse(drAnswer["clusterid"].ToString()); int intCSMConfig2 = Int32.Parse(drAnswer["csmconfigid"].ToString()); int intNumber2 = Int32.Parse(drAnswer["number"].ToString()); DataSet dsLuns = oStorage.GetLuns(intAnswer, 0, intCluster2, intCSMConfig2, intNumber2); StringBuilder sbStorage = new StringBuilder(); int intRow = 0; bool boolOverride = (oForecast.GetAnswer(intAnswer, "storage_override") == "1"); foreach (DataRow drLun in dsLuns.Tables[0].Rows) { intRow++; sbStorage.Append("<tr>"); sbStorage.Append("<td>"); sbStorage.Append(intRow.ToString()); sbStorage.Append("</td>"); string strLetter = drLun["letter"].ToString(); if (strLetter == "") { if (drLun["driveid"].ToString() == "-1000") { strLetter = "E"; } else if (drLun["driveid"].ToString() == "-100") { strLetter = "F"; } else if (drLun["driveid"].ToString() == "-10") { strLetter = "P"; } else if (drLun["driveid"].ToString() == "-1") { strLetter = "Q"; } } if ((boolOverride == true && drLun["driveid"].ToString() == "0") || oForecast.IsOSMidrange(intAnswer) == true) { sbStorage.Append("<td>"); sbStorage.Append(drLun["path"].ToString()); sbStorage.Append("</td>"); } else { sbStorage.Append("<td>"); sbStorage.Append(strLetter); sbStorage.Append(":"); sbStorage.Append(drLun["path"].ToString()); sbStorage.Append("</td>"); } sbStorage.Append("<td>"); sbStorage.Append(drLun["performance"].ToString()); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["size"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_size"].ToString() == "-1" ? "Pending" : drLun["actual_size"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["size_qa"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_size_qa"].ToString() == "-1" ? "Pending" : drLun["actual_size_qa"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["size_test"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_size_test"].ToString() == "-1" ? "Pending" : drLun["actual_size_test"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["replicated"].ToString() == "0" ? "No" : "Yes"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_replicated"].ToString() == "-1" ? "Pending" : (drLun["actual_replicated"].ToString() == "0" ? "No" : "Yes")); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drLun["high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["size"].ToString() + " GB)"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drLun["actual_high_availability"].ToString() == "-1" ? "Pending" : (drLun["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["actual_size"].ToString() + " GB)")); sbStorage.Append("</td>"); sbStorage.Append("</tr>"); DataSet dsPoints = oStorage.GetMountPoints(Int32.Parse(drLun["id"].ToString())); int intPoint = 0; foreach (DataRow drPoint in dsPoints.Tables[0].Rows) { intRow++; intPoint++; sbStorage.Append("<tr>"); sbStorage.Append("<td>"); sbStorage.Append(intRow.ToString()); sbStorage.Append("</td>"); if (oForecast.IsOSMidrange(intAnswer) == true) { sbStorage.Append("<td>"); sbStorage.Append(drPoint["path"].ToString()); sbStorage.Append("</td>"); } else { sbStorage.Append("<td>"); sbStorage.Append(strLetter); sbStorage.Append(":\\SH"); sbStorage.Append(drLun["driveid"].ToString()); sbStorage.Append("VOL"); sbStorage.Append(intPoint < 10 ? "0" : ""); sbStorage.Append(intPoint.ToString()); sbStorage.Append("</td>"); } sbStorage.Append("<td>"); sbStorage.Append(drPoint["performance"].ToString()); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["size"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_size"].ToString() == "-1" ? "Pending" : drPoint["actual_size"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["size_qa"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_size_qa"].ToString() == "-1" ? "Pending" : drPoint["actual_size_qa"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["size_test"].ToString()); sbStorage.Append(" GB</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_size_test"].ToString() == "-1" ? "Pending" : drPoint["actual_size_test"].ToString() + " GB"); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["replicated"].ToString() == "0" ? "No" : "Yes"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_replicated"].ToString() == "-1" ? "Pending" : (drPoint["actual_replicated"].ToString() == "0" ? "No" : "Yes")); sbStorage.Append("</td>"); sbStorage.Append("<td>"); sbStorage.Append(drPoint["high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["size"].ToString() + " GB)"); sbStorage.Append("</td>"); sbStorage.Append("<td class=\"required\">"); sbStorage.Append(drPoint["actual_high_availability"].ToString() == "-1" ? "Pending" : (drPoint["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["actual_size"].ToString() + " GB)")); sbStorage.Append("</td>"); sbStorage.Append("</tr>"); } } if (sbStorage.ToString() != "") { sbStorage.Insert(0, "<tr class=\"bold\"><td></td><td>Path</td><td>Performance</td><td>Requested<br/>Size in Prod</td><td>Actual<br/>Size in Prod</td><td>Requested<br/>Size in QA</td><td>Actual<br/>Size in QA</td><td>Requested<br/>Size in Test</td><td>Actual<br/>Size in Test</td><td>Requested<br/>Replication</td><td>Actual<br/>Replication</td><td>Requested<br/>High Availability</td><td>Actual<br/>High Availability</td></tr>"); sbStorage.Insert(0, "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">"); sbStorage.Append("</table>"); } lbl1.Text += sbStorage.ToString(); } } if (chk3.Checked == true) { img3.ImageUrl = "/images/check.gif"; img4.ImageUrl = "/images/green_arrow.gif"; chk4.Enabled = true; } if (chk4.Checked == true) { img4.ImageUrl = "/images/check.gif"; if (boolMove == true) { img5.ImageUrl = "/images/green_arrow.gif"; chk5.Enabled = true; } else { chk5.Checked = true; img7.ImageUrl = "/images/green_arrow.gif"; chk7.Enabled = true; } } if (chk5.Checked == true) { if (boolMove == true) { img5.ImageUrl = "/images/check.gif"; } else { img5.ImageUrl = "/images/cancel.gif"; } if (boolMove == true) { img6.ImageUrl = "/images/green_arrow.gif"; chk6.Enabled = true; } } if (chk6.Checked == true) { if (boolMove == true) { img6.ImageUrl = "/images/check.gif"; } else { img6.ImageUrl = "/images/cancel.gif"; } if (boolMove == true) { img7.ImageUrl = "/images/green_arrow.gif"; chk7.Enabled = true; } } if (chk7.Checked == true) { img7.ImageUrl = "/images/check.gif"; img8.ImageUrl = "/images/green_arrow.gif"; chk8.Enabled = true; } if (chk8.Checked == true) { img8.ImageUrl = "/images/check.gif"; img9.ImageUrl = "/images/green_arrow.gif"; chk9.Enabled = true; } if (chk9.Checked == true) { img9.ImageUrl = "/images/check.gif"; img10.ImageUrl = "/images/green_arrow.gif"; chk10.Enabled = true; } if (chk10.Checked == true) { img10.ImageUrl = "/images/check.gif"; img11.ImageUrl = "/images/green_arrow.gif"; chk11.Enabled = true; } if (chk11.Checked == true) { img11.ImageUrl = "/images/check.gif"; } } if (Request.QueryString["div"] != null) { switch (Request.QueryString["div"]) { case "E": boolExecution = true; break; } } if (boolDetails == false && boolExecution == false) { boolDetails = true; } return(boolDone); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oForecast = new Forecast(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); Pages oPage = new Pages(intProfile, dsn); if (Request.QueryString["done"] != null && Request.QueryString["done"] != "") { oForecast.UpdateAnswerSetComplete(Int32.Parse(Request.QueryString["done"])); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Design Marked Completed Successfully\\n\\nPlease wait while the page reloads....');window.navigate('" + Request.Path + "?model=" + Request.QueryString["model"] + "&filters=" + Request.QueryString["filters"] + "');<" + "/" + "script>"); } else if (Request.QueryString["model"] != null && Request.QueryString["model"] != "" && Request.QueryString["filters"] != null) { string strFilter = oFunction.decryptQueryString(Request.QueryString["filters"]); intModel = Int32.Parse(Request.QueryString["model"]); int intType = oModelsProperties.GetType(intModel); Types oType = new Types(intProfile, dsn); int intPlatform = oType.GetPlatform(intType); lblModel.Text = oModelsProperties.Get(intModel, "name"); bool boolOther = false; DataSet dsDemand = oForecast.GetAnswersModel(intPlatform); DataTable dtDemand = dsDemand.Tables[0]; DataRow[] drModels = dtDemand.Select("model = " + intModel.ToString() + strFilter); ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); Users oUser = new Users(0, dsn); StringBuilder sb = new StringBuilder(strResults); OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn); foreach (DataRow dr in drModels) { int intProject = Int32.Parse(dr["projectid"].ToString()); int intAnswer = Int32.Parse(dr["id"].ToString()); int intImplementor = 0; DataSet dsTasks = oOnDemandTasks.GetPending(intAnswer); if (dsTasks.Tables[0].Rows.Count > 0) { intImplementor = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString()); intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intImplementor, "userid")); } else { intImplementor = -999; } string strXID = ""; if (intImplementor > 0 || intImplementor == -999) { strXID = oUser.GetFullName(intImplementor); } boolOther = !boolOther; sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append("><td><a onclick=\"return confirm('Are you sure you want to mark this design as being completed?');\" title=\"Mark as Complete\" href=\""); sb.Append(Request.Path); sb.Append("?model="); sb.Append(intModel.ToString()); sb.Append("&filters="); sb.Append(Request.QueryString["filters"]); sb.Append("&done="); sb.Append(dr["id"].ToString()); sb.Append("\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/></a></td><td>"); sb.Append(dr["id"].ToString()); sb.Append("</td><td><a href=\""); sb.Append(oPage.GetFullLink(intDesignBuilder)); sb.Append("?id="); sb.Append(dr["forecastid"].ToString()); sb.Append("&highlight="); sb.Append(dr["id"].ToString()); sb.Append("\" target=\"_blank\">"); sb.Append(dr["project_name"].ToString()); sb.Append("</a></td><td>"); sb.Append(dr["project_number"].ToString()); sb.Append("</td><td>"); sb.Append(dr["confidence"].ToString()); sb.Append("</td><td>"); sb.Append(dr["implementation"].ToString()); sb.Append("</td><td>"); sb.Append(dr["class"].ToString()); sb.Append("</td><td>"); sb.Append(dr["environment"].ToString()); sb.Append("</td><td>"); sb.Append(dr["location"].ToString()); sb.Append("</td><td>"); sb.Append(strXID); sb.Append("</td><td align=\"right\">"); sb.Append(dr["quantity"].ToString()); sb.Append("</td><td align=\"right\">"); sb.Append(dr["recovery_number"].ToString()); sb.Append("</td></tr>"); } strResults = sb.ToString(); } }