public virtual OnSetOutputModel OnSet(OnSetInputModel input) { var model = new OnSetOutputModel(); model.DepartmentStore.SetPropertyValue(OnSetOutputModel.IsChangePropertyValueProperty, false); return(model); }
public override OnSetOutputModel OnSet(OnSetInputModel input) { decimal current = ((IConvertible)input.DepartmentStore.GetPropertyValue(OnSetInputModel.PropertySettableValueProperty) ?? 0).ToDecimal(new NumberFormatInfo()); decimal newVal = Math.Max(Math.Min(current, max), min); OnSetOutputModel model = base.OnSet(input); model.DepartmentStore.SetPropertyValue(OnSetOutputModel.IsChangePropertyValueProperty, true); model.DepartmentStore.SetPropertyValue(OnSetOutputModel.NewPropertyValueProperty, ((IConvertible)newVal).ToType(input.DepartmentStore.GetPropertyValue(OnSetInputModel.PropertyInfoProperty).PropertyType, new NumberFormatInfo())); return(model); }