/// <summary> /// </summary> /// <param name="_unit"></param> /// <param name="default"></param> /// <param name="_ownerId"></param> /// <returns></returns> public int GetScale4Unit(string _unit, int @default, string _ownerId) { OwnerPersonId = int.Parse(_ownerId); if (UnitCode.ToString().Equals(_unit) || _unit == string.Empty && UnitCode == 0) { return(int.Parse(UnitScale)); } var resourceList = UnitAdvList; if (resourceList != null) { var unitAdv = 0; var res = resourceList.Find(r => r.Unit.Id == _unit); if (res != null) { unitAdv = res.Точность; } return(unitAdv == 0 ? @default : unitAdv); /* * foreach (UnitAdv unitAdv in resourceList) * if (unitAdv.Unit.Equals(_unit)) * return unitAdv.Точность == 0 ? @default : unitAdv.Точность; */ } return(@default); }
/// <summary> /// </summary> /// <param name="_unit"></param> /// <param name="default"></param> /// <returns></returns> public int GetScale4Unit(string _unit, int @default) { if (UnitCode.ToString().Equals(_unit)) { return(int.Parse(UnitScale)); } var resourceList = UnitAdvList; if (resourceList != null) { foreach (var unitAdv in resourceList) { if (unitAdv.Unit.Equals(_unit)) { return(unitAdv.Точность == 0 ? @default : unitAdv.Точность); } } } return(@default); }
public static string GetDescr(UnitCode uc) { return(uc.ToString()); }
public override String ToString() { return(UnitCode.ToString()); }