///-------------------------------------------------------------------------------- /// <summary>This method sets the default values.</summary> ///-------------------------------------------------------------------------------- protected override void OnSetDefaults() { if (PropertyRelationship.ReverseInstance != null) { EditPropertyRelationship.TransformDataFromObject(PropertyRelationship.ReverseInstance, null, false); } else if (PropertyRelationship.IsAutoUpdated == true) { EditPropertyRelationship.TransformDataFromObject(PropertyRelationship, null, false); } else { PropertyRelationship newPropertyRelationship = new PropertyRelationship(); newPropertyRelationship.PropertyRelationshipID = EditPropertyRelationship.PropertyRelationshipID; EditPropertyRelationship.TransformDataFromObject(newPropertyRelationship, null, false); } EditPropertyRelationship.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 (PropertyRelationship.ReverseInstance == null && PropertyRelationship.IsAutoUpdated == true) { PropertyRelationship.ReverseInstance = new PropertyRelationship(); PropertyRelationship.ReverseInstance.TransformDataFromObject(PropertyRelationship, null, false); // perform the update of EditPropertyRelationship back to PropertyRelationship PropertyRelationship.TransformDataFromObject(EditPropertyRelationship, null, false); PropertyRelationship.IsAutoUpdated = false; } else if (PropertyRelationship.ReverseInstance != null) { EditPropertyRelationship.ResetModified(PropertyRelationship.ReverseInstance.IsModified); if (EditPropertyRelationship.Equals(PropertyRelationship.ReverseInstance)) { // perform the update of EditPropertyRelationship back to PropertyRelationship PropertyRelationship.TransformDataFromObject(EditPropertyRelationship, null, false); PropertyRelationship.IsAutoUpdated = true; } else { // perform the update of EditPropertyRelationship back to PropertyRelationship PropertyRelationship.TransformDataFromObject(EditPropertyRelationship, null, false); PropertyRelationship.IsAutoUpdated = false; } } else { // perform the update of EditPropertyRelationship back to PropertyRelationship PropertyRelationship.TransformDataFromObject(EditPropertyRelationship, null, false); PropertyRelationship.IsAutoUpdated = false; } PropertyRelationship.ForwardInstance = null; if (RelationshipIDCustomized || OrderCustomized || DescriptionCustomized || TagsCustomized) { PropertyRelationship.ForwardInstance = new PropertyRelationship(); PropertyRelationship.ForwardInstance.PropertyRelationshipID = EditPropertyRelationship.PropertyRelationshipID; PropertyRelationship.SpecSourceName = PropertyRelationship.DefaultSourceName; if (RelationshipIDCustomized) { PropertyRelationship.ForwardInstance.RelationshipID = EditPropertyRelationship.RelationshipID; } if (OrderCustomized) { PropertyRelationship.ForwardInstance.Order = EditPropertyRelationship.Order; } if (DescriptionCustomized) { PropertyRelationship.ForwardInstance.Description = EditPropertyRelationship.Description; } if (TagsCustomized) { PropertyRelationship.ForwardInstance.Tags = EditPropertyRelationship.Tags; } } EditPropertyRelationship.ResetModified(false); OnUpdated(this, null); // send update back to solution builder SendEditPropertyRelationshipPerformed(); }
///-------------------------------------------------------------------------------- /// <summary>This method resets the data.</summary> ///-------------------------------------------------------------------------------- protected override void OnReset() { EditPropertyRelationship.TransformDataFromObject(PropertyRelationship, null, false); EditPropertyRelationship.ResetModified(false); }