Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7a3243e882 | |||
a17419ac12 | |||
88905132e7 | |||
111bed58d6 | |||
bed61324d6 | |||
1a889352b8 |
@@ -8447,97 +8447,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Dr = dr;
|
Dr = dr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static DataTable GetDisplayTabs(int itemID) //, string displayTabID, string displayTabName)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DataTable tmp = DataPortal.Fetch<DataTable>(new DisplayTabs(itemID, "", "")); //, displayTabID, displayTabName));
|
|
||||||
//ItemInfo.AddList(tmp);
|
|
||||||
//tmp.AddEvents();
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private DataTable dt = new DataTable();
|
|
||||||
private DataTable DataPortal_Fetch(DisplayTabs criteria)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
||||||
{
|
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
|
||||||
cm.CommandText = "GetDisplayTabData";
|
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
|
||||||
SqlDataAdapter da = new SqlDataAdapter(cm);
|
|
||||||
da.Fill(dt);
|
|
||||||
cn.Close();
|
|
||||||
da.Dispose();
|
|
||||||
return dt;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DataPortal_Fetch", ex);
|
|
||||||
throw new DbCslaException("ItemExt.DataPortal_Fetch", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//public static void AddDisplayTabsState(int itemID, string displayTabID, string displayTabName)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// //DisplayTabs tmp =
|
|
||||||
// DataPortal.Fetch<DisplayTabs>(new DisplayTabs(itemID, displayTabID, displayTabName)); //, displayTabID, displayTabName));
|
|
||||||
// //ItemInfo.AddList(tmp);
|
|
||||||
// //tmp.AddEvents();
|
|
||||||
// //return tmp;
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//private DataTable dt = new DataTable();
|
|
||||||
//private void DataPortal_Fetch(int itemID, string displayTabID, string displayTabName)
|
|
||||||
//{
|
|
||||||
|
|
||||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
||||||
// {
|
|
||||||
// using (SqlCommand cm = cn.CreateCommand())
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// cm.CommandType = CommandType.StoredProcedure;
|
|
||||||
// cm.CommandText = "AddDisplayTabState";
|
|
||||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
|
||||||
// cm.Parameters.AddWithValue("@ItemID", ItemID);
|
|
||||||
// cm.Parameters.AddWithValue("@displayTabID", displayTabID);
|
|
||||||
// cm.Parameters.AddWithValue("@displayTabName", displayTabName);
|
|
||||||
// cm.ExecuteNonQuery();
|
|
||||||
// //SqlDataAdapter da = new SqlDataAdapter(cm);
|
|
||||||
// //da.Fill(dt);
|
|
||||||
// //cn.Close();
|
|
||||||
// //da.Dispose();
|
|
||||||
// //return dt; // fix
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// //if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DataPortal_Fetch", ex);
|
|
||||||
// throw new DbCslaException("ItemExt.DataPortal_Fetch", ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
public static void AddDisplayTabsState(int itemID, string displayTabID, string displayTabName)
|
public static void AddDisplayTabsState(int itemID, string displayTabID, string displayTabName)
|
||||||
//private void DataPortal_Fetch(int itemID, string displayTabID, string displayTabName)
|
//private void DataPortal_Fetch(int itemID, string displayTabID, string displayTabName)
|
||||||
{
|
{
|
||||||
|
@@ -2650,10 +2650,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
firstTrans = false;
|
firstTrans = false;
|
||||||
if (!CanDeleteObject())
|
if (!CanDeleteObject())
|
||||||
throw new System.Security.SecurityException("User not authorized to remove a Item");
|
throw new System.Security.SecurityException("User not authorized to remove a Item");
|
||||||
// B2016-009 check source and desintation types and display message box if needed
|
// B2016-009 check source and destination types and display message box if needed
|
||||||
// C2022-017 moved the CheckSourceDestinationType call to btnPasteReplace_Click in StepTabRibbon
|
// C2022-017 moved the CheckSourceDestinationType call to btnPasteReplace_Click in StepTabRibbon
|
||||||
// B2023-101 Handle Paste Replace when procedure to be replaced has Incoming Transitions, i.e. do a separate try/catch for this case
|
// B2023-101 Handle Paste Replace when procedure to be replaced has Incoming Transitions, i.e. do a separate try/catch for this case
|
||||||
ItemInfo newItemInfo = null;
|
ItemInfo newItemInfo = null;
|
||||||
|
using (ItemInfo copyItemInfo = ItemInfo.Get(copyStartID))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// C2017-031: Support for paste/replace an enhanced step, if this is replacing enhanced, do a specific query
|
// C2017-031: Support for paste/replace an enhanced step, if this is replacing enhanced, do a specific query
|
||||||
@@ -2662,6 +2664,80 @@ namespace VEPROMS.CSLA.Library
|
|||||||
newItemInfo = ItemInfo.CopyPasteReplaceEnhancedItemInfoFetch(copyStartID, itemInfo);
|
newItemInfo = ItemInfo.CopyPasteReplaceEnhancedItemInfoFetch(copyStartID, itemInfo);
|
||||||
if (newItemInfo == null) return null;
|
if (newItemInfo == null) return null;
|
||||||
}
|
}
|
||||||
|
//C2025-003 Enhanced Copy/Paste Upgrade - Added support for paste/replace on a master step
|
||||||
|
else if (itemInfo.HasEnhancedLinkedStep || copyItemInfo.HasEnhancedLinkedStep)
|
||||||
|
{
|
||||||
|
DialogResult rslt = DialogResult.No;
|
||||||
|
|
||||||
|
SectionConfig secCfg = itemInfo.ActiveSection.MyConfig as SectionConfig;
|
||||||
|
if (copyItemInfo.HasEnhancedLinkedStep && secCfg.MyEnhancedDocuments.Count > 0)
|
||||||
|
rslt = FlexibleMessageBox.Show("The step you are copying contains linked background documents." +
|
||||||
|
"\r\n\r\nDo you also wish to make a copy of the background documents?",
|
||||||
|
"Paste background documents", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
|
||||||
|
//unlink and remove any background documents attached to where you are copying to
|
||||||
|
//and then delete them
|
||||||
|
//if selected want to replace BG step (DialogResult.Yes)
|
||||||
|
if (itemInfo.HasEnhancedLinkedStep && rslt == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
foreach (EnhancedDocument ed in itemInfo.GetMyEnhancedDocuments())
|
||||||
|
{
|
||||||
|
using (ItemInfo exEnh = ItemInfo.Get(ed.ItemID))
|
||||||
|
{
|
||||||
|
exEnh.DoUnlinkEnhanced(exEnh, 0, false);
|
||||||
|
DeleteItemAndChildren(exEnh);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//do copy/paste replace of the master step
|
||||||
|
newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo);
|
||||||
|
if (newItemInfo == null) return null;
|
||||||
|
|
||||||
|
//copy any background documents
|
||||||
|
//if selected want to replace BG step (DialogResult.Yes)
|
||||||
|
if (copyItemInfo.HasEnhancedLinkedStep && rslt == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
foreach (EnhancedDocument ed in copyItemInfo.GetMyEnhancedDocuments())
|
||||||
|
{
|
||||||
|
using (ItemInfo exEnh = newItemInfo.DoAddMissingEnhancedItems(ed.Type))
|
||||||
|
{
|
||||||
|
PasteReplace(exEnh, ed.ItemID, chgid, ref firstTrans);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rslt == DialogResult.No)
|
||||||
|
{
|
||||||
|
//if selected didn't want to copy BG documents (DialogResult.No)
|
||||||
|
//need to unlink BG doc from old removed content (what was pasted over top of)
|
||||||
|
//re-link BG document to new paste replace master doc
|
||||||
|
//this should also auto update the text of the main linked item
|
||||||
|
//to match the new master doc wording
|
||||||
|
|
||||||
|
//get original BG documents
|
||||||
|
EnhancedDocuments orig_eds = itemInfo.GetMyEnhancedDocuments();
|
||||||
|
|
||||||
|
//remove link from pre-existing BG docs
|
||||||
|
foreach (EnhancedDocument ed in orig_eds)
|
||||||
|
{
|
||||||
|
using (ItemInfo exEnh = ItemInfo.Get(ed.ItemID))
|
||||||
|
{ exEnh.DoUnlinkEnhanced(exEnh, 0, false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove link from steps just copied
|
||||||
|
ItemInfo.PasteClearEnhanced(newItemInfo);
|
||||||
|
|
||||||
|
//re-link pre-existing BG docs to newly replaced master step
|
||||||
|
foreach (EnhancedDocument ed in orig_eds)
|
||||||
|
{
|
||||||
|
using (ItemInfo orig_ed_item = ItemInfo.Get(ed.ItemID))
|
||||||
|
{ newItemInfo.DoCreateLinksEnhancedSingleItem(orig_ed_item, ed.Type); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); if (newItemInfo == null) return null;
|
newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); if (newItemInfo == null) return null;
|
||||||
@@ -2684,7 +2760,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children
|
ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children
|
||||||
using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item);
|
using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item);
|
||||||
ItemInfo.PasteSetChangeId(newItemInfo, chgid);
|
ItemInfo.PasteSetChangeId(newItemInfo, chgid);
|
||||||
ItemInfo.PasteClearEnhanced(newItemInfo);
|
if (!copyItemInfo.HasEnhancedLinkedStep && !itemInfo.HasEnhancedLinkedStep) ItemInfo.PasteClearEnhanced(newItemInfo);
|
||||||
if (newItemInfo.NextItem != null) using (Item item = newItemInfo.NextItem.Get()) ItemInfo.Refresh(item);
|
if (newItemInfo.NextItem != null) using (Item item = newItemInfo.NextItem.Get()) ItemInfo.Refresh(item);
|
||||||
newItemInfo.RefreshNextItems();
|
newItemInfo.RefreshNextItems();
|
||||||
// if inserting after a caution or note, refreshes tabs. This will adjust bullets
|
// if inserting after a caution or note, refreshes tabs. This will adjust bullets
|
||||||
@@ -2733,9 +2809,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (ex.Message.Contains("has External Transitions and has no next step")
|
if (ex.Message.Contains("has External Transitions and has no next step")
|
||||||
|| ex.Message.Contains("has External Transitions to Procedure")
|
|| ex.Message.Contains("has External Transitions to Procedure")
|
||||||
|| ex.Message.Contains("has External Transitions to it's children")
|
|| ex.Message.Contains("has External Transitions to it's children")
|
||||||
|| ex.Message.Contains("This step has been deleted")
|
|| ex.Message.Contains("This step has been deleted"))
|
||||||
)
|
|
||||||
throw ex;
|
throw ex;
|
||||||
|
|
||||||
FlexibleMessageBox.Show("Details were written to the Error Log.", "Paste Replace Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
|
FlexibleMessageBox.Show("Details were written to the Error Log.", "Paste Replace Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
|
||||||
return itemInfo;
|
return itemInfo;
|
||||||
}
|
}
|
||||||
@@ -2743,6 +2819,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return itemInfo;
|
return itemInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
private static bool HandleSqlExceptionOnCopy(Exception ex)
|
private static bool HandleSqlExceptionOnCopy(Exception ex)
|
||||||
{
|
{
|
||||||
|
@@ -1195,12 +1195,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
cm.CommandText = "GetDisplayTabdata";
|
cm.CommandText = "GetDisplayTabdata";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
cm.Parameters.AddWithValue("@UserID", UserID);
|
cm.Parameters.AddWithValue("@UserID", UserID);
|
||||||
//cm.ExecuteNonQuery();
|
|
||||||
SqlDataAdapter da = new SqlDataAdapter(cm);
|
SqlDataAdapter da = new SqlDataAdapter(cm);
|
||||||
//da.Fill(dt);
|
|
||||||
//cn.Close();
|
|
||||||
//da.Dispose();
|
|
||||||
//return dt; // fix
|
|
||||||
|
|
||||||
SqlDataReader reader = cm.ExecuteReader();
|
SqlDataReader reader = cm.ExecuteReader();
|
||||||
DataTable dt = new DataTable();
|
DataTable dt = new DataTable();
|
||||||
@@ -1210,8 +1205,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DeactivateStateDisplayTabTmp", ex);
|
//B2025-004
|
||||||
throw new DbCslaException("ItemExt.DeactivateStateDisplayTabTmp", ex);
|
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
||||||
|
//instead of crashing
|
||||||
|
return new DataTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1806,7 +1806,7 @@ namespace Volian.Controls.Library
|
|||||||
//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
|
||||||
// C2017-031: Support for paste/replace an enhanced step, enable button
|
// C2017-031: Support for paste/replace an enhanced step, enable button
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable && ((!MyItemInfo.IsEnhancedStep && !MyItemInfo.HasEnhancedLinkedStep) || (MyItemInfo.IsEnhancedStep));
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable;
|
||||||
}
|
}
|
||||||
private void SetPasteButtonEnabled()
|
private void SetPasteButtonEnabled()
|
||||||
{
|
{
|
||||||
@@ -1866,25 +1866,6 @@ namespace Volian.Controls.Library
|
|||||||
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) toSourceHasEnhancedLinks = true;
|
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) toSourceHasEnhancedLinks = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// enhanced: if 'from' step is not enhanced, only allow paste before/after
|
|
||||||
if (MyItemInfo.IsHigh && !MyItemInfo.IsEnhancedStep)
|
|
||||||
{
|
|
||||||
stepToCfg = MyItemInfo.MyConfig as StepConfig;
|
|
||||||
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0)
|
|
||||||
{
|
|
||||||
// Current selected step is source (i.e. has enhanced links to enhanced steps)
|
|
||||||
// check if 'from' step is non. If so, allow paste before/after but not replace
|
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh)
|
|
||||||
{
|
|
||||||
StepConfig fromCfg = tmp.MyDisplayTabControl.MyCopyStep.MyConfig as StepConfig;
|
|
||||||
if (fromCfg != null && (fromCfg.MyEnhancedDocuments==null || fromCfg.MyEnhancedDocuments.Count==0))
|
|
||||||
{
|
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//copy item is high level step
|
//copy item is high level step
|
||||||
// Allow a High Level step to be pasted to a sub-step, but not to a table, figure, section or procedure type
|
// Allow a High Level step to be pasted to a sub-step, but not to a table, figure, section or procedure type
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh && (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsSection || MyItemInfo.IsProcedure))
|
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh && (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsSection || MyItemInfo.IsProcedure))
|
||||||
|
Reference in New Issue
Block a user