Example #1
0
 private void OnRecordChange(EventArgs e)
 {
     if (RecordChanged != null)
     {
         RecordChanged.Invoke(this, e);
     }
 }
Example #2
0
 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());
     }
 }
Example #3
0
        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());
            }
        }
Example #4
0
 private void OnRecordChanged()
 {
     RecordChanged?.Invoke(this, EventArgs.Empty);
 }