public List <RuleItemDto> GetDeprMethodList(string propTypeName, DateTime pisDate) { PropertyTypeEnum propType = PropertyTypeCode.translateShortNameToType(propTypeName); DeprMethodRule deprMethodRule = new DeprMethodRule(); DeprPctRule deprPctRule = new DeprPctRule(); List <DeprMethodCode> deprMethodList = deprMethodRule.BuildValidList(propType, pisDate); List <RuleItemDto> itemList = new List <RuleItemDto>(); foreach (DeprMethodCode deprMethod in deprMethodList) { if (deprMethod.Percentage > 0) { itemList.Add(new RuleItemDto { Id = (int)deprMethod.Type, Name = deprMethod.shortName() + deprMethod.Percentage, Value = deprMethod.longName() }); } else { itemList.Add(new RuleItemDto { Id = (int)deprMethod.Type, Name = deprMethod.shortName(), Value = deprMethod.longName() }); } } return(itemList); }
public static bool TryParse(string str, PropertyTypeCode code, out object value) { bool res; switch(code) { case PropertyTypeCode.Boolean: bool boolVal; res = bool.TryParse(str, out boolVal); value = boolVal; return res; case PropertyTypeCode.Int32: int intVal; res = int.TryParse(str, out intVal); value = intVal; return res; case PropertyTypeCode.String: value = str; return str != null; default: throw new Exception(string.Format("Type code {0} is not supported.", code)); } }
private IBADeprScheduleItem transformDepreciableBookDtoToDeprScheduleItem(DepreciableBookDto deprBook) { IBADeprScheduleItem deprScheduleItem = GetDeprScheduleItem(); deprScheduleItem.PropertyType = (short)PropertyTypeCode.translateShortNameToType(deprBook.PropertyType).Type; deprScheduleItem.PlacedInServiceDate = deprBook.PlaceInServiceDate; deprScheduleItem.AcquisitionValue = deprBook.AcquiredValue; deprScheduleItem.DeprMethod = deprBook.DepreciateMethod; deprScheduleItem.DeprPercent = deprBook.DepreciatePercent; deprScheduleItem.DeprLife = deprBook.EstimatedLife; return(deprScheduleItem); }
public List <RuleItemDto> GetEstLifeList(string propTypeName, DateTime pisDate, string deprMethodName) { PropertyTypeEnum propType = PropertyTypeCode.translateShortNameToType(propTypeName); DeprMethodCode deprMethodCode = DeprMethodCode.translateDeprNameToCode(deprMethodName); EstLifeRule estLifeRule = new EstLifeRule(); List <YrsMosDate> estLifeList = estLifeRule.BuildValidList(propType, pisDate, deprMethodCode.Type, deprMethodCode.Percentage); List <RuleItemDto> itemList = new List <RuleItemDto>(); foreach (YrsMosDate estLife in estLifeList) { string text = String.Format("{0,-2:00} yrs {1,-2:00} mos", estLife.Years, estLife.Months); itemList.Add(new RuleItemDto() { Name = text, Value = text }); } return(itemList); }