using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Text;
using Sleis.Utility;
using Sleis.Models;
namespace Sleis.HtmlHelpers
{
public static class UnitOfMeasureHelper
{
///
///
///
/// Epa Object
///
/// Value
/// Unit of Measure
///
public static string UnitOfMeasure(this HtmlHelper html, string value, string uomCode) where T:EpaBaseObject
{
StringBuilder sb = new StringBuilder();
//el.CurrentReleasePoint.GasVel %> velocity <%: LookupUtility.Get(Model.CurrentReleasePoint.GasVelUomCode).Value %>
if (!String.IsNullOrEmpty(value))
{
sb.Append(value); //actual value
sb.Append(" "); //space
if (!String.IsNullOrEmpty(uomCode))
{
sb.Append(LookupUtility.Get(uomCode).Value.ToUpper()); //unit of measure descriptor | always uppercase
}
}
return sb.ToString();
}
///
/// Returns a value and its corresponding value only if the value is present.
///
///
/// Value
/// Label to display if value is present
///
public static string ValueLabel(this HtmlHelper html, object value, string label)
{
StringBuilder sb = new StringBuilder();
//string stringVal = value.ToString();
if (value!=null && !String.IsNullOrEmpty(value.ToString()))
{
sb.Append(value.ToString());
sb.Append(" ");
if (!String.IsNullOrEmpty(label))
{
sb.Append(label.ToUpper()); //always display uppercase
}
}
return sb.ToString();
}
}
}