diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 99fc12a5..cce255a0 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -987,8 +987,19 @@ namespace Volian.Controls.Library ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text); 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): + 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 // if allowed by the format private void AddGridIfNeeded(ItemInfo newItemInfo) @@ -1061,6 +1072,17 @@ namespace Volian.Controls.Library ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text); AddGridIfNeeded(newItemInfo); 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) { @@ -1173,6 +1195,17 @@ namespace Volian.Controls.Library break; } 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) { diff --git a/PROMS/Volian.Controls.Library/FindReplace.cs b/PROMS/Volian.Controls.Library/FindReplace.cs index 894ca7ab..49a6341f 100644 --- a/PROMS/Volian.Controls.Library/FindReplace.cs +++ b/PROMS/Volian.Controls.Library/FindReplace.cs @@ -12,8 +12,13 @@ namespace Volian.Controls.Library public partial class FindReplace : DevComponents.DotNetBar.Office2007Form { private bool doingfind = false; - private bool found = false; private bool findingbookmarks = false; + private bool _FoundIt = false; + public bool FoundIt + { + get { return _FoundIt; } + set { _FoundIt = value; } + } private bool IsFound { get @@ -130,7 +135,6 @@ namespace Volian.Controls.Library else { 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; 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); btnFindNext_Click(sender, e); @@ -158,17 +163,14 @@ namespace Volian.Controls.Library MyEditItem.MyStepPanel.OnTabDisplay(sender, args); findingbookmarks = false; } - private void btnFndRplDone_Click(object sender, EventArgs e) { //this.Close(); doingfind = false; this.Visible = false; } - private void btnFindNext_Click(object sender, EventArgs e) { - found = false; AddToComboLists(); doingfind = true; while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked)) @@ -186,6 +188,7 @@ namespace Volian.Controls.Library else MessageBox.Show(this, "Not Found - From Here to End of Section", "Find/Replace"); } + FoundIt = false; return; } @@ -199,7 +202,7 @@ namespace Volian.Controls.Library MyEditItem.MyStepRTB.Visible = true; MyEditItem.MyStepRTB.Focus(); } - found = true; + FoundIt = true; } private bool FindNextText(ItemInfo next) { diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs index d03a9b9d..20bae642 100644 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ b/PROMS/Volian.Controls.Library/RTBItem.cs @@ -20,6 +20,13 @@ namespace Volian.Controls.Library Showing = 8, Done = 16 } + public enum EnhancedAddTypes : int + { + No = 0, + Before = 1, + After = 2, + Child = 3 + } #endregion public partial class RTBItem : EditItem { @@ -219,6 +226,18 @@ namespace Volian.Controls.Library } 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 #region Constructors public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) @@ -422,35 +441,13 @@ namespace Volian.Controls.Library { _ProcessingEnter = true; DisplayTabItem dti = null; + // Syncronize any open Enhanced Documents 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)); - if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(bii)) - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(bii)); - // 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); + ItemInfo ii = ItemInfo.Get(ed.ItemID); + if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(ii)) + MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(ii)); if (dti != null) dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo); } @@ -745,8 +742,41 @@ namespace Volian.Controls.Library MyStepRTB.FindAllLinks(); MyStepRTB.OrigRTF = MyStepRTB.Rtf; 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() //{ // MyStepRTB.SetBackColor(); diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 9f09a6de..48f86f23 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -455,8 +455,7 @@ namespace Volian.Controls.Library if (!readOnlyStep) { StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - //if (IsDerived(sc)) - if (sc.Step_BackgroundToSource != null || sc.Step_DeviationToSource != null) + if (IsDerived(sc)) readOnlyStep = true; } ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false; @@ -542,13 +541,13 @@ namespace Volian.Controls.Library AdjustSizeForContents(!ActiveMode); } -// private bool IsDerived(StepConfig sc) -// { -// foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) -// if (ed.Type == 0) //New Design -// return true; -// return false; -// } + private bool IsDerived(StepConfig sc) + { + foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) + if (ed.Type == 0) //New Design + return true; + return false; + } private bool _ProcessKeystrokes = true; public bool ProcessKeystrokes { diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index af01ff75..ff382b9b 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -128,90 +128,119 @@ namespace Volian.Controls.Library private void AddEnhancedDocumentMenu(DevComponents.DotNetBar.ButtonItem myButtonItem) { - DevComponents.DotNetBar.BaseItem btnSourceToBackground = null; - DevComponents.DotNetBar.BaseItem btnBackgroundToSource = null; - DevComponents.DotNetBar.BaseItem btnSourceToDeviation = null; - DevComponents.DotNetBar.BaseItem btnDeviationToSource = null; - #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"]; + #region enhanced + // get a list of all of the current enhanced buttons that been defined for context menu + List unusedEnhancedButtons = new List(); + foreach (DevComponents.DotNetBar.ButtonItem bi in myButtonItem.SubItems) + if (bi.Name.StartsWith("btnEnhancedTo")) + unusedEnhancedButtons.Add(bi.Name); + + // for all enhanced documents, get the list of buttons as they should be for the + // selected step 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; - btnSourceToBackground.Visible = true; + string buttonName = string.Format("btnEnhancedTo{0}", dveds[ed.Type]); + 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; - btnSourceToBackground.Visible = false; - } - if (sc.Step_BackgroundToSource != null) - { - btnBackgroundToSource.Tag = sc.Step_BackgroundToSource; - btnBackgroundToSource.Visible = true; - } - else - { - btnBackgroundToSource.Tag = string.Empty; - btnBackgroundToSource.Visible = false; + DevComponents.DotNetBar.ButtonItem biUnused = myButtonItem.SubItems[btnNotInUse] as DevComponents.DotNetBar.ButtonItem; + biUnused.Visible = false; } #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 - if (!myButtonItem.SubItems.Contains("btnSourceToDeviation")) - { - btnSourceToDeviation = new DevComponents.DotNetBar.ButtonItem("btnSourceToDeviation", "Go To Deviation Document"); - btnSourceToDeviation.Visible = false; - btnSourceToDeviation.Click += btnSourceToBackground_Click; - myButtonItem.SubItems.Add(btnSourceToDeviation); - } - else - btnSourceToDeviation = myButtonItem.SubItems["btnSourceToDeviation"]; - if (!myButtonItem.SubItems.Contains("btnDeviationToSource")) - { - btnDeviationToSource = new DevComponents.DotNetBar.ButtonItem("btnDeviationToSource", "Go To Source Document"); - btnDeviationToSource.Visible = false; - btnDeviationToSource.Click += btnBackgroundToSource_Click; - myButtonItem.SubItems.Add(btnDeviationToSource); - } - else - btnDeviationToSource = myButtonItem.SubItems["btnDeviationToSource"]; - if (sc.Step_SourceToDeviation != null) - { - btnSourceToDeviation.Tag = sc.Step_SourceToDeviation; - btnSourceToDeviation.Visible = true; - } - else - { - btnSourceToDeviation.Tag = string.Empty; - btnSourceToDeviation.Visible = false; - } - if (sc.Step_DeviationToSource != null) - { - btnDeviationToSource.Tag = sc.Step_DeviationToSource; - btnDeviationToSource.Visible = true; - } - else - { - btnDeviationToSource.Tag = string.Empty; - btnDeviationToSource.Visible = false; - } + //if (!myButtonItem.SubItems.Contains("btnSourceToDeviation")) + //{ + // btnSourceToDeviation = new DevComponents.DotNetBar.ButtonItem("btnSourceToDeviation", "Go To Deviation Document"); + // btnSourceToDeviation.Visible = false; + // btnSourceToDeviation.Click += btnSourceToBackground_Click; + // myButtonItem.SubItems.Add(btnSourceToDeviation); + //} + //else + // btnSourceToDeviation = myButtonItem.SubItems["btnSourceToDeviation"]; + //if (!myButtonItem.SubItems.Contains("btnDeviationToSource")) + //{ + // btnDeviationToSource = new DevComponents.DotNetBar.ButtonItem("btnDeviationToSource", "Go To Source Document"); + // btnDeviationToSource.Visible = false; + // btnDeviationToSource.Click += btnBackgroundToSource_Click; + // myButtonItem.SubItems.Add(btnDeviationToSource); + //} + //else + // btnDeviationToSource = myButtonItem.SubItems["btnDeviationToSource"]; + //if (sc.Step_SourceToDeviation != null) + //{ + // btnSourceToDeviation.Tag = sc.Step_SourceToDeviation; + // btnSourceToDeviation.Visible = true; + //} + //else + //{ + // btnSourceToDeviation.Tag = string.Empty; + // btnSourceToDeviation.Visible = false; + //} + //if (sc.Step_DeviationToSource != null) + //{ + // btnDeviationToSource.Tag = sc.Step_DeviationToSource; + // btnDeviationToSource.Visible = true; + //} + //else + //{ + // btnDeviationToSource.Tag = string.Empty; + // btnDeviationToSource.Visible = false; + //} #endregion } diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 67bdfbbd..9a3f4cdc 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -1777,6 +1777,7 @@ namespace Volian.Controls.Library // first, check if a changeid is required. string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii)); ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId); + if(replItemInfo != null) OnOpenItem(this,new vlnTreeItemInfoEventArgs(replItemInfo)); } SelectedNode = (VETreeNode)((prevtn != null) ? prevtn.NextNode : partn.FirstNode); } @@ -2340,7 +2341,8 @@ namespace Volian.Controls.Library { OnProcessing(false,"Delete Failed"); OnProcessingComplete(dtStart,"Delete Failed"); - HandleSqlExceptionOnDelete(ex, ii); + ItemInfo iii = ii.HandleSqlExceptionOnDelete(ex); + if(iii != null) OnOpenItem(this, new vlnTreeItemInfoEventArgs(iii)); return false; } } @@ -2356,56 +2358,6 @@ namespace Volian.Controls.Library if (Processing != null) 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 #region SetLastValuesAndSaveIfChangedStuff private void SetLastValues(VETreeNode node) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index fbd1f163..69032855 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -962,8 +962,12 @@ namespace Volian.Print.Library } } StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - AddLinkToEnhancedDocument(cb, yLocation, sc.Step_SourceToBackground, "B", 6); - AddLinkToEnhancedDocument(cb, yLocation, sc.Step_SourceToDeviation, "D", 20); + DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments; + foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) + { + DVEnhancedDocument dved = dveds[ed.Type]; + AddLinkToEnhancedDocument(cb, yLocation, ed.ItemID, dved.PdfToken, dved.PdfX); + } // MyPageHelper.BottomContent = yLocation - Height; //if (MyItemInfo.InList(39048)) Console.WriteLine("Here"); } @@ -997,32 +1001,27 @@ namespace Volian.Print.Library } 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) - { - int i = int.Parse(bdItemID); - ItemInfo ii = ItemInfo.Get(i); - string prefix = ii.MyDocVersion.DocVersionConfig.Print_PDFFilePrefix ?? ""; - string suffix = ii.MyDocVersion.DocVersionConfig.Print_PDFFileSuffix ?? ""; - ColumnText ct = new ColumnText(cb); - ct.SetSimpleColumn(xLocation, yLocation - 12, xLocation + 30, 12 + yLocation); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 12); - Chunk chk = new Chunk(token); - chk.SetRemoteGoto(prefix + ii.MyProcedure.DisplayNumber.Replace("/", "_") + suffix + ".pdf", string.Format("ItemID={0}", ii.ItemID)); - chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); - ct.AddElement(chk); - cb.SetColorFill(Color.BLUE); - ct.Go(); + ItemInfo ii = ItemInfo.Get(itemID); + string prefix = ii.MyDocVersion.DocVersionConfig.Print_PDFFilePrefix ?? ""; + string suffix = ii.MyDocVersion.DocVersionConfig.Print_PDFFileSuffix ?? ""; + ColumnText ct = new ColumnText(cb); + ct.SetSimpleColumn(xLocation, yLocation - 12, xLocation + 30, 12 + yLocation); + iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 12); + Chunk chk = new Chunk(token); + chk.SetRemoteGoto(prefix + ii.MyProcedure.DisplayNumber.Replace("/", "_") + suffix + ".pdf", string.Format("ItemID={0}", itemID)); + chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); + ct.AddElement(chk); + cb.SetColorFill(Color.BLUE); + ct.Go(); - //foreach (Chunk chk in IParagraph.Chunks) - //{ - // chk.SetRemoteGoto(ii.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}",ii.ItemID)); - // chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); - //} - } + //foreach (Chunk chk in IParagraph.Chunks) + //{ + // chk.SetRemoteGoto(ii.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}",ii.ItemID)); + // chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); + //} } - private ItemInfo GetDefaultItemInfo(ItemInfo myItemInfo) { if (myItemInfo.IsProcedure &&myItemInfo.Sections != null)