protected void Page_Load(object sender, EventArgs e) { Servers oServer = new Servers(0, dsn); VMWare oVMWare = new VMWare(0, dsn); Forecast oForecast = new Forecast(0, dsn); Environments oEnvironment = new Environments(0, dsn); OperatingSystems oOperatingSystem = new OperatingSystems(0, dsn); Classes oClass = new Classes(0, dsn); Requests oRequest = new Requests(0, dsn); Projects oProject = new Projects(0, dsn); ServerName oServerName = new ServerName(0, dsn); Locations oLocations = new Locations(0, dsn); ModelsProperties oModelsProperties = new ModelsProperties(0, dsn); ServicePacks oServicePacks = new ServicePacks(0, dsn); Users oUser = new Users(0, dsn); Organizations oOrganization = new Organizations(0, dsn); IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn); ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); Domains oDomains = new Domains(0, dsn); oVariables = new Variables(intEnvironment); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { StringBuilder sbTable = new StringBuilder(strTable); int intServer = Int32.Parse(Request.QueryString["id"]); DataSet ds = oServer.Get(intServer); if (ds.Tables[0].Rows.Count > 0) { int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString()); int intName = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString()); string strName = oServer.GetName(intServer, boolUsePNCNaming); int intForecast = Int32.Parse(oForecast.GetAnswer(intAnswer, "forecastid")); int intRequest = Int32.Parse(oForecast.Get(intForecast, "requestid")); int intProject = oRequest.GetProjectNumber(intRequest); int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")); int intEnv = Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); string _save_location = oVariables.UploadsFolder() + "SC\\"; string strFileName = "SC_" + intServer.ToString() + "_" + oProject.Get(intProject, "number") + ".HTM"; if (Directory.Exists(_save_location) == false) { Directory.CreateDirectory(_save_location); } string strFile = _save_location + strFileName; StreamWriter fp = File.CreateText(strFile); string strDefault = "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">"; StringBuilder sbLeft1 = new StringBuilder(); string strLead = oProject.Get(intProject, "lead"); int intLead = 0; if (strLead != "") { intLead = Int32.Parse(strLead); } sbLeft1.Append("<fieldset>"); sbLeft1.Append("<legend><b>Who is this for?</b></legend>"); sbLeft1.Append(strDefault); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client XID:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Name:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Phone No.:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Department:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox("", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Fax:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox("", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("<tr>"); sbLeft1.Append("<td>Client Cost Center:</td>"); sbLeft1.Append("<td>"); sbLeft1.Append(GetBox("", 200)); sbLeft1.Append("</td>"); sbLeft1.Append("</tr>"); sbLeft1.Append("</table>"); sbLeft1.Append("</fieldset>"); StringBuilder sbRight1 = new StringBuilder(); string strIE = oProject.Get(intProject, "engineer"); int intIE = 0; if (strIE != "") { intIE = Int32.Parse(strIE); } sbRight1.Append("<fieldset>"); sbRight1.Append("<legend><b>Requestor Information</b></legend>"); sbRight1.Append(strDefault); sbRight1.Append("<tr>"); sbRight1.Append("<td>Requested By Name:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox(intIE > 0 ? oUser.GetFullName(intIE) : "***ERROR**", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("<tr>"); sbRight1.Append("<td>Requested By Phone No.:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox(intIE > 0 ? oUser.Get(intIE, "phone") : "***ERROR**", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("<tr>"); sbRight1.Append("<td>Requested By Email:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox(intIE > 0 ? oUser.GetEmail(oUser.GetName(intIE), intEnvironment) : "***ERROR**", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("</table>"); sbRight1.Append("</fieldset>"); sbRight1.Append("<fieldset>"); sbRight1.Append("<legend><b>Location Information:</b></legend>"); sbRight1.Append(strDefault); sbRight1.Append("<tr>"); sbRight1.Append("<td>Location:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox("", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("<tr>"); sbRight1.Append("<td>Location Full Name:</td>"); sbRight1.Append("<td>"); sbRight1.Append(GetBox("", 200)); sbRight1.Append("</td>"); sbRight1.Append("</tr>"); sbRight1.Append("</table>"); sbRight1.Append("</fieldset>"); StringBuilder sbCenter1 = new StringBuilder(); sbCenter1.Append("<fieldset>"); sbCenter1.Append("<legend><b>Brief Desc:</b></legend>"); sbCenter1.Append(strDefault); sbCenter1.Append("<tr>"); sbCenter1.Append("<td>"); sbCenter1.Append(GetBox(oForecast.GetAnswer(intAnswer, "name") + " (" + strName + ")", 600)); sbCenter1.Append("</td>"); sbCenter1.Append("</tr>"); sbCenter1.Append("</table>"); sbCenter1.Append("</fieldset>"); StringBuilder sbLeft2 = new StringBuilder(); sbLeft2.Append("<fieldset>"); sbLeft2.Append("<legend><b>Project Information:</b></legend>"); sbLeft2.Append(strDefault); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project ID:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(oProject.Get(intProject, "number"), 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager XID:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project Name:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(oProject.Get(intProject, "name"), 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager Name:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project Budgeted:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(oProject.Get(intProject, "bd"), 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager Phone:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("<tr>"); sbLeft2.Append("<td>Project Cost Ctr:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox("", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("<td>Project Manager Email:</td>"); sbLeft2.Append("<td>"); sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetEmail(oUser.GetName(intLead), intEnvironment) : "***ERROR**", 200)); sbLeft2.Append("</td>"); sbLeft2.Append("</tr>"); sbLeft2.Append("</table>"); sbLeft2.Append("</fieldset>"); OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn); int intImplementor = 0; DataSet dsTasks = oOnDemandTasks.GetPending(intAnswer); if (dsTasks.Tables[0].Rows.Count > 0) { intImplementor = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString()); intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intImplementor, "userid")); } else { intImplementor = -999; } sbTable = new StringBuilder("<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><b>NOTE:</b> ASSIGN THIS REQUEST TO: "); sbTable.Append(intImplementor > 0 || intImplementor == -999 ? oUser.GetFullName(intImplementor) + " (" + oUser.GetName(intImplementor) + ")" : "***ERROR**"); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(sbLeft1.ToString()); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(sbRight1.ToString()); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(sbCenter1.ToString()); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(sbLeft2.ToString()); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><p> </p></td>"); sbTable.Append("</tr>"); bool boolVirtual = false; if (boolVirtual == true) { sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION VIRTUAL SERVER GUEST</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Requested Server Completion Date:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Hardware Specifications:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("VIRTUAL SERVER GUEST VMWARE", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Operating System:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Environment:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Class:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Domain:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Backup Method:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TSM", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); string strHost = "***ERROR***"; DataSet dsGuest = oVMWare.GetGuest(strName); if (dsGuest.Tables[0].Rows.Count > 0) { strHost = oVMWare.GetHost(Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString()), "name").ToUpper(); } sbTable.Append("<tr>"); sbTable.Append("<td>Host Server Name:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(strHost, 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>"); sbTable.Append("</tr>"); bool boolSQL = false; bool boolIIS = false; DataSet dsComp = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow drComp in dsComp.Tables[0].Rows) { if (drComp["code"].ToString() == "IIS") { boolIIS = true; } if (drComp["code"].ToString() == "SQL") { boolSQL = true; } } sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TCP/IP", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Attached to SAN?:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server is Clustered:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Load Balanced:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Maximum Allowable Downtime:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("Not Applicable", 150) + "</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(GetBox("", 500)); sbTable.Append("</td>"); sbTable.Append("</tr>"); } else { sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION SERVER</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Requested Server Completion Date:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Hardware Specifications:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oModelsProperties.Get(intModel, "name"), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\" checked/> User re-deployable hardware if applicable</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>PO:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Operating System:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Environment:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Class:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Destination Domain:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Location:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox(oLocations.GetFull(Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid"))).ToUpper(), 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Backup Method:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TSM", 300)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>"); sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>"); sbTable.Append("</tr>"); bool boolSQL = false; bool boolIIS = false; DataSet dsComp = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow drComp in dsComp.Tables[0].Rows) { if (drComp["code"].ToString() == "IIS") { boolIIS = true; } if (drComp["code"].ToString() == "SQL") { boolSQL = true; } } sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("TCP/IP", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>"); sbTable.Append(GetBox("", 250)); sbTable.Append("</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Attached to SAN?:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server is Clustered:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Server Load Balanced:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("NO", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td>Maximum Allowable Downtime:</td>"); sbTable.Append("<td>"); sbTable.Append(GetBox("Not Applicable", 150)); sbTable.Append("</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr><td colspan=\"2\"><p> </p></td></tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>"); sbTable.Append("</tr>"); sbTable.Append("<tr>"); sbTable.Append("<td colspan=\"2\">"); sbTable.Append(GetBox("", 500)); sbTable.Append("</td>"); sbTable.Append("</tr>"); } sbTable.Append("</table>"); fp.WriteLine("<html>"); fp.WriteLine("<head>"); fp.WriteLine("<title>ClearView | Service Center Request Form</title>"); fp.WriteLine("<style type=\"text/css\">"); fp.WriteLine(".default {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;}"); fp.WriteLine(".header {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 16px;font-style: italic;font-weight: bold;}"); fp.WriteLine("</style>"); fp.WriteLine("<body leftmargin=\"0\" topmargin=\"0\">"); fp.WriteLine(sbTable.ToString()); fp.WriteLine("</body>"); fp.WriteLine("</html>"); fp.Close(); } strTable = sbTable.ToString(); } }
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 Page_Load(object sender, EventArgs e) { oForecast = new Forecast(0, dsn); oServer = new Servers(0, dsn); if (Request.QueryString["id"] != null) { int intID = Int32.Parse(Request.QueryString["id"]); if (oForecast.IsStorage(intID) == true) { DataSet dsStorage = oForecast.GetStorage(intID); double intHigh = double.Parse(dsStorage.Tables[0].Rows[0]["high_total"].ToString()); double intStandard = double.Parse(dsStorage.Tables[0].Rows[0]["standard_total"].ToString()); double intLow = double.Parse(dsStorage.Tables[0].Rows[0]["low_total"].ToString()); double intHighTest = double.Parse(dsStorage.Tables[0].Rows[0]["high_test"].ToString()); double intStandardTest = double.Parse(dsStorage.Tables[0].Rows[0]["standard_test"].ToString()); double intLowTest = double.Parse(dsStorage.Tables[0].Rows[0]["low_test"].ToString()); double dblTotal = intHigh + intStandard + intLow + intHighTest + intStandardTest + intLowTest; int TotalFileSystemData = Int32.Parse(dblTotal.ToString()); lblTCDC.Text = TotalFileSystemData.ToString() + " GB"; } int intForecast = Int32.Parse(oForecast.GetAnswer(intID, "forecastid")); int intRequest = Int32.Parse(oForecast.Get(intForecast, "requestid")); Requests oRequest = new Requests(0, dsn); int intProject = oRequest.GetProjectNumber(intRequest); Projects oProject = new Projects(0, dsn); //rptApp.DataSource = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "select top 1 * from cv_ondemand_answering"); //rptApp.DataBind(); lblAppNone.Visible = (rptApp.Items.Count == 0); lblPrjName.Text = oProject.Get(intProject, "name"); Users oUser = new Users(0, dsn); string strLead = oProject.Get(intProject, "lead"); if (strLead != "") { lblPrjMgr.Text = oUser.GetFullName(Int32.Parse(strLead)); lblPhoneNum1.Text = oUser.Get(Int32.Parse(strLead), "phone"); } string strRequester = oForecast.Get(intForecast, "userid"); if (strRequester != "") { lblRequester.Text = oUser.GetFullName(Int32.Parse(strRequester)); lblPhoneNum2.Text = oUser.Get(Int32.Parse(strRequester), "phone"); } lblDate.Text = DateTime.Parse(oForecast.GetAnswer(intID, "implementation")).ToLongDateString(); // Get data from servers table ServerName oServerName = new ServerName(0, dsn); IPAddresses oIPAddress = new IPAddresses(0, dsnIP, dsn); OperatingSystems oOperatingSystem = new OperatingSystems(0, dsn); ServicePacks oServicePack = new ServicePacks(0, dsn); DataSet dsServer = oServer.GetAnswer(intID); StringBuilder sbHosts = new StringBuilder(strHosts); foreach (DataRow drServer in dsServer.Tables[0].Rows) { int intServer = Int32.Parse(dsServer.Tables[0].Rows[0]["id"].ToString()); sbHosts.Append("<tr>"); sbHosts.Append("<td>"); sbHosts.Append(oServer.GetName(intServer, boolUsePNCNaming)); sbHosts.Append("</td>"); sbHosts.Append("<td>"); sbHosts.Append(oServer.GetIPs(intServer, 0, 1, 0, 0, dsnIP, "", "")); sbHosts.Append("</td>"); sbHosts.Append("<td>"); sbHosts.Append(oOperatingSystem.Get(Int32.Parse(dsServer.Tables[0].Rows[0]["osid"].ToString()), "name")); sbHosts.Append("</td>"); sbHosts.Append("<td>"); sbHosts.Append(oServicePack.Get(Int32.Parse(dsServer.Tables[0].Rows[0]["spid"].ToString()), "name")); sbHosts.Append("</td>"); sbHosts.Append("</tr>"); } strHosts = sbHosts.ToString(); lblHostNone.Visible = (strHosts == ""); lblRecoveryLocation.Text = "Ops Center"; // Get data from backup table DataSet dsBackup = oForecast.GetBackup(intID); if (dsBackup.Tables[0].Rows.Count > 0) { if (dsBackup.Tables[0].Rows[0]["daily"].ToString() == "1") { lblBackupFreq.Text = "Daily"; } else if (dsBackup.Tables[0].Rows[0]["weekly"].ToString() == "1") { lblBackupFreq.Text = "Weekly"; } else if (dsBackup.Tables[0].Rows[0]["monthly"].ToString() == "1") { lblBackupFreq.Text = "Monthly"; } if (dsBackup.Tables[0].Rows[0]["time"].ToString() == "1") { lblCSB.Text = dsBackup.Tables[0].Rows[0]["time_hour"].ToString() + " " + dsBackup.Tables[0].Rows[0]["time_switch"].ToString(); } else { lblCSB.Text = "Don't Care"; } lblAvgSize.Text = dsBackup.Tables[0].Rows[0]["average_one"].ToString() + " GB"; lblPTD.Text = dsBackup.Tables[0].Rows[0]["documentation"].ToString(); if (lblPTD.Text == "") { lblPTD.Text = "Not Specified"; lblPTD.CssClass = "redbold"; } if (dsBackup.Tables[0].Rows[0]["start_date"].ToString() != "") { lblFirstBackupDate.Text = DateTime.Parse(dsBackup.Tables[0].Rows[0]["start_date"].ToString()).ToShortDateString(); } } // Load Exclusions DataSet dsExclusions = oForecast.GetBackupExclusions(intID); foreach (DataRow drExclusion in dsExclusions.Tables[0].Rows) { strExclusions += "<tr><td>" + drExclusion["path"].ToString() + "</td></tr>"; } if (strExclusions == "") { strExclusions = "<tr><td class=\"redbold\">No Exclusions</td></tr>"; } // Load Requirements DataSet dsRequirements = oForecast.GetBackupRetentions(intID); StringBuilder sbRequirements = new StringBuilder(strRequirements); foreach (DataRow drRequirement in dsRequirements.Tables[0].Rows) { sbRequirements.Append("<tr><td nowrap>Path:</td><td width=\"100%\">"); sbRequirements.Append(drRequirement["path"].ToString()); sbRequirements.Append("</td></tr>"); sbRequirements.Append("<tr><td nowrap>First Archival:</td><td width=\"100%\">"); sbRequirements.Append(DateTime.Parse(drRequirement["first"].ToString()).ToShortDateString()); sbRequirements.Append("</td></tr>"); sbRequirements.Append("<tr><td nowrap>Retention Period:</td><td width=\"100%\">"); sbRequirements.Append(drRequirement["number"].ToString() == "0" ? "" : drRequirement["number"].ToString() + " "); sbRequirements.Append(drRequirement["type"].ToString()); sbRequirements.Append("</td></tr>"); sbRequirements.Append("<tr><td nowrap>Start Time:</td><td width=\"100%\">"); sbRequirements.Append(drRequirement["hour"].ToString()); sbRequirements.Append(" "); sbRequirements.Append(drRequirement["switch"].ToString()); sbRequirements.Append("</td></tr>"); sbRequirements.Append("<tr><td nowrap>Frequency:</td><td width=\"100%\">"); sbRequirements.Append(drRequirement["occurence"].ToString()); sbRequirements.Append(drRequirement["occurs"].ToString() == "" ? "" : " occurring on " + drRequirement["occurs"].ToString()); sbRequirements.Append("</td></tr>"); sbRequirements.Append("<tr><td colspan=\"2\"> </td></tr>"); } strRequirements = sbRequirements.ToString(); lblCCDU.Text = "5 GB"; lblPolicyExcl.Text = "No Exceptions"; } }