B2016-009 - Add message box explaining copied step inherits the destination step type

This commit is contained in:
John Jenko 2017-01-26 20:35:25 +00:00
parent 3091ae0567
commit 125f3b1b43

View File

@ -539,11 +539,35 @@ namespace VEPROMS.CSLA.Library
return this; 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) public ItemInfo PasteSiblingBefore(int copyStartID, string chgid)
{ {
// To determine 'type' of pasted item, if it's a step (type >=20000), use the originating // 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. // item, i.e. item inserting after. If it's a section or procedure, use the copied item's type.
ItemInfo cpItem = ItemInfo.Get(copyStartID); 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; int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type;
try 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 // 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. // item, i.e. item inserting after. If it's a section or procedure, use the copied item's type.
ItemInfo cpItem = ItemInfo.Get(copyStartID); 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; int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type;
try try
{ {
@ -2247,6 +2272,7 @@ namespace VEPROMS.CSLA.Library
throw new System.Security.SecurityException("User not authorized to remove a Item"); throw new System.Security.SecurityException("User not authorized to remove a Item");
try 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); ItemInfo newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type);
// Delete business objects, including remove from tree // Delete business objects, including remove from tree
ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children