public void CopyFromModel(PropertyInfo vm, object model, PropertyInfo[] modelProps) { var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField; var ckpi = modelProps.Single(ss => ss.Name == ckf); var ck = ckpi.GetValue(model, null) as bool?; var m = modelProps.FirstOrDefault(mm => mm.Name == vm.Name); Number = ((string)m.GetValue(model, null)).FmtFone(); ReceiveText = ck ?? false; }
public void CopyFromModel(PropertyInfo vm, object model, PropertyInfo[] modelProps) { var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField; var ckpi = modelProps.Single(ss => ss.Name == ckf); var ck = ckpi.GetValue(model, null) as bool?; var m = modelProps.FirstOrDefault(mm => mm.Name == vm.Name); Debug.Assert(m != null, "m != null"); Address = ((string)m.GetValue(model, null)); Send = ck ?? false; }
protected virtual object GetValue(PropertyInfo[] propertiesOnEvent, IEvent @event, EventMetaData metaData) { var property = propertiesOnEvent.Single(pi => pi.Name.Equals(_name, StringComparison.InvariantCultureIgnoreCase)); var value = property.GetValue(@event, null); if (value is Guid) return ((Guid)value).ToByteArray(); if (value is EventSourceVersion) return ((EventSourceVersion)value).Combine(); return value; }
public List<ChangeDetail> CopyToModel(PropertyInfo vm, object model, PropertyInfo[] modelProps, bool track) { var changes = new List<ChangeDetail>(); var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField; var ckpi = modelProps.Single(mm => mm.Name == ckf); if (track) { model.UpdateValue(changes, vm.Name, Number.GetDigits()); model.UpdateValue(changes, ckf, ReceiveText); return changes; } var ci = modelProps.FirstOrDefault(ss => ss.Name == vm.Name); Debug.Assert(ci != null, "ci != null"); ci.SetValue(model, Number.GetDigits(), null); ckpi.SetValue(model, ReceiveText, null); return changes; }
public string CopyToModel(PropertyInfo vm, object model, PropertyInfo[] modelProps, bool track) { var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField; var ckpi = modelProps.Single(mm => mm.Name == ckf); if (track) { var changes = new StringBuilder(); model.UpdateValue(changes, vm.Name, Address); model.UpdateValue(changes, ckf, Send); return changes.ToString(); } var ci = modelProps.FirstOrDefault(ss => ss.Name == vm.Name); Debug.Assert(ci != null, "ci != null"); ci.SetValue(model, Address, null); ckpi.SetValue(model, Send, null); return string.Empty; }