diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index edb5ddb2..550c4751 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -539,11 +539,35 @@ namespace VEPROMS.CSLA.Library return this; } } + // B2016-009 - added a message box explaining to the user that the copyed step will take on the destination type. 16-bit PROMS had also done this way. + // - this one is used for Paste Replace with copyed step + public static void CheckSourceDestinationType(int copyStartID, ItemInfo itemInfo) + { + ItemInfo cpyItem = ItemInfo.Get(copyStartID); + int? SourceType = cpyItem._MyContent.Type; + int? DestType = itemInfo._MyContent.Type; + if (DestType >= 20000 && DestType != SourceType) + { + string msg = "The step you are copying TO is a different type than the step you are copying FROM.\n\nThe copied step will inherit the destination step type.\n\nOnce copied, the step type can be changed from the Tags tab on the Step Properties panel."; + MessageBox.Show(msg, "Different Step Types", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + // B2016-009 - added a message box explaining to the user that the copyed step will take on the destination type. 16-bit PROMS had also done this way. + // - this one is used for Insert Copyed step Before or After + private void CheckSourceDestinationType(int? DestType, int? SourceType) + { + if (DestType >= 20000 && DestType != SourceType) + { + string msg = "The step you are copying TO is a different type than the step you are copying FROM.\n\nThe copied step will inherit the destination step type.\n\nOnce copied, the step type can be changed from the Tags tab on the Step Properties panel."; + MessageBox.Show(msg, "Different Step Types", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } public ItemInfo PasteSiblingBefore(int copyStartID, string chgid) { // To determine 'type' of pasted item, if it's a step (type >=20000), use the originating // item, i.e. item inserting after. If it's a section or procedure, use the copied item's type. ItemInfo cpItem = ItemInfo.Get(copyStartID); + CheckSourceDestinationType(MyContent.Type, cpItem.MyContent.Type); // B2016-009 check source and desintation types and display message box if needed int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type; try { @@ -568,6 +592,7 @@ namespace VEPROMS.CSLA.Library // To determine 'type' of pasted item, if it's a step (type >=20000), use the originating // item, i.e. item inserting after. If it's a section or procedure, use the copied item's type. ItemInfo cpItem = ItemInfo.Get(copyStartID); + CheckSourceDestinationType(MyContent.Type, cpItem.MyContent.Type); // B2016-009 check source and desintation types and display message box if needed int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type; try { @@ -2247,6 +2272,7 @@ namespace VEPROMS.CSLA.Library throw new System.Security.SecurityException("User not authorized to remove a Item"); try { + ItemInfo.CheckSourceDestinationType(copyStartID, itemInfo); // B2016-009 check source and desintation types and display message box if needed ItemInfo newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type); // Delete business objects, including remove from tree ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children