public void ShowChildWindow(AdminService.BetRecord _record) { record = CopyValueForModel(_record); orgRecord = _record; this.dataForm1.CurrentItem = record; base.Show(); }
AdminService.BetRecord CopyValueForModel(AdminService.BetRecord org) { AdminService.BetRecord dest = new AdminService.BetRecord(); foreach (PropertyInfo po in org.GetType().GetProperties()) { foreach (PropertyInfo pd in dest.GetType().GetProperties()) { if (pd.Name == po.Name) { pd.SetValue(dest, po.GetValue(org, null), null); break; } } } return dest; }