/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <param name="unit"></param> public ReportItem(string name, object value, Unit unit, string format) { this.Name = name; this.Value = value; this.Unit = unit; this.Format = format; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="orderNumber"></param> /// <param name="unit"></param> public DataItemAttribute(string name, int orderNumber, Unit unit, string format) { this._name = name; this._orderNumber = orderNumber; if (unit == null) { throw new ArgumentNullException("unit"); } this._unit = unit; this._format = format; Console.WriteLine(this._format); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="valueType"></param> /// <param name="value"></param> /// <param name="unit"></param> /// <param name="orderNumber"></param> /// <param name="description"></param> public ParameterBase(string name, Type valueType, object value, Unit unit, int orderNumber, string description) { if (value == null) { throw new ArgumentNullException("value"); } if (valueType == null) { throw new ArgumentNullException("valueType"); } this.Name = name; this.ValueType = valueType; this.Value = value; this.Unit = unit; this.OrderNumber = orderNumber; this.Description = description; }
/// <summary> /// /// </summary> static Unit() { object[] objs = new object[] { UnitType.None , new string[] {""}, UnitType.Flow ,new string[] {"m3/s", "m3/h"}, UnitType.Length , new string[] {"mm","cm","m"}, UnitType.Press , new string[] {"pa","mpa"}, UnitType.Temperature, new string[] {"c"}, UnitType.Time, new string[] {"second","minute","hour"}, UnitType.Volume, new string[] {"m3"}, }; for (int i = 0; i < objs.Length; i += 2) { UnitType ut = (UnitType)objs[i]; string[] values = (string[])objs[i + 1]; foreach (string value in values) { Unit unit = new Unit(value, ut); string key = value.ToUpper(); _hash[key] = unit; } } }
/// <summary> /// /// </summary> /// <returns></returns> public static Unit FindByName(string name) { string key = name.Trim().ToUpper(); object obj = _hash[key]; if (obj != null) { return (Unit)obj; } else { Unit newUnit = new Unit(name, UnitType.None); _hash[key] = newUnit; return newUnit; //throw new ArgumentException(string.Format("not fine unit '{0}'", name)); } }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <param name="unit"></param> public ReportItem(string name, object value, Unit unit) : this(name, value, unit, null) { }