示例#1
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method is used to copy/paste a new item.</summary>
        ///
        /// <param name="copyItem">The item to copy/paste.</param>
        /// <param name="savePaste">Flag to determine whether to save the results of the paste.</param>
        ///--------------------------------------------------------------------------------
        public AuditPropertyViewModel PasteAuditProperty(AuditPropertyViewModel copyItem, bool savePaste = true)
        {
            AuditProperty newItem = new AuditProperty();

            newItem.ReverseInstance = new AuditProperty();
            newItem.TransformDataFromObject(copyItem.AuditProperty, null, false);
            newItem.PropertyID    = Guid.NewGuid();
            newItem.IsAutoUpdated = false;

            newItem.Solution = Solution;
            newItem.Solution = Solution;
            AuditPropertyViewModel newView = new AuditPropertyViewModel(newItem, Solution);

            newView.ResetModified(true);
            AddAuditProperty(newView);

            // paste children
            if (savePaste == true)
            {
                Solution.AuditPropertyList.Add(newItem);
                newView.OnUpdated(this, null);
                Solution.ResetModified(true);
            }
            return(newView);
        }