private void OnRecordChange(EventArgs e) { if (RecordChanged != null) { RecordChanged.Invoke(this, e); } }
public object this[string field] { get { if (!Table.Fields.Contains(field)) { throw new Exception($"Record do not have field {field}"); } return(GetType().GetProperty(field).GetValue(this)); } set { //TODO RecordChanged?.Invoke(this, new EventArgs()); } }
public object this[string field] { get { string hit = ""; string[] parts = field.Split(".".ToCharArray(), 2); field = parts.Last(); field = field.ToLower(); foreach (string f in Table.Fields) { if (f.ToLower() == field) { hit = f; } } if (hit.Length == 0) { throw new Exception($"Record do not have field {field}"); } return(GetType().GetProperty(hit).GetValue(this)); } set { string hit = ""; field = field.ToLower(); foreach (string f in Table.Fields) { if (f.ToLower() == field) { hit = f; } } if (hit.Length == 0) { throw new Exception($"Record do not have field {field}"); } GetType().GetProperty(hit).SetValue(this, value); RecordChanged?.Invoke(this, new EventArgs()); } }
private void OnRecordChanged() { RecordChanged?.Invoke(this, EventArgs.Empty); }