Enhanced Document support

Null check
Move DisplayText.cs to CSLA
Enhanced Documents – don’t allow ‘Save’ RO on enhanced step
Enhanced Documents windowing
Enhanced Documents remove unnecessary options
Enhanced Documents – don’t allow ‘Save’ transition on enhanced step
Enhanced Documents/Insert,Delete,Paste
This commit is contained in:
2016-01-20 16:43:23 +00:00
parent 77cdf81736
commit 6366af8b47
17 changed files with 1132 additions and 243 deletions

View File

@@ -683,7 +683,25 @@ namespace Volian.Controls.Library
private static int xOffset = 0;
public void RemoveItem()
{
//Volian.Base.Library.VlnTimer _MyTimer = new VlnTimer();
// if this item has enhanced edititems, remove them:
StepConfig sc = MyItemInfo.MyConfig as StepConfig;
List<EnhancedDocument> thisEnhs = null;
if (sc != null)
thisEnhs = sc.MyEnhancedDocuments;
else
{
if (MyItemInfo.IsSection)
{
SectionConfig secc = MyItemInfo.MyConfig as SectionConfig;
if (secc.Section_LnkEnh=="Y")thisEnhs = secc.MyEnhancedDocuments;
}
}
List<int> enhIds = new List<int>();
foreach (EnhancedDocument ed in thisEnhs)
{
if (ed.Type != 0) enhIds.Add(ed.ItemID);
}
BeingRemoved = true;
MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted
//ShowTops("\r\n");
@@ -717,6 +735,13 @@ namespace Volian.Controls.Library
//_MyTimer.ShowElapsedTimes("RemoveItem");
ForceEditItemRefresh(newFocus);
MyStepPanel.Controls.Remove(pnl);
foreach (int enhId in enhIds)
{
ItemInfo ii = ItemInfo.Get(enhId);
bool success = this._MyStepPanel.MyStepTabPanel.MyDisplayTabControl.DeleteRTBItem(ii);
if (!success) // item was not displayed in editor, just delete from database (add tree if necessarY)
Item.DeleteItemAndChildren(ii);
}
}
private static void ForceEditItemRefresh(EditItem newFocus)
@@ -998,9 +1023,9 @@ namespace Volian.Controls.Library
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
// see if this step has associated enhanced step(s):
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
// see if this step has associated enhanced step(s). If it does, flag it so
// that the enhanced steps get inserted also.
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.MyEnhancedDocuments.Count > 0)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
@@ -1034,6 +1059,18 @@ namespace Volian.Controls.Library
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("", "", type);
AddGridIfNeeded(newItemInfo);
DoAddSiblingAfter(newItemInfo, updateStatus);
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
// see if this step has associated enhanced step(s). If it does, flag it so
// that the enhanced steps get inserted also.
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.MyEnhancedDocuments.Count > 0)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.After;
}
}
}
private void DoAddSiblingAfter(ItemInfo newItemInfo, bool updateStatus)
{
@@ -1083,7 +1120,8 @@ namespace Volian.Controls.Library
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
// see if this step has associated enhanced step(s):
// see if this step has associated enhanced step(s). If it does, flag it so
// that the enhanced steps get inserted also.
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.MyEnhancedDocuments.Count > 0)
{
@@ -1206,9 +1244,21 @@ namespace Volian.Controls.Library
if (MyStepPanel.SelectedEditItem is RTBItem)
{
RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem;
// see if this step has associated enhanced step(s):
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.MyEnhancedDocuments.Count > 0)
// see if this step has associated enhanced step(s). If it does, flag it so
// that the enhanced steps get inserted also.
EnhancedDocuments cfgeds = null;
if (MyItemInfo.IsStepSection)
{
SectionConfig scfg = MyItemInfo.MyConfig as SectionConfig;
if (scfg.Section_LnkEnh != "Y") return;
cfgeds = scfg.MyEnhancedDocuments;
}
else
{
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
cfgeds = sc.MyEnhancedDocuments;
}
if (cfgeds != null && cfgeds.Count > 0)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.Child;
@@ -1294,8 +1344,10 @@ namespace Volian.Controls.Library
if (newEditItem != null) MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, newItemInfo.MyContent.Type));
// MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo));
}
private string GetChangeId(ItemInfo iiDest)
{
// get the change id for the destination's procedure's change id.
@@ -1326,6 +1378,8 @@ namespace Volian.Controls.Library
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, newItemInfo.MyContent.Type));
// MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo));
}
public void PasteChild(int copyStartID)
{
@@ -1375,6 +1429,9 @@ namespace Volian.Controls.Library
break;
}
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
// MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Child, GetChangeId(MyItemInfo));
}
public EditItem PasteReplace(int copyStartID)
{
@@ -1389,6 +1446,7 @@ namespace Volian.Controls.Library
EditItem prevEditItem = MyPreviousEditItem;
EditItem parentEditItem = ActiveParent;
StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig;
int TopMostYBefore = TopMostEditItem.Top;
int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top));
int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top));
@@ -1452,6 +1510,8 @@ namespace Volian.Controls.Library
}
MyStepPanel.SelectedEditItem = newEditItem; //Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type));
// MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Replace, GetChangeId(MyItemInfo));
return newEditItem;
}
private bool HandleSqlExceptionOnCopy(Exception ex)