protected void dlDetails_ItemDataBound(object sender, DataListItemEventArgs e) { int intMax = 100; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRow drv = (DataRow)e.Item.DataItem; int intDemand = Int32.Parse(drv["Demandcount"].ToString()); int intSupply = Int32.Parse(drv["SupplyCount"].ToString()); Label lblInfo = (Label)e.Item.FindControl("lblInfo"); lblInfo.Text = ""; if (chkWarningAndCritial.Checked == true) { if (drv["InventoryCritical"].ToString() == "1") { lblInfo.Text = "<img src=\"/images/Error.gif\" border=\"0\" align=\"absmiddle\"/> "; } else if (drv["InventoryWarning"].ToString() == "1") { lblInfo.Text = "<img src=\"/images/Alert.gif\" border=\"0\" align=\"absmiddle\"/> "; } } Label lblModel = (Label)e.Item.FindControl("lblModel"); lblModel.Text = drv["ModelName"].ToString(); Label lblDemand = (Label)e.Item.FindControl("lblDemand"); Label lblDemandNo = (Label)e.Item.FindControl("lblDemandNo"); lblDemandNo.Text = intDemand.ToString(); lblDemand.Text = oServiceRequest.GetStatusBarFill(((double.Parse(intDemand.ToString()) / double.Parse(intMax.ToString())) * 100.00), "75%", false, "#CC3300"); Label lblSupply = (Label)e.Item.FindControl("lblSupply"); Label lblSupplyNo = (Label)e.Item.FindControl("lblSupplyNo"); lblSupplyNo.Text = intSupply.ToString(); lblSupply.Text = oServiceRequest.GetStatusBarFill(((double.Parse(intSupply.ToString()) / double.Parse(intMax.ToString())) * 100.00), "75%", false, "#6699CC"); } }
protected void dlDetails_ItemDataBound(object sender, DataListItemEventArgs e) { int intMax = 100; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRow drv = (DataRow)e.Item.DataItem; int intDemand = Int32.Parse(drv["ForcastServerCount"].ToString()); Label lblModel = (Label)e.Item.FindControl("lblModel"); lblModel.Text = drv["ModelName"].ToString(); Label lblDemand = (Label)e.Item.FindControl("lblDemand"); Label lblDemandNo = (Label)e.Item.FindControl("lblDemandNo"); lblDemandNo.Text = intDemand.ToString(); lblDemand.Text = oServiceRequest.GetStatusBarFill(((double.Parse(intDemand.ToString()) / double.Parse(intMax.ToString())) * 100.00), "75%", false, "#CC3300"); } }
private void LoadGroup(int _platformid, DataTable _demand, string _additional_filter) { foreach (DataRow drType in _demand.Rows) { bool boolPhysical = false; bool boolBlade = false; bool boolOther = false; int intOldHost = -1; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { boolOther = !boolOther; int intBlade = Int32.Parse(drModel["blade"].ToString()); int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } string strType = "Unknown"; if (intBlade == 1) { strType = "Blade"; if (boolBlade == false) { if (strSupply != "") { strSupply += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strSupply += "<tr><td colspan=\"4\" class=\"bold\">" + strType + "</td></tr>"; boolBlade = true; } } else if (intHost == 0) { strType = "Physical"; if (boolPhysical == false) { if (strSupply != "") { strSupply += "<tr><td colspan=\"4\"><p> </p><p> </p></td></tr>"; } strSupply += "<tr><td colspan=\"4\" class=\"header\">" + drType["name"].ToString() + "</td></tr>"; strSupply += "<tr><td colspan=\"4\" class=\"bold\">" + strType + "</td></tr>"; boolPhysical = true; } } else if (intOldHost != intHost) { strType = drModel["host"].ToString(); if (intHost > 0) { if (strSupply != "") { strSupply += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strSupply += "<tr><td colspan=\"4\" class=\"bold\">" + strType + "</td></tr>"; intOldHost = intHost; } } int intModel = Int32.Parse(drModel["id"].ToString()); // Supply DataSet dsModel = oAsset.GetCount(intModel, (int)AssetStatus.Available); DataRow[] drModels = dsModel.Tables[0].Select("true " + strFilter + _additional_filter); if (intHost == 0) { int intSupply = drModels.Length; strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + "><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>" + (intSupply == 0 ? drModel["name"].ToString() : "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('INVENTORY_SUPPLY','?model=" + drModel["id"].ToString() + "&status=1');\">" + drModel["name"].ToString() + "</a>") + ":</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((double.Parse(intSupply.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#6699CC") + "</td><td nowrap>" + intSupply.ToString() + "</td></tr>"; } else { DataSet dsHosts = oAsset.GetVMWareHosts(intHost); double dblRAM = 0.0; double dblProcessor = 0.0; double dblDiskSpace = 0.0; foreach (DataRow drHost in dsHosts.Tables[0].Rows) { dblRAM += double.Parse(drHost["ram"].ToString()); dblProcessor += double.Parse(drHost["cpu_count"].ToString()); } DataSet dsHostStorage = oAsset.GetVMWareHostsStorage(intHost); foreach (DataRow drHostStorage in dsHostStorage.Tables[0].Rows) { dblDiskSpace += double.Parse(drHostStorage["l_actual_size"].ToString()); dblDiskSpace += double.Parse(drHostStorage["l_actual_size_qa"].ToString()); dblDiskSpace += double.Parse(drHostStorage["l_actual_size_test"].ToString()); dblDiskSpace += double.Parse(drHostStorage["m_actual_size"].ToString()); dblDiskSpace += double.Parse(drHostStorage["m_actual_size_qa"].ToString()); dblDiskSpace += double.Parse(drHostStorage["m_actual_size_test"].ToString()); } strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblRAM > 0.00 ? "greendefault" : (dblRAM < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>RAM:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblRAM / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblRAM.ToString() + " GB</td></tr>"; strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblProcessor > 0.00 ? "greendefault" : (dblProcessor < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Processors:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblProcessor / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblProcessor.ToString() + "</td></tr>"; strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblDiskSpace > 0.00 ? "greendefault" : (dblDiskSpace < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Disk Space:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblDiskSpace / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblDiskSpace.ToString() + " GB</td></tr>"; } } } }
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset); oServiceRequest = new ServiceRequests(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } int intPlatform = 0; if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intPlatform = Int32.Parse(Request.QueryString["id"]); } if (intPlatform > 0) { intMax = Int32.Parse(oPlatform.Get(intPlatform, "max_inventory1")); if (!IsPostBack) { DataSet dsDemand = oForecast.GetAnswersModel(intPlatform); DataTable dtDemand = dsDemand.Tables[0]; DataSet dsTypes = oType.Gets(intPlatform, 1); foreach (DataRow drType in dsTypes.Tables[0].Rows) { int intWarning = Int32.Parse(drType["inventory_warning"].ToString()); int intCritical = Int32.Parse(drType["inventory_critical"].ToString()); bool boolOther = false; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { int intBlade = Int32.Parse(drModel["blade"].ToString()); int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } int intModel = Int32.Parse(drModel["id"].ToString()); // Supply DataSet dsModel = oAsset.GetCount(intModel, (int)AssetStatus.Available); int intSupply = dsModel.Tables[0].Rows.Count; // Demand DataRow[] drModels = dtDemand.Select("model = " + intModel.ToString()); int intDemand = 0; foreach (DataRow dr in drModels) { intDemand += Int32.Parse(dr["quantity"].ToString()); intDemand += Int32.Parse(dr["recovery_number"].ToString()); } bool boolWarning = (intDemand > 0 && (intDemand + intWarning) >= intSupply); bool boolCritical = (intDemand > 0 && (intDemand + intCritical) >= intSupply); if (boolWarning || boolCritical) { boolOther = !boolOther; sb = new StringBuilder(strSummary); sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append(" class=\"header\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td colspan=\"3\"><img src=\"/images/"); sb.Append(boolCritical ? "bigError.gif" : "bigAlert.gif"); sb.Append("\" border=\"0\" align=\"absmiddle\"/> "); sb.Append(boolCritical ? "CRITICAL" : "WARNING"); sb.Append(": "); sb.Append(drModel["name"].ToString()); sb.Append("</td></tr>"); sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append("><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Supply:</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(intSupply.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#6699CC")); sb.Append("</td><td nowrap>"); sb.Append(intSupply.ToString()); sb.Append("</td></tr>"); sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append("><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Demand:</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(intDemand.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(intDemand.ToString()); sb.Append("</td></tr>"); strSummary = sb.ToString(); } } } if (strSummary == "") { strSummary = "<tr><td class=\"header\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> No Action Required</td></tr>"; } } } }
private string LoadGroup(int _platformid, DataTable _demand, string _additional_filter) { string strGroup = ""; DataSet dsTypes = oType.Gets(_platformid, 1); foreach (DataRow drType in dsTypes.Tables[0].Rows) { bool boolPhysical = false; bool boolBlade = false; bool boolOther = false; int intOldHost = -1; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { boolOther = !boolOther; int intBlade = Int32.Parse(drModel["blade"].ToString()); int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } string strType = "Unknown"; if (intBlade == 1) { strType = "Blade"; if (boolBlade == false) { if (strGroup != "") { strGroup += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strGroup += "<tr><td colspan=\"4\" class=\"bold\">" + drType["name"].ToString() + " | " + strType + "</td></tr>"; boolBlade = true; } } else if (intHost == 0) { strType = "Physical"; if (boolPhysical == false) { if (strGroup != "") { strGroup += "<tr><td colspan=\"4\"><p> </p></td></tr>"; } strGroup += "<tr><td colspan=\"4\" class=\"bold\">" + drType["name"].ToString() + " | " + strType + "</td></tr>"; boolPhysical = true; } } else if (intOldHost != intHost) { strType = drModel["host"].ToString(); if (intHost > 0) { if (strGroup != "") { strGroup += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strGroup += "<tr><td colspan=\"4\" class=\"bold\">" + drType["name"].ToString() + " | " + strType + "</td></tr>"; intOldHost = intHost; } } int intModel = Int32.Parse(drModel["id"].ToString()); DataRow[] drModels = _demand.Select("model = " + intModel.ToString() + strFilter + _additional_filter); int intDemand = 0; foreach (DataRow dr in drModels) { intDemand += Int32.Parse(dr["quantity"].ToString()); intDemand += Int32.Parse(dr["recovery_number"].ToString()); } strGroup += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (intDemand > 0 ? "greendefault" : (intDemand < 0 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>" + drModel["name"].ToString() + ":</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) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset); oServiceRequest = new ServiceRequests(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oHost = new Host(intProfile, dsn); if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } int intPlatform = 0; if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intPlatform = Int32.Parse(Request.QueryString["id"]); } if (intPlatform > 0) { intMax = Int32.Parse(oPlatform.Get(intPlatform, "max_inventory1")); if (!IsPostBack) { DataSet dsTypes = oType.Gets(intPlatform, 1); foreach (DataRow drType in dsTypes.Tables[0].Rows) { bool boolPhysical = false; bool boolBlade = false; bool boolOther = false; int intOldHost = -1; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { boolOther = !boolOther; int intBlade = Int32.Parse(drModel["blade"].ToString()); int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } string strType = "Unknown"; if (intBlade == 1) { strType = "Blade"; if (boolBlade == false) { if (strSupply != "") { strSupply += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strSupply += "<tr><td colspan=\"4\" class=\"bold\">" + strType + "</td></tr>"; boolBlade = true; } } else if (intHost == 0) { strType = "Physical"; if (boolPhysical == false) { if (strSupply != "") { strSupply += "<tr><td colspan=\"4\"><p> </p><p> </p></td></tr>"; } strSupply += "<tr><td colspan=\"4\" class=\"header\">" + drType["name"].ToString() + "</td></tr>"; strSupply += "<tr><td colspan=\"4\" class=\"bold\">" + strType + "</td></tr>"; boolPhysical = true; } } else if (intOldHost != intHost) { strType = drModel["host"].ToString(); if (intHost > 0) { if (strSupply != "") { strSupply += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strSupply += "<tr><td colspan=\"4\" class=\"bold\">" + strType + "</td></tr>"; intOldHost = intHost; } } int intModel = Int32.Parse(drModel["id"].ToString()); // Supply DataSet dsModel = oAsset.GetCount(intModel, (int)AssetStatus.Available); if (intHost == 0) { int intSupply = dsModel.Tables[0].Rows.Count; strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + "><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>" + (intSupply == 0 ? drModel["name"].ToString() : "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('INVENTORY_SUPPLY','?model=" + drModel["id"].ToString() + "&status=1');\">" + drModel["name"].ToString() + "</a>") + ":</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((double.Parse(intSupply.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#6699CC") + "</td><td nowrap>" + intSupply.ToString() + "</td></tr>"; } else { DataSet dsHosts = oAsset.GetVMWareHosts(intHost); double dblRAM = 0.0; double dblProcessor = 0.0; double dblDiskSpace = 0.0; foreach (DataRow drHost in dsHosts.Tables[0].Rows) { dblRAM += double.Parse(drHost["ram"].ToString()); dblProcessor += double.Parse(drHost["cpu_count"].ToString()); } DataSet dsHostStorage = oAsset.GetVMWareHostsStorage(intHost); foreach (DataRow drHostStorage in dsHostStorage.Tables[0].Rows) { dblDiskSpace += double.Parse(drHostStorage["l_actual_size"].ToString()); dblDiskSpace += double.Parse(drHostStorage["l_actual_size_qa"].ToString()); dblDiskSpace += double.Parse(drHostStorage["l_actual_size_test"].ToString()); dblDiskSpace += double.Parse(drHostStorage["m_actual_size"].ToString()); dblDiskSpace += double.Parse(drHostStorage["m_actual_size_qa"].ToString()); dblDiskSpace += double.Parse(drHostStorage["m_actual_size_test"].ToString()); } strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblRAM > 0.00 ? "greendefault" : (dblRAM < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>RAM:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblRAM / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblRAM.ToString() + " GB</td></tr>"; strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblProcessor > 0.00 ? "greendefault" : (dblProcessor < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Processors:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblProcessor / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblProcessor.ToString() + "</td></tr>"; strSupply += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblDiskSpace > 0.00 ? "greendefault" : (dblDiskSpace < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Disk Space:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblDiskSpace / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblDiskSpace.ToString() + " GB</td></tr>"; } } } } } }
private string LoadGroup(int _platformid, string _additional_filter) { DataSet dsSupply = oAsset.GetDemandFacilities(); DataTable dtSupply = dsSupply.Tables[0]; double dblSupply = 0.00; if (strFilter.StartsWith(" AND ") == true) { strFilter = strFilter.Substring(5); } if (strFilter.StartsWith("AND ") == true) { strFilter = strFilter.Substring(4); } DataRow[] drModels = dtSupply.Select(strFilter + _additional_filter); string strPlatform = ""; string strModel = ""; double dblQuantity = 0.00; double dblAmps = 0.00; StringBuilder sb = new StringBuilder(); foreach (DataRow dr in drModels) { if (strPlatform != dr["platform"].ToString()) { if (strModel != "") { dblSupply = dblQuantity * dblAmps; sb.Append("<tr class=\"default\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>"); sb.Append(strModel); sb.Append(":</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((dblSupply / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(dblQuantity.ToString()); sb.Append("</td><td nowrap>(x "); sb.Append(dblAmps.ToString()); sb.Append(" AMPs) =</td><td nowrap>"); sb.Append(dblSupply.ToString()); sb.Append(" AMPs</td></tr>"); dblQuantity = 0.00; dblAmps = 0.00; } sb.Append("<tr class=\"bold\"><td colspan=\"3\">"); sb.Append(dr["platform"].ToString()); sb.Append("</td><td nowrap>Qty</td><td> <td nowrap>Total AMPs</td></tr>"); strPlatform = dr["platform"].ToString(); } else if (strModel != dr["model"].ToString()) { if (strModel != "") { dblSupply = dblQuantity * dblAmps; sb.Append("<tr class=\"default\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>"); sb.Append(strModel); sb.Append(":</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((dblSupply / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(dblQuantity.ToString()); sb.Append("</td><td nowrap>(x "); sb.Append(dblAmps.ToString()); sb.Append(" AMPs) =</td><td nowrap>"); sb.Append(dblSupply.ToString()); sb.Append(" AMPs</td></tr>"); dblQuantity = 0.00; dblAmps = 0.00; } } if (dr["quantity"].ToString() != "") { dblQuantity += double.Parse(dr["quantity"].ToString()); } if (dr["amp"].ToString() != "") { dblAmps = double.Parse(dr["amp"].ToString()); } strModel = dr["model"].ToString(); } if (strModel != "") { dblSupply = dblQuantity * dblAmps; sb.Append("<tr class=\"default\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>"); sb.Append(strModel); sb.Append(":</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((dblSupply / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(dblQuantity.ToString()); sb.Append("</td><td nowrap>(x "); sb.Append(dblAmps.ToString()); sb.Append(" AMPs) =</td><td nowrap>"); sb.Append(dblSupply.ToString()); sb.Append(" AMPs</td></tr>"); dblQuantity = 0.00; dblAmps = 0.00; } if (sb.ToString() != "") { return("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">" + sb.ToString() + "</table>"); } else { return(sb.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); }
private string LoadGroup(int _platformid, DataTable _demand, string _additional_filter) { StringBuilder sb = new StringBuilder(); DataSet dsTypes = oType.Gets(_platformid, 1); foreach (DataRow drType in dsTypes.Tables[0].Rows) { bool boolPhysical = false; bool boolOther = false; int intOldHost = -1; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { boolOther = !boolOther; int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } string strType = "Unknown"; if (intHost == 0) { strType = "Physical"; if (boolPhysical == false) { if (sb.ToString() != "") { sb.Append("<tr><td colspan=\"4\"><p> </p></td></tr>"); } sb.Append("<tr><td colspan=\"4\" class=\"bold\">"); sb.Append(drType["name"].ToString()); sb.Append(" | "); sb.Append(strType); sb.Append("</td></tr>"); boolPhysical = true; } } else if (intOldHost != intHost) { strType = drModel["host"].ToString(); if (intHost > 0) { if (sb.ToString() != "") { sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); } sb.Append("<tr><td colspan=\"4\" class=\"bold\">"); sb.Append(drType["name"].ToString()); sb.Append(" | "); sb.Append(strType); sb.Append("</td></tr>"); intOldHost = intHost; } } int intModel = Int32.Parse(drModel["id"].ToString()); DataRow[] drModels = _demand.Select("model = " + intModel.ToString() + strFilter + _additional_filter); int intDemand = 0; if (intHost == 0) { foreach (DataRow dr in drModels) { intDemand += Int32.Parse(dr["quantity"].ToString()); } sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append(" class=\""); sb.Append(intDemand > 0 ? "greendefault" : (intDemand < 0 ? "reddefault" : "default")); sb.Append("\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>"); sb.Append(drModel["name"].ToString()); sb.Append(":</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(intDemand.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(intDemand.ToString()); sb.Append("</td></tr>"); } else { double dblRAM = 0.0; double dblHDD = 0.0; foreach (DataRow drCount in drModels) { if (drCount["ram"].ToString() != "") { dblRAM += double.Parse(drCount["ram"].ToString()); } if (drCount["os"].ToString() != "") { dblHDD += double.Parse(drCount["hdd"].ToString()); } } sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append(" class=\""); sb.Append(dblRAM > 0.00 ? "greendefault" : (dblRAM < 0.00 ? "reddefault" : "default")); sb.Append("\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>RAM:</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((dblRAM / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(dblRAM.ToString()); sb.Append(" GB</td></tr>"); sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append(" class=\""); sb.Append(dblHDD > 0.00 ? "greendefault" : (dblHDD < 0.00 ? "reddefault" : "default")); sb.Append("\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Disk Space:</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((dblHDD / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap>"); sb.Append(dblHDD.ToString()); sb.Append(" GB</td></tr>"); } } } if (sb.ToString() != "") { return("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">" + sb.ToString() + "</table>"); } else { return(sb.ToString()); } }
private string LoadGroup(int _platformid, string _additional_filter) { string strGroup = ""; DataSet dsSupply = oAsset.GetSupplyNetwork(); DataTable dtSupply = dsSupply.Tables[0]; int intPorts = 0; if (strFilter.StartsWith(" AND ") == true) { strFilter = strFilter.Substring(5); } if (strFilter.StartsWith("AND ") == true) { strFilter = strFilter.Substring(4); } DataRow[] drModels = dtSupply.Select(strFilter + _additional_filter); foreach (DataRow dr in drModels) { if (dr["available_ports"].ToString() != "") { intPorts += Int32.Parse(dr["available_ports"].ToString()); } } strGroup += "<tr class=\"" + (intPorts > 0 ? "greendefault" : (intPorts < 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(intPorts.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + intPorts.ToString() + "</td></tr>"; if (strGroup != "") { strGroup = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">" + strGroup + "</table>"; } return(strGroup); }
protected string LoadDetails() { StringBuilder sb = new StringBuilder(); string strFilters = ""; strFilters = strFilters + (strFilters != "" ? (strFilterLocation != "" ? " AND " + strFilterLocation : strFilterLocation) : strFilterLocation); strFilters = strFilters + (strFilters != "" ? (strFilterProject != "" ? " AND " + strFilterProject : strFilterProject) : strFilterProject); strFilters = strFilters + (strFilters != "" ? (strFilterClass != "" ? " AND " + strFilterClass : strFilterClass) : strFilterClass); strFilters = strFilters + (strFilters != "" ? (strFilterEnv != "" ? " AND " + strFilterEnv : strFilterEnv) : strFilterEnv); strFilters = strFilters + (strFilters != "" ? (strFilterConfidence != "" ? " AND " + strFilterConfidence : strFilterConfidence) : strFilterConfidence); string strSort = "Location"; DataList dl = this.FindControl("dlDetails") as System.Web.UI.WebControls.DataList; DataRow[] drSelect = null; drSelect = dtSupplyAndDemand.Select(strFilters, strSort); foreach (DataRow drDetails in drSelect) { //Add Location // Production sb.Append("<tr><td colspan=\"4\" class=\"header\">Production</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">High Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageHighProd"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageHighProd"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Standard Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageStandardProd"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageStandardProd"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Low Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageLowProd"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageLowProd"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Ports:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StoragePortsProd"].ToString()) / double.Parse(intMaxPorts.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StoragePortsProd"].ToString())); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); // QA sb.Append("<tr><td colspan=\"4\" class=\"header\">QA</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">High Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageHighQA"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageHighQA"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Standard Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageStandardQa"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageStandardQa"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Low Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageLowQa"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageLowQa"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Ports:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StoragePortsQA"].ToString()) / double.Parse(intMaxPorts.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StoragePortsQA"].ToString())); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); // Test sb.Append("<tr><td colspan=\"4\" class=\"header\">Test</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">High Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageHighTest"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageHighTest"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Standard Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageStandardTest"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageStandardTest"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Low Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageLowTest"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageLowTest"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Ports:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StoragePortsTest"].ToString()) / double.Parse(intMaxPorts.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StoragePortsTest"].ToString())); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); // HA sb.Append("<tr><td colspan=\"4\" class=\"header\">High Availability</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">High Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageHighHA"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageHighHA"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Standard Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageStandardHA"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageStandardHA"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Low Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageLowHA"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageLowHA"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Ports:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StoragePortsHA"].ToString()) / double.Parse(intMaxPorts.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StoragePortsHA"].ToString())); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); if (oLocation.GetAddress(Int32.Parse(drDetails["LocationId"].ToString()), "dr") == "1") { // Replicated sb.Append("<tr><td colspan=\"4\" class=\"header\">Replication</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">High Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageHighReplicated"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageHighReplicated"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Standard Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageStandardReplicated"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageStandardReplicated"].ToString())); sb.Append(" GB</td></tr>"); sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); sb.Append("<td nowrap width=\"20%\">Low Performance:</td>"); sb.Append("<td width=\"60%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StorageLowReplicated"].ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#CC3300")); sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); sb.Append(double.Parse(drDetails["StorageLowReplicated"].ToString())); sb.Append(" GB</td></tr>"); } //sb.Append("<tr bgcolor=\"F6F6F6\" class=\"default\">"); //sb.Append("<td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td>"); //sb.Append("<td nowrap width=\"20%\">Ports:</td>"); //sb.Append("<td width=\"60%\">"); //sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(drDetails["StoragePortsReplicated"].ToString()) / double.Parse(intMaxPorts.ToString())) * 100.00), "95", false, "#CC3300")); //sb.Append("</td><td nowrap width=\"20%\" align=\"right\">"); //sb.Append(double.Parse(drDetails["StoragePortsReplicated"].ToString())); //sb.Append("</td></tr>"); //sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); } if (sb.ToString() != "") { sb.Insert(0, "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\">"); sb.Append("</table>"); } return(sb.ToString()); }
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset); oServiceRequest = new ServiceRequests(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } int intPlatform = 0; if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intPlatform = Int32.Parse(Request.QueryString["id"]); } if (intPlatform > 0) { intMax = Int32.Parse(oPlatform.Get(intPlatform, "max_inventory1")); if (!IsPostBack) { DataSet dsTypes = oType.Gets(intPlatform, 1); foreach (DataRow drType in dsTypes.Tables[0].Rows) { bool boolPhysical = false; bool boolBlade = false; bool boolOther = false; int intOldHost = -1; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { boolOther = !boolOther; int intBlade = Int32.Parse(drModel["blade"].ToString()); int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } string strType = "Unknown"; if (intBlade == 1) { strType = "Blade"; if (boolBlade == false) { if (sb.ToString() != "") { sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); } sb.Append("<tr><td colspan=\"4\" class=\"bold\">"); sb.Append(strType); sb.Append("</td></tr>"); boolBlade = true; } } else if (intHost == 0) { strType = "Physical"; if (boolPhysical == false) { if (sb.ToString() != "") { sb.Append("<tr><td colspan=\"4\"><p> </p><p> </p></td></tr>"); } sb.Append("<tr><td colspan=\"4\" class=\"header\">"); sb.Append(drType["name"].ToString()); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"4\" class=\"bold\">"); sb.Append(strType); sb.Append("</td></tr>"); boolPhysical = true; } } else if (intOldHost != intHost) { strType = drModel["host"].ToString(); if (intHost > 0) { if (sb.ToString() != "") { sb.Append("<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"); } sb.Append("<tr><td colspan=\"4\" class=\"bold\">"); sb.Append(strType); sb.Append("</td></tr>"); intOldHost = intHost; } } int intModel = Int32.Parse(drModel["id"].ToString()); // Supply DataSet dsModel = oAsset.GetCount(intModel, (int)AssetStatus.Available); int intSupply = dsModel.Tables[0].Rows.Count; sb.Append("<tr"); sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sb.Append("><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>"); sb.Append(intSupply == 0 ? drModel["name"].ToString() : "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('INVENTORY_SUPPLY','?model=" + drModel["id"].ToString() + "&status=1');\">" + drModel["name"].ToString() + "</a>"); sb.Append(":</td><td width=\"100%\">"); sb.Append(oServiceRequest.GetStatusBarFill(((double.Parse(intSupply.ToString()) / double.Parse(intMax.ToString())) * 100.00), "95", false, "#6699CC")); sb.Append("</td><td nowrap>"); sb.Append(intSupply.ToString()); sb.Append("</td></tr>"); } } } } strSupply = sb.ToString(); }
private string LoadGroup(int _platformid, DataTable _demand, string _additional_filter) { string strGroup = ""; Functions oFunction = new Functions(intProfile, dsn, intEnvironment); DataSet dsTypes = oType.Gets(_platformid, 1); foreach (DataRow drType in dsTypes.Tables[0].Rows) { bool boolPhysical = false; bool boolBlade = false; bool boolOther = false; int intOldHost = -1; DataSet dsModels = oModelsProperties.GetTypes(1, Int32.Parse(drType["id"].ToString()), 1); foreach (DataRow drModel in dsModels.Tables[0].Rows) { boolOther = !boolOther; int intBlade = Int32.Parse(drModel["blade"].ToString()); int intHost = -1; if (drModel["hostid"].ToString() != "") { intHost = Int32.Parse(drModel["hostid"].ToString()); } string strType = "Unknown"; if (intBlade == 1) { strType = "Blade"; if (boolBlade == false) { if (strGroup != "") { strGroup += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strGroup += "<tr><td colspan=\"4\" class=\"bold\">" + drType["name"].ToString() + " | " + strType + "</td></tr>"; boolBlade = true; } } else if (intHost == 0) { strType = "Physical"; if (boolPhysical == false) { if (strGroup != "") { strGroup += "<tr><td colspan=\"4\"><p> </p></td></tr>"; } strGroup += "<tr><td colspan=\"4\" class=\"bold\">" + drType["name"].ToString() + " | " + strType + "</td></tr>"; boolPhysical = true; } } else if (intOldHost != intHost) { strType = drModel["host"].ToString(); if (intHost > 0) { if (strGroup != "") { strGroup += "<tr><td colspan=\"4\"><span style=\"width:100%;border-bottom:1 dotted #999999;\"/></td></tr>"; } strGroup += "<tr><td colspan=\"4\" class=\"bold\">" + drType["name"].ToString() + " | " + strType + "</td></tr>"; intOldHost = intHost; } } int intModel = Int32.Parse(drModel["id"].ToString()); DataRow[] drModels = _demand.Select("model = " + intModel.ToString() + strFilter + _additional_filter); int intDemand = 0; if (intHost == 0) { foreach (DataRow dr in drModels) { intDemand += Int32.Parse(dr["quantity"].ToString()); intDemand += Int32.Parse(dr["recovery_number"].ToString()); } strGroup += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (intDemand > 0 ? "greendefault" : (intDemand < 0 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>" + (intDemand == 0 ? drModel["name"].ToString() : "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('INVENTORY_DEMAND','?model=" + drModel["id"].ToString() + "&filters=" + oFunction.encryptQueryString(strFilter + _additional_filter) + "');\">" + drModel["name"].ToString() + "</a>") + ":</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>"; } else { // RAM double dblRAM = 0.0; string[] strQuestions; char[] strSplit = { ';' }; strQuestions = strQuestion.Split(strSplit); for (int ii = 0; ii < strQuestions.Length; ii++) { if (strQuestions[ii].Trim() != "") { int intQuestion = Int32.Parse(strQuestions[ii].Trim()); foreach (DataRow drCount in drModels) { int intAnswer = Int32.Parse(drCount["id"].ToString()); DataSet dsAnswers = oForecast.GetAnswerPlatform(intAnswer, intQuestion); foreach (DataRow drAnswer in dsAnswers.Tables[0].Rows) { int intResponse = Int32.Parse(drAnswer["responseid"].ToString()); dblRAM += double.Parse(oForecast.GetResponse(intResponse, "response")); } } } } strGroup += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblRAM > 0.00 ? "greendefault" : (dblRAM < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>RAM:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblRAM / double.Parse(intMaxRAM.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblRAM.ToString() + " GB</td></tr>"; // Disk Space double dblHDD = 0.0; foreach (DataRow drCount in drModels) { if (drCount["high_total"].ToString() != "") { dblHDD += double.Parse(drCount["high_total"].ToString()); } if (drCount["standard_total"].ToString() != "") { dblHDD += double.Parse(drCount["standard_total"].ToString()); } if (drCount["low_total"].ToString() != "") { dblHDD += double.Parse(drCount["low_total"].ToString()); } if (drCount["high_test"].ToString() != "") { dblHDD += double.Parse(drCount["high_test"].ToString()); } if (drCount["standard_test"].ToString() != "") { dblHDD += double.Parse(drCount["standard_test"].ToString()); } if (drCount["low_test"].ToString() != "") { dblHDD += double.Parse(drCount["low_test"].ToString()); } } strGroup += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + " class=\"" + (dblHDD > 0.00 ? "greendefault" : (dblHDD < 0.00 ? "reddefault" : "default")) + "\"><td nowrap><img src=\"/images/spacer.gif\" border=\"0\" width=\"10\" height=\"1\"/></td><td nowrap>Disk Space:</td><td width=\"100%\">" + oServiceRequest.GetStatusBarFill(((dblHDD / double.Parse(intMaxSpace.ToString())) * 100.00), "95", false, "#CC3300") + "</td><td nowrap>" + dblHDD.ToString() + " GB</td></tr>"; } } } if (strGroup != "") { strGroup = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">" + strGroup + "</table>"; } return(strGroup); }