public static void Insert(RedBloodDataContext db, Donation p, string propertyName, string note) { DonationTestLog e = new DonationTestLog(); e.DIN = p.DIN; e.Type = propertyName; PropertyInfo prop = p.GetType().GetProperty(propertyName); if (prop != null) { e.Result = prop.GetValue(p, null).ToString(); } e.Date = DateTime.Now; e.Actor = RedBloodSystem.CurrentActor; e.Note = note; db.DonationTestLogs.InsertOnSubmit(e); }