///-------------------------------------------------------------------------------- /// <summary>This method sets the default values.</summary> ///-------------------------------------------------------------------------------- protected override void OnSetDefaults() { if (MethodRelationship.ReverseInstance != null) { EditMethodRelationship.TransformDataFromObject(MethodRelationship.ReverseInstance, null, false); } else if (MethodRelationship.IsAutoUpdated == true) { EditMethodRelationship.TransformDataFromObject(MethodRelationship, null, false); } else { MethodRelationship newMethodRelationship = new MethodRelationship(); newMethodRelationship.MethodRelationshipID = EditMethodRelationship.MethodRelationshipID; EditMethodRelationship.TransformDataFromObject(newMethodRelationship, null, false); } EditMethodRelationship.ResetModified(true); }
///-------------------------------------------------------------------------------- /// <summary>This method updates the view model data and sends update command back /// to the solution builder.</summary> ///-------------------------------------------------------------------------------- protected override void OnUpdate() { // set up reverse engineering instance if not present if (MethodRelationship.ReverseInstance == null && MethodRelationship.IsAutoUpdated == true) { MethodRelationship.ReverseInstance = new MethodRelationship(); MethodRelationship.ReverseInstance.TransformDataFromObject(MethodRelationship, null, false); // perform the update of EditMethodRelationship back to MethodRelationship MethodRelationship.TransformDataFromObject(EditMethodRelationship, null, false); MethodRelationship.IsAutoUpdated = false; } else if (MethodRelationship.ReverseInstance != null) { EditMethodRelationship.ResetModified(MethodRelationship.ReverseInstance.IsModified); if (EditMethodRelationship.Equals(MethodRelationship.ReverseInstance)) { // perform the update of EditMethodRelationship back to MethodRelationship MethodRelationship.TransformDataFromObject(EditMethodRelationship, null, false); MethodRelationship.IsAutoUpdated = true; } else { // perform the update of EditMethodRelationship back to MethodRelationship MethodRelationship.TransformDataFromObject(EditMethodRelationship, null, false); MethodRelationship.IsAutoUpdated = false; } } else { // perform the update of EditMethodRelationship back to MethodRelationship MethodRelationship.TransformDataFromObject(EditMethodRelationship, null, false); MethodRelationship.IsAutoUpdated = false; } MethodRelationship.ForwardInstance = null; if (RelationshipIDCustomized || OrderCustomized || DescriptionCustomized || TagsCustomized) { MethodRelationship.ForwardInstance = new MethodRelationship(); MethodRelationship.ForwardInstance.MethodRelationshipID = EditMethodRelationship.MethodRelationshipID; MethodRelationship.SpecSourceName = MethodRelationship.DefaultSourceName; if (RelationshipIDCustomized) { MethodRelationship.ForwardInstance.RelationshipID = EditMethodRelationship.RelationshipID; } if (OrderCustomized) { MethodRelationship.ForwardInstance.Order = EditMethodRelationship.Order; } if (DescriptionCustomized) { MethodRelationship.ForwardInstance.Description = EditMethodRelationship.Description; } if (TagsCustomized) { MethodRelationship.ForwardInstance.Tags = EditMethodRelationship.Tags; } } EditMethodRelationship.ResetModified(false); OnUpdated(this, null); // send update back to solution builder SendEditMethodRelationshipPerformed(); }
///-------------------------------------------------------------------------------- /// <summary>This method resets the data.</summary> ///-------------------------------------------------------------------------------- protected override void OnReset() { EditMethodRelationship.TransformDataFromObject(MethodRelationship, null, false); EditMethodRelationship.ResetModified(false); }