public bool SaveChanges() { JValidationResult result = Dm.Instance.ValidateObject(tempSourceObject); if (!result.isError) { Dm.CopyObjectProperties(tempSourceObject, sourceObject, CopyRestrictLevel.AllPropertiesNewLists); if (AttrHelper.IsAttributeDefinedForType <JEntity>(SourceObjectType, true)) { Dm.Instance.SaveObject(sourceObject); if (ViewMode == ViewMode.New && CloningObject != null) { MethodInfo cloneDependenciesMethod = SourceObjectType.GetMethod("CloneDependencies"); if (cloneDependenciesMethod != null) { DialogResult res = MessageBox.Show("Clone dependencies?", FrwConstants.WARNING, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (res == DialogResult.Yes) { object cdResult = cloneDependenciesMethod.Invoke(null, new object[] { CloningObject, sourceObject });//Pass null as the first argument (no need for an instance) } } } } SetModified(false); ChildObjectUpdateEventArgs ev = new ChildObjectUpdateEventArgs(); ev.UpdatedObject = sourceObject; OnPropertyObjectUpdate(ev); if (ViewMode == ViewMode.New) { ViewMode = ViewMode.Edit; } return(true); } else { AppManager.ShowValidationErrorMessage(result); return(false); } }