New Enhanced Document Properties

Fixed Find and Replace logic to keep it from getting into an infinite loop
Used new CSLA code to hanndle deletion of procedures with external transitions
New Enhanced Document properties
This commit is contained in:
Rich 2015-10-27 13:34:33 +00:00
parent e22458bd1a
commit 58e58083c2
7 changed files with 242 additions and 197 deletions

View File

@ -987,8 +987,19 @@ namespace Volian.Controls.Library
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text); ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text);
AddGridIfNeeded(newItemInfo); AddGridIfNeeded(newItemInfo);
DoAddSiblingAfter(newItemInfo, updateStatus); DoAddSiblingAfter(newItemInfo, updateStatus);
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)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.After;
}
}
} }
// This logic allows us to do an Insert Before and Insert After while on a Table // This logic allows us to do an Insert Before and Insert After while on a Table
// if allowed by the format // if allowed by the format
private void AddGridIfNeeded(ItemInfo newItemInfo) private void AddGridIfNeeded(ItemInfo newItemInfo)
@ -1061,6 +1072,17 @@ namespace Volian.Controls.Library
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text); ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text);
AddGridIfNeeded(newItemInfo); AddGridIfNeeded(newItemInfo);
DoAddSiblingBefore(newItemInfo, updateSelection); DoAddSiblingBefore(newItemInfo, updateSelection);
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)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.Before;
}
}
} }
public void DoAddSiblingBefore(ItemInfo newItemInfo, bool updateSelection) public void DoAddSiblingBefore(ItemInfo newItemInfo, bool updateSelection)
{ {
@ -1173,6 +1195,17 @@ namespace Volian.Controls.Library
break; break;
} }
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
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)
{
rtbi.EnhAddFromItemInfo = MyItemInfo;
rtbi.EnhAddType = EnhancedAddTypes.Child;
}
}
} }
public EditItem GetNextItem(E_FromType fromType, ItemInfo newItemInfo) public EditItem GetNextItem(E_FromType fromType, ItemInfo newItemInfo)
{ {

View File

@ -12,8 +12,13 @@ namespace Volian.Controls.Library
public partial class FindReplace : DevComponents.DotNetBar.Office2007Form public partial class FindReplace : DevComponents.DotNetBar.Office2007Form
{ {
private bool doingfind = false; private bool doingfind = false;
private bool found = false;
private bool findingbookmarks = false; private bool findingbookmarks = false;
private bool _FoundIt = false;
public bool FoundIt
{
get { return _FoundIt; }
set { _FoundIt = value; }
}
private bool IsFound private bool IsFound
{ {
get get
@ -130,7 +135,6 @@ namespace Volian.Controls.Library
else else
{ {
MyEditItem.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, false, null); MyEditItem.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, false, null);
found = false;
} }
} }
@ -149,7 +153,8 @@ namespace Volian.Controls.Library
{ {
findingbookmarks = true; findingbookmarks = true;
if (!IsFound) btnFindNext_Click(sender, e); if (!IsFound) btnFindNext_Click(sender, e);
while (IsFound) // found is set in btnFindNext_Click() FoundIt = true;
while (FoundIt) // found is set in btnFindNext_Click()
{ {
MyDisplayBookMarks.AddBookMark(MyEditItem.MyItemInfo); MyDisplayBookMarks.AddBookMark(MyEditItem.MyItemInfo);
btnFindNext_Click(sender, e); btnFindNext_Click(sender, e);
@ -158,17 +163,14 @@ namespace Volian.Controls.Library
MyEditItem.MyStepPanel.OnTabDisplay(sender, args); MyEditItem.MyStepPanel.OnTabDisplay(sender, args);
findingbookmarks = false; findingbookmarks = false;
} }
private void btnFndRplDone_Click(object sender, EventArgs e) private void btnFndRplDone_Click(object sender, EventArgs e)
{ {
//this.Close(); //this.Close();
doingfind = false; doingfind = false;
this.Visible = false; this.Visible = false;
} }
private void btnFindNext_Click(object sender, EventArgs e) private void btnFindNext_Click(object sender, EventArgs e)
{ {
found = false;
AddToComboLists(); AddToComboLists();
doingfind = true; doingfind = true;
while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked)) while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked))
@ -186,6 +188,7 @@ namespace Volian.Controls.Library
else else
MessageBox.Show(this, "Not Found - From Here to End of Section", "Find/Replace"); MessageBox.Show(this, "Not Found - From Here to End of Section", "Find/Replace");
} }
FoundIt = false;
return; return;
} }
@ -199,7 +202,7 @@ namespace Volian.Controls.Library
MyEditItem.MyStepRTB.Visible = true; MyEditItem.MyStepRTB.Visible = true;
MyEditItem.MyStepRTB.Focus(); MyEditItem.MyStepRTB.Focus();
} }
found = true; FoundIt = true;
} }
private bool FindNextText(ItemInfo next) private bool FindNextText(ItemInfo next)
{ {

View File

@ -20,6 +20,13 @@ namespace Volian.Controls.Library
Showing = 8, Showing = 8,
Done = 16 Done = 16
} }
public enum EnhancedAddTypes : int
{
No = 0,
Before = 1,
After = 2,
Child = 3
}
#endregion #endregion
public partial class RTBItem : EditItem public partial class RTBItem : EditItem
{ {
@ -219,6 +226,18 @@ namespace Volian.Controls.Library
} }
set { _CheckOffMargin = value; } set { _CheckOffMargin = value; }
} }
private EnhancedAddTypes _EnhAddType = EnhancedAddTypes.No;
public EnhancedAddTypes EnhAddType
{
get { return _EnhAddType; }
set { _EnhAddType = value; }
}
private ItemInfo _EnhAddFromItemInfo = null;
public ItemInfo EnhAddFromItemInfo
{
get { return _EnhAddFromItemInfo; }
set { _EnhAddFromItemInfo = value; }
}
#endregion #endregion
#region Constructors #region Constructors
public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
@ -422,35 +441,13 @@ namespace Volian.Controls.Library
{ {
_ProcessingEnter = true; _ProcessingEnter = true;
DisplayTabItem dti = null; DisplayTabItem dti = null;
// Syncronize any open Enhanced Documents
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.Step_SourceToBackground != null && sc.Step_SourceToDeviation != null) foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
{ {
ItemInfo bii = ItemInfo.Get(int.Parse(sc.Step_SourceToBackground)); ItemInfo ii = ItemInfo.Get(ed.ItemID);
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(bii)) if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(ii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(bii)); MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(ii));
// dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(bii);
ItemInfo dii = ItemInfo.Get(int.Parse(sc.Step_SourceToDeviation));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(dii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(dii));
//dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(dii);
if (dti != null)
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
}
else if (sc.Step_SourceToBackground != null && sc.Step_SourceToDeviation == null)
{
ItemInfo bii = ItemInfo.Get(int.Parse(sc.Step_SourceToBackground));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(bii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(bii));
//dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(bii);
if (dti != null)
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
}
else if (sc.Step_SourceToBackground == null && sc.Step_SourceToDeviation != null)
{
ItemInfo dii = ItemInfo.Get(int.Parse(sc.Step_SourceToDeviation));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(dii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(dii));
//dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(dii);
if (dti != null) if (dti != null)
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo); dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
} }
@ -745,8 +742,41 @@ namespace Volian.Controls.Library
MyStepRTB.FindAllLinks(); MyStepRTB.FindAllLinks();
MyStepRTB.OrigRTF = MyStepRTB.Rtf; MyStepRTB.OrigRTF = MyStepRTB.Rtf;
MyStepRTB.ClearUndo(); MyStepRTB.ClearUndo();
// see if enhanced document related steps need to be created: KBR 10/2/15 - NEED to do this when saving RO
if (EnhAddType != EnhancedAddTypes.No)
{
StepConfig sib = EnhAddFromItemInfo.MyConfig as StepConfig;
foreach (EnhancedDocument ed in sib.MyEnhancedDocuments)
{
// create a new enhanced step and link it to this new source step.
// the new source step's item is passed in to know what type & what to link to.
// The ed.Type & itemid show what type of enhanced document (use to create new
// config Type) and itemid is the one to insert after.
DoAddEnhancedSteps(ed.Type, ed.ItemID);
}
EnhAddType = EnhancedAddTypes.No;
}
} }
} }
private void DoAddEnhancedSteps(int enhType, int enhItemID)
{
// get the item object in the enhanced document so that inserting of the new enhanced item and
// its children can be done:
ItemInfo existingEnhancedItemInfo = ItemInfo.Get(enhItemID);
ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.After;
if (EnhAddType == EnhancedAddTypes.Before) addpart = ItemInfo.EAddpingPart.Before;
else if (EnhAddType == EnhancedAddTypes.Child) addpart = ItemInfo.EAddpingPart.Child;
ItemInfo newEnhancedItemInfo = existingEnhancedItemInfo.InsertEnhancedSteps(MyItemInfo.MyContent.Text, null, addpart, MyItemInfo.MyContent.Type, enhType, MyItemInfo.ItemID);
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
sc.AddEnhancedDocument(enhType, newEnhancedItemInfo.ItemID);
using (Content c = Content.Get(MyItemInfo.ContentID))
{
c.Config = sc.ToString();
c.Save();
}
MyItemInfo.RefreshConfig();
}
//public override void SetBackgroundColor() //public override void SetBackgroundColor()
//{ //{
// MyStepRTB.SetBackColor(); // MyStepRTB.SetBackColor();

View File

@ -455,8 +455,7 @@ namespace Volian.Controls.Library
if (!readOnlyStep) if (!readOnlyStep)
{ {
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
//if (IsDerived(sc)) if (IsDerived(sc))
if (sc.Step_BackgroundToSource != null || sc.Step_DeviationToSource != null)
readOnlyStep = true; readOnlyStep = true;
} }
ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false; ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false;
@ -542,13 +541,13 @@ namespace Volian.Controls.Library
AdjustSizeForContents(!ActiveMode); AdjustSizeForContents(!ActiveMode);
} }
// private bool IsDerived(StepConfig sc) private bool IsDerived(StepConfig sc)
// { {
// foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
// if (ed.Type == 0) //New Design if (ed.Type == 0) //New Design
// return true; return true;
// return false; return false;
// } }
private bool _ProcessKeystrokes = true; private bool _ProcessKeystrokes = true;
public bool ProcessKeystrokes public bool ProcessKeystrokes
{ {

View File

@ -128,90 +128,119 @@ namespace Volian.Controls.Library
private void AddEnhancedDocumentMenu(DevComponents.DotNetBar.ButtonItem myButtonItem) private void AddEnhancedDocumentMenu(DevComponents.DotNetBar.ButtonItem myButtonItem)
{ {
DevComponents.DotNetBar.BaseItem btnSourceToBackground = null; #region enhanced
DevComponents.DotNetBar.BaseItem btnBackgroundToSource = null; // get a list of all of the current enhanced buttons that been defined for context menu
DevComponents.DotNetBar.BaseItem btnSourceToDeviation = null; List<string> unusedEnhancedButtons = new List<string>();
DevComponents.DotNetBar.BaseItem btnDeviationToSource = null; foreach (DevComponents.DotNetBar.ButtonItem bi in myButtonItem.SubItems)
#region background if (bi.Name.StartsWith("btnEnhancedTo"))
if (!myButtonItem.SubItems.Contains("btnSourceToBackground")) unusedEnhancedButtons.Add(bi.Name);
{
btnSourceToBackground = new DevComponents.DotNetBar.ButtonItem("btnSourceToBackground", "Go To Background Document"); // for all enhanced documents, get the list of buttons as they should be for the
btnSourceToBackground.Visible = false; // selected step
btnSourceToBackground.Click += btnSourceToBackground_Click;
myButtonItem.SubItems.Add(btnSourceToBackground);
}
else
btnSourceToBackground = myButtonItem.SubItems["btnSourceToBackground"];
if (!myButtonItem.SubItems.Contains("btnBackgroundToSource"))
{
btnBackgroundToSource = new DevComponents.DotNetBar.ButtonItem("btnBackgroundToSource", "Go To Source Document");
btnBackgroundToSource.Visible = false;
btnBackgroundToSource.Click += btnBackgroundToSource_Click;
myButtonItem.SubItems.Add(btnBackgroundToSource);
}
else
btnBackgroundToSource = myButtonItem.SubItems["btnBackgroundToSource"];
StepConfig sc = new StepConfig(_MyStepRTB.MyItemInfo.MyContent.Config); StepConfig sc = new StepConfig(_MyStepRTB.MyItemInfo.MyContent.Config);
if (sc.Step_SourceToBackground != null) DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments;
foreach(EnhancedDocument ed in sc.MyEnhancedDocuments)
{ {
btnSourceToBackground.Tag = sc.Step_SourceToBackground; string buttonName = string.Format("btnEnhancedTo{0}", dveds[ed.Type]);
btnSourceToBackground.Visible = true; if (unusedEnhancedButtons.Contains(buttonName)) unusedEnhancedButtons.Remove(buttonName);
DevComponents.DotNetBar.ButtonItem biEnhanced;
if (!myButtonItem.SubItems.Contains(buttonName))
{
biEnhanced = new DevComponents.DotNetBar.ButtonItem(buttonName, "Go To " + dveds[ed.Type].Name + " Document");
biEnhanced.Click += btnSourceToBackground_Click;
myButtonItem.SubItems.Add(biEnhanced);
}
else
biEnhanced = myButtonItem.SubItems[buttonName] as DevComponents.DotNetBar.ButtonItem;
biEnhanced.Tag = ed.ItemID;
biEnhanced.Visible = true;
} }
else foreach(string btnNotInUse in unusedEnhancedButtons)
{ {
btnSourceToBackground.Tag = string.Empty; DevComponents.DotNetBar.ButtonItem biUnused = myButtonItem.SubItems[btnNotInUse] as DevComponents.DotNetBar.ButtonItem;
btnSourceToBackground.Visible = false; biUnused.Visible = false;
}
if (sc.Step_BackgroundToSource != null)
{
btnBackgroundToSource.Tag = sc.Step_BackgroundToSource;
btnBackgroundToSource.Visible = true;
}
else
{
btnBackgroundToSource.Tag = string.Empty;
btnBackgroundToSource.Visible = false;
} }
#endregion #endregion
#region background
//if (!myButtonItem.SubItems.Contains("btnSourceToBackground"))
//{
// btnSourceToBackground = new DevComponents.DotNetBar.ButtonItem("btnSourceToBackground", "Go To Background Document");
// btnSourceToBackground.Visible = false;
// btnSourceToBackground.Click += btnSourceToBackground_Click;
// myButtonItem.SubItems.Add(btnSourceToBackground);
//}
//else
// btnSourceToBackground = myButtonItem.SubItems["btnSourceToBackground"];
//if (!myButtonItem.SubItems.Contains("btnBackgroundToSource"))
//{
// btnBackgroundToSource = new DevComponents.DotNetBar.ButtonItem("btnBackgroundToSource", "Go To Source Document");
// btnBackgroundToSource.Visible = false;
// btnBackgroundToSource.Click += btnBackgroundToSource_Click;
// myButtonItem.SubItems.Add(btnBackgroundToSource);
//}
//else
// btnBackgroundToSource = myButtonItem.SubItems["btnBackgroundToSource"];
//StepConfig sc = new StepConfig(_MyStepRTB.MyItemInfo.MyContent.Config);
//if (sc.Step_SourceToBackground != null)
//{
// btnSourceToBackground.Tag = sc.Step_SourceToBackground;
// btnSourceToBackground.Visible = true;
//}
//else
//{
// btnSourceToBackground.Tag = string.Empty;
// btnSourceToBackground.Visible = false;
//}
//if (sc.Step_BackgroundToSource != null)
//{
// btnBackgroundToSource.Tag = sc.Step_BackgroundToSource;
// btnBackgroundToSource.Visible = true;
//}
//else
//{
// btnBackgroundToSource.Tag = string.Empty;
// btnBackgroundToSource.Visible = false;
//}
#endregion
#region deviation #region deviation
if (!myButtonItem.SubItems.Contains("btnSourceToDeviation")) //if (!myButtonItem.SubItems.Contains("btnSourceToDeviation"))
{ //{
btnSourceToDeviation = new DevComponents.DotNetBar.ButtonItem("btnSourceToDeviation", "Go To Deviation Document"); // btnSourceToDeviation = new DevComponents.DotNetBar.ButtonItem("btnSourceToDeviation", "Go To Deviation Document");
btnSourceToDeviation.Visible = false; // btnSourceToDeviation.Visible = false;
btnSourceToDeviation.Click += btnSourceToBackground_Click; // btnSourceToDeviation.Click += btnSourceToBackground_Click;
myButtonItem.SubItems.Add(btnSourceToDeviation); // myButtonItem.SubItems.Add(btnSourceToDeviation);
} //}
else //else
btnSourceToDeviation = myButtonItem.SubItems["btnSourceToDeviation"]; // btnSourceToDeviation = myButtonItem.SubItems["btnSourceToDeviation"];
if (!myButtonItem.SubItems.Contains("btnDeviationToSource")) //if (!myButtonItem.SubItems.Contains("btnDeviationToSource"))
{ //{
btnDeviationToSource = new DevComponents.DotNetBar.ButtonItem("btnDeviationToSource", "Go To Source Document"); // btnDeviationToSource = new DevComponents.DotNetBar.ButtonItem("btnDeviationToSource", "Go To Source Document");
btnDeviationToSource.Visible = false; // btnDeviationToSource.Visible = false;
btnDeviationToSource.Click += btnBackgroundToSource_Click; // btnDeviationToSource.Click += btnBackgroundToSource_Click;
myButtonItem.SubItems.Add(btnDeviationToSource); // myButtonItem.SubItems.Add(btnDeviationToSource);
} //}
else //else
btnDeviationToSource = myButtonItem.SubItems["btnDeviationToSource"]; // btnDeviationToSource = myButtonItem.SubItems["btnDeviationToSource"];
if (sc.Step_SourceToDeviation != null) //if (sc.Step_SourceToDeviation != null)
{ //{
btnSourceToDeviation.Tag = sc.Step_SourceToDeviation; // btnSourceToDeviation.Tag = sc.Step_SourceToDeviation;
btnSourceToDeviation.Visible = true; // btnSourceToDeviation.Visible = true;
} //}
else //else
{ //{
btnSourceToDeviation.Tag = string.Empty; // btnSourceToDeviation.Tag = string.Empty;
btnSourceToDeviation.Visible = false; // btnSourceToDeviation.Visible = false;
} //}
if (sc.Step_DeviationToSource != null) //if (sc.Step_DeviationToSource != null)
{ //{
btnDeviationToSource.Tag = sc.Step_DeviationToSource; // btnDeviationToSource.Tag = sc.Step_DeviationToSource;
btnDeviationToSource.Visible = true; // btnDeviationToSource.Visible = true;
} //}
else //else
{ //{
btnDeviationToSource.Tag = string.Empty; // btnDeviationToSource.Tag = string.Empty;
btnDeviationToSource.Visible = false; // btnDeviationToSource.Visible = false;
} //}
#endregion #endregion
} }

View File

@ -1777,6 +1777,7 @@ namespace Volian.Controls.Library
// first, check if a changeid is required. // first, check if a changeid is required.
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii)); string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId); ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId);
if(replItemInfo != null) OnOpenItem(this,new vlnTreeItemInfoEventArgs(replItemInfo));
} }
SelectedNode = (VETreeNode)((prevtn != null) ? prevtn.NextNode : partn.FirstNode); SelectedNode = (VETreeNode)((prevtn != null) ? prevtn.NextNode : partn.FirstNode);
} }
@ -2340,7 +2341,8 @@ namespace Volian.Controls.Library
{ {
OnProcessing(false,"Delete Failed"); OnProcessing(false,"Delete Failed");
OnProcessingComplete(dtStart,"Delete Failed"); OnProcessingComplete(dtStart,"Delete Failed");
HandleSqlExceptionOnDelete(ex, ii); ItemInfo iii = ii.HandleSqlExceptionOnDelete(ex);
if(iii != null) OnOpenItem(this, new vlnTreeItemInfoEventArgs(iii));
return false; return false;
} }
} }
@ -2356,56 +2358,6 @@ namespace Volian.Controls.Library
if (Processing != null) if (Processing != null)
Processing(this, new vlnTreeStatusEventArgs(status,message)); Processing(this, new vlnTreeStatusEventArgs(status,message));
} }
private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex, ItemInfo ii)
{
if (ex.Message.Contains("has External Transitions and has no next step"))
{
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(ii.ItemID))
{
DialogResult ans = MessageBox.Show("Transitions exist to this step and cannot be adjusted automatically." +
"\r\n\r\nDo you want to be placed on the " + (exTrans.Count > 1 ? "first " : "") + "substep with the problem Transition?" +
"\r\n\r\nSubsteps with Problem Transitions" +
exTrans.Summarize(),
"Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes)
{
OnOpenItem(this, new vlnTreeItemInfoEventArgs(exTrans[0].MyContent.ContentItems[0]));
}
}
}
else if (ex.Message.Contains("has External Transitions to Procedure"))
{
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(ii.ItemID))
{
DialogResult ans = MessageBox.Show("Transitions exist to this procedure and cannot be adjusted automatically." +
"\r\n\r\nDo you want to be placed on the " + (exTrans.Count > 1 ? "first " : "") + "substep with the problem Transition?" +
"\r\n\r\nSubsteps with Problem Transitions" +
exTrans.Summarize(),
"Cannot Delete This Procedure", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes)
{
OnOpenItem(this, new vlnTreeItemInfoEventArgs(exTrans[0].MyContent.ContentItems[0]));
}
}
}
else if (ex.Message.Contains("has External Transitions to it's children"))
{
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(ii.ItemID))
{
DialogResult ans = MessageBox.Show("Transitions exist to substeps of this step and cannot be adjusted automatically." +
"\r\n\r\nDo you want to be placed on the " + (exTrans.Count > 1 ? "first " : "") + "substep with the problem Transition?" +
"\r\n\r\nSubsteps with Problem Transitions:" +
exTrans.Summarize(),
"Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes)
{
OnOpenItem(this, new vlnTreeItemInfoEventArgs(exTrans[0].MyContent.ContentItems[0]));
}
}
}
else
MessageBox.Show(ex.Message, "SQL Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
#endregion #endregion
#region SetLastValuesAndSaveIfChangedStuff #region SetLastValuesAndSaveIfChangedStuff
private void SetLastValues(VETreeNode node) private void SetLastValues(VETreeNode node)

View File

@ -962,8 +962,12 @@ namespace Volian.Print.Library
} }
} }
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
AddLinkToEnhancedDocument(cb, yLocation, sc.Step_SourceToBackground, "B", 6); DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments;
AddLinkToEnhancedDocument(cb, yLocation, sc.Step_SourceToDeviation, "D", 20); foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
{
DVEnhancedDocument dved = dveds[ed.Type];
AddLinkToEnhancedDocument(cb, yLocation, ed.ItemID, dved.PdfToken, dved.PdfX);
}
// MyPageHelper.BottomContent = yLocation - Height; // MyPageHelper.BottomContent = yLocation - Height;
//if (MyItemInfo.InList(39048)) Console.WriteLine("Here"); //if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
} }
@ -997,32 +1001,27 @@ namespace Volian.Print.Library
} }
return retval; return retval;
} }
private static void AddLinkToEnhancedDocument(PdfContentByte cb, float yLocation, string bdItemID, String token, int xLocation) private static void AddLinkToEnhancedDocument(PdfContentByte cb, float yLocation, int itemID, String token, int xLocation)
{ {
if (bdItemID != null) ItemInfo ii = ItemInfo.Get(itemID);
{ string prefix = ii.MyDocVersion.DocVersionConfig.Print_PDFFilePrefix ?? "";
int i = int.Parse(bdItemID); string suffix = ii.MyDocVersion.DocVersionConfig.Print_PDFFileSuffix ?? "";
ItemInfo ii = ItemInfo.Get(i); ColumnText ct = new ColumnText(cb);
string prefix = ii.MyDocVersion.DocVersionConfig.Print_PDFFilePrefix ?? ""; ct.SetSimpleColumn(xLocation, yLocation - 12, xLocation + 30, 12 + yLocation);
string suffix = ii.MyDocVersion.DocVersionConfig.Print_PDFFileSuffix ?? ""; iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 12);
ColumnText ct = new ColumnText(cb); Chunk chk = new Chunk(token);
ct.SetSimpleColumn(xLocation, yLocation - 12, xLocation + 30, 12 + yLocation); chk.SetRemoteGoto(prefix + ii.MyProcedure.DisplayNumber.Replace("/", "_") + suffix + ".pdf", string.Format("ItemID={0}", itemID));
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 12); chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon));
Chunk chk = new Chunk(token); ct.AddElement(chk);
chk.SetRemoteGoto(prefix + ii.MyProcedure.DisplayNumber.Replace("/", "_") + suffix + ".pdf", string.Format("ItemID={0}", ii.ItemID)); cb.SetColorFill(Color.BLUE);
chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); ct.Go();
ct.AddElement(chk);
cb.SetColorFill(Color.BLUE);
ct.Go();
//foreach (Chunk chk in IParagraph.Chunks) //foreach (Chunk chk in IParagraph.Chunks)
//{ //{
// chk.SetRemoteGoto(ii.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}",ii.ItemID)); // chk.SetRemoteGoto(ii.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}",ii.ItemID));
// chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); // chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon));
//} //}
}
} }
private ItemInfo GetDefaultItemInfo(ItemInfo myItemInfo) private ItemInfo GetDefaultItemInfo(ItemInfo myItemInfo)
{ {
if (myItemInfo.IsProcedure &&myItemInfo.Sections != null) if (myItemInfo.IsProcedure &&myItemInfo.Sections != null)