Merge pull request 'C2017-031 Extend Copy / Paste Replace Functionality for Enhanced Background Steps' (#414) from C2017-031 into Development
Code changes look good. OK for testing phase.
This commit is contained in:
commit
610b2d178c
File diff suppressed because it is too large
Load Diff
@ -1952,6 +1952,53 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region DataPortal
|
#region DataPortal
|
||||||
|
// C2017-031: Support for paste/replace an enhanced step
|
||||||
|
private void DataPortal_Fetch(PastingPartEnhancedCriteria criteria)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
Csla.ApplicationContext.LocalContext["cn"] = cn;
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.Parameters.AddWithValue("@StartItemID", criteria.StartItemID); // copy children
|
||||||
|
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID); //copy to
|
||||||
|
cm.Parameters.AddWithValue("@Type", criteria.Type);
|
||||||
|
cm.Parameters.AddWithValue("@DTS", criteria.DTS);
|
||||||
|
cm.Parameters.AddWithValue("@UserID", criteria.UserID);
|
||||||
|
SqlParameter param_ContentID = new SqlParameter("@NewItemID", SqlDbType.Int);
|
||||||
|
param_ContentID.Direction = ParameterDirection.Output;
|
||||||
|
cm.Parameters.Add(param_ContentID);
|
||||||
|
cm.CommandText = "PasteItemEnhancedReplace";
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
if (!dr.Read())
|
||||||
|
{
|
||||||
|
_ErrorMessage = "No Record Found";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReadData(dr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// removing of item only needed for local data portal
|
||||||
|
if (Csla.ApplicationContext.ExecutionLocation == Csla.ApplicationContext.ExecutionLocations.Client)
|
||||||
|
Csla.ApplicationContext.LocalContext.Remove("cn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (!ex.Message.Contains("This step has been deleted") && !ex.Message.Contains("This current step has been deleted in another session"))
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfo.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
_ErrorMessage = ex.Message;
|
||||||
|
throw new DbCslaException("ItemInfo.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void DataPortal_Fetch(PastingPartCriteria criteria)
|
private void DataPortal_Fetch(PastingPartCriteria criteria)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
||||||
@ -2074,6 +2121,69 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region PastingPartEnhancedCriteria
|
||||||
|
// C2017-031: Support for paste/replace an enhanced step
|
||||||
|
[Serializable()]
|
||||||
|
public class PastingPartEnhancedCriteria
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
private int _StartItemID;
|
||||||
|
public int StartItemID
|
||||||
|
{
|
||||||
|
get { return _StartItemID; }
|
||||||
|
set { _StartItemID = value; }
|
||||||
|
}
|
||||||
|
private int _ItemID; // paste relative to this itemid
|
||||||
|
public int ItemID
|
||||||
|
{
|
||||||
|
get { return _ItemID; }
|
||||||
|
set { _ItemID = value; }
|
||||||
|
}
|
||||||
|
private EAddpingPart _AddType;
|
||||||
|
public EAddpingPart AddType
|
||||||
|
{
|
||||||
|
get { return _AddType; }
|
||||||
|
set { _AddType = value; }
|
||||||
|
}
|
||||||
|
private int? _FromType = null;
|
||||||
|
public int? FromType
|
||||||
|
{
|
||||||
|
get { return _FromType; }
|
||||||
|
set { _FromType = value; }
|
||||||
|
}
|
||||||
|
private int? _Type = null;
|
||||||
|
public int? Type
|
||||||
|
{
|
||||||
|
get { return _Type; }
|
||||||
|
set { _Type = value; }
|
||||||
|
}
|
||||||
|
private DateTime _DTS;
|
||||||
|
public DateTime DTS
|
||||||
|
{
|
||||||
|
get { return _DTS; }
|
||||||
|
set { _DTS = value; }
|
||||||
|
}
|
||||||
|
private string _UserID;
|
||||||
|
public string UserID
|
||||||
|
{
|
||||||
|
get { return _UserID; }
|
||||||
|
set { _UserID = value; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Constructor
|
||||||
|
public PastingPartEnhancedCriteria(int startItemid, int itemID, EAddpingPart addType, int? type, int? fromType, DateTime dts, string userID)
|
||||||
|
{
|
||||||
|
_StartItemID = startItemid;
|
||||||
|
_ItemID = itemID;
|
||||||
|
_AddType = addType;
|
||||||
|
_Type = type;
|
||||||
|
_FromType = fromType;
|
||||||
|
_DTS = dts;
|
||||||
|
_UserID = userID;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#region PastingPartCriteria
|
#region PastingPartCriteria
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
public class PastingPartCriteria
|
public class PastingPartCriteria
|
||||||
@ -2364,6 +2474,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_MyPrevious = null; // Reset list so that the next line gets a new list
|
_MyPrevious = null; // Reset list so that the next line gets a new list
|
||||||
if (MyPrevious != null) MyPrevious.RefreshNextItems(); // Update List for new value
|
if (MyPrevious != null) MyPrevious.RefreshNextItems(); // Update List for new value
|
||||||
}
|
}
|
||||||
|
// C2017-031: Support for paste/replace an enhanced step
|
||||||
|
internal static ItemInfo CopyPasteReplaceEnhancedItemInfoFetch(int copyStartID, ItemInfo itemInfo)
|
||||||
|
{
|
||||||
|
ItemInfo tmp = null;
|
||||||
|
tmp = DataPortal.Fetch<StepInfo>(new ItemInfo.PastingPartEnhancedCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
|
||||||
|
AddToCache(tmp);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
internal static ItemInfo CopyPasteReplaceItemInfoFetch(int copyStartID, ItemInfo itemInfo) // int itemID, int? type, int? fromType)
|
internal static ItemInfo CopyPasteReplaceItemInfoFetch(int copyStartID, ItemInfo itemInfo) // int itemID, int? type, int? fromType)
|
||||||
{
|
{
|
||||||
ItemInfo tmp = null;
|
ItemInfo tmp = null;
|
||||||
@ -2525,9 +2643,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
ItemInfo newItemInfo = null;
|
ItemInfo newItemInfo = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type);
|
// C2017-031: Support for paste/replace an enhanced step, if this is replacing enhanced, do a specific query
|
||||||
|
if (itemInfo.IsEnhancedStep)
|
||||||
|
{
|
||||||
|
newItemInfo = ItemInfo.CopyPasteReplaceEnhancedItemInfoFetch(copyStartID, itemInfo);
|
||||||
if (newItemInfo == null) return null;
|
if (newItemInfo == null) return null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); if (newItemInfo == null) return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception ex1)
|
catch (Exception ex1)
|
||||||
{
|
{
|
||||||
if (ex1.Message.Contains("has External Transitions and has no next step")
|
if (ex1.Message.Contains("has External Transitions and has no next step")
|
||||||
|
@ -1944,7 +1944,8 @@ namespace Volian.Controls.Library
|
|||||||
sia.IdentifyChildren(highlight);
|
sia.IdentifyChildren(highlight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MyBeforeEditItems != null)
|
// C2017-031: Support for paste/replace an enhanced step: don't identify/copy before items, i.e. notes/cautions
|
||||||
|
if (MyBeforeEditItems != null && !MyItemInfo.IsEnhancedStep)
|
||||||
{
|
{
|
||||||
foreach (EditItem sib in MyBeforeEditItems)
|
foreach (EditItem sib in MyBeforeEditItems)
|
||||||
{
|
{
|
||||||
|
BIN
PROMS/Volian.Controls.Library/RTBItem.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/RTBItem.designer.cs
generated
Binary file not shown.
@ -1231,7 +1231,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public ItemSelectedChangedEventArgs(EditItem myEditItem)
|
public ItemSelectedChangedEventArgs(EditItem myEditItem)
|
||||||
{
|
{
|
||||||
_MyItemInfo = myEditItem.MyItemInfo;
|
_MyItemInfo = myEditItem?.MyItemInfo;
|
||||||
_MyEditItem = myEditItem;
|
_MyEditItem = myEditItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,6 +485,8 @@ namespace Volian.Controls.Library
|
|||||||
public void RefreshDisplay(bool activeMode)
|
public void RefreshDisplay(bool activeMode)
|
||||||
{
|
{
|
||||||
if (IsExperimenting) return;
|
if (IsExperimenting) return;
|
||||||
|
if (IsDisposed) return;
|
||||||
|
|
||||||
ActiveMode = activeMode;
|
ActiveMode = activeMode;
|
||||||
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
||||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 2");
|
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 2");
|
||||||
|
@ -1750,7 +1750,7 @@ namespace Volian.Controls.Library
|
|||||||
// note in follow if statements, 'setting' == false when in enhanced document:
|
// note in follow if statements, 'setting' == false when in enhanced document:
|
||||||
if (setting && MyItemInfo.IsStep && (eds == null || eds.Count == 0)) // this step is in enhanced, but not linked // B2018-112 and is allowed to edit
|
if (setting && MyItemInfo.IsStep && (eds == null || eds.Count == 0)) // this step is in enhanced, but not linked // B2018-112 and is allowed to edit
|
||||||
allowDel = true; // allow delete if not linked
|
allowDel = true; // allow delete if not linked
|
||||||
btnCpyStp.Enabled = setting;
|
btnCpyStp.Enabled = MyUserInfo.IsAllowedToEdit(Mydvi); // C2017-031: Support for paste/replace an enhanced step
|
||||||
//B20170-158 Allow a Unlinked Step to be pasted before or after a linked step.
|
//B20170-158 Allow a Unlinked Step to be pasted before or after a linked step.
|
||||||
StepTabPanel tmp = Parent as StepTabPanel;
|
StepTabPanel tmp = Parent as StepTabPanel;
|
||||||
//B2020-058: crash on null reference
|
//B2020-058: crash on null reference
|
||||||
@ -1801,7 +1801,8 @@ namespace Volian.Controls.Library
|
|||||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = enable;
|
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = enable;
|
||||||
//B20170-158 Don't allow a step to replace a linked step
|
//B20170-158 Don't allow a step to replace a linked step
|
||||||
//B2017-180: The fix for B2017-158 also needed the 'HasEnhancedLinkedStep' to check if the copied step is a source step
|
//B2017-180: The fix for B2017-158 also needed the 'HasEnhancedLinkedStep' to check if the copied step is a source step
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable && !MyItemInfo.IsEnhancedStep && !MyItemInfo.HasEnhancedLinkedStep;
|
// C2017-031: Support for paste/replace an enhanced step, enable button
|
||||||
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable && ((!MyItemInfo.IsEnhancedStep && !MyItemInfo.HasEnhancedLinkedStep) || (MyItemInfo.IsEnhancedStep));
|
||||||
}
|
}
|
||||||
private void SetPasteButtonEnabled()
|
private void SetPasteButtonEnabled()
|
||||||
{
|
{
|
||||||
@ -4110,9 +4111,19 @@ namespace Volian.Controls.Library
|
|||||||
// F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format
|
// F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format
|
||||||
ItemInfo.PasteStepIsWithinDefinedSubStepLevels(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo, true);
|
ItemInfo.PasteStepIsWithinDefinedSubStepLevels(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo, true);
|
||||||
EditItem oldEditItem = MyEditItem;
|
EditItem oldEditItem = MyEditItem;
|
||||||
|
// C2017-031: Support for paste/replace an enhanced step, if pasting an enhanced, remove its EditItem from the 'cache'. A new EditItem gets created during paste.
|
||||||
|
if (MyEditItem != null && MyEditItem.MyItemInfo.IsEnhancedStep) MyEditItem.MyStepPanel._LookupEditItems.Remove(MyEditItem.MyItemInfo.ItemID);
|
||||||
MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
|
MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
|
||||||
if (MyEditItem == null) oldEditItem.IdentifyMe(false); // B2017-179 if null then we didn't do the replace but did position to the first transition that needs resolved
|
if (MyEditItem == null) oldEditItem.IdentifyMe(false); // B2017-179 if null then we didn't do the replace but did position to the first transition that needs resolved
|
||||||
if (MyEditItem != null && MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose();
|
// C2017-031: Support for paste/replace an enhanced step, add Dispose of old EditItem if enhanced
|
||||||
|
if (MyEditItem != null && ((MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) || MyEditItem.MyItemInfo.IsEnhancedStep))
|
||||||
|
oldEditItem.Dispose();
|
||||||
|
// C2017-031: Support for paste/replace an enhanced step, refresh ItemInfo's in user interface caches.
|
||||||
|
if (MyEditItem.MyItemInfo.IsEnhancedStep)
|
||||||
|
{
|
||||||
|
MyEditItem.MyItemInfo = ItemInfo.Get(MyEditItem.MyItemInfo.ItemID);
|
||||||
|
tmp.MyStepPanel.SelectedItemInfo = ItemInfo.Get(MyEditItem.MyItemInfo.ItemID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPdfCreate_Click(object sender, EventArgs e)
|
private void btnPdfCreate_Click(object sender, EventArgs e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user