diff --git a/PROMS/Formats/fmtall/FNPNew2all.xml b/PROMS/Formats/fmtall/FNPNew2all.xml index 3f9a3bb4..8aed627d 100644 Binary files a/PROMS/Formats/fmtall/FNPNew2all.xml and b/PROMS/Formats/fmtall/FNPNew2all.xml differ diff --git a/PROMS/Formats/fmtall/vcb1all.xml b/PROMS/Formats/fmtall/vcb1all.xml index 89b3f9c2..30d0e84b 100644 Binary files a/PROMS/Formats/fmtall/vcb1all.xml and b/PROMS/Formats/fmtall/vcb1all.xml differ diff --git a/PROMS/Formats/fmtall/vcb2all.xml b/PROMS/Formats/fmtall/vcb2all.xml index 4ccb3b9c..cd54bac2 100644 Binary files a/PROMS/Formats/fmtall/vcb2all.xml and b/PROMS/Formats/fmtall/vcb2all.xml differ diff --git a/PROMS/Formats/fmtall/vcbaall.xml b/PROMS/Formats/fmtall/vcbaall.xml index 5c39c444..b6cc7325 100644 Binary files a/PROMS/Formats/fmtall/vcbaall.xml and b/PROMS/Formats/fmtall/vcbaall.xml differ diff --git a/PROMS/Formats/fmtall/vcbalrall.xml b/PROMS/Formats/fmtall/vcbalrall.xml index a1cf541e..fec5f6fd 100644 Binary files a/PROMS/Formats/fmtall/vcbalrall.xml and b/PROMS/Formats/fmtall/vcbalrall.xml differ diff --git a/PROMS/Formats/fmtall/vcbbckall.xml b/PROMS/Formats/fmtall/vcbbckall.xml index 243bb2e0..3e7fdb25 100644 Binary files a/PROMS/Formats/fmtall/vcbbckall.xml and b/PROMS/Formats/fmtall/vcbbckall.xml differ diff --git a/PROMS/Formats/fmtall/vcbeppall.xml b/PROMS/Formats/fmtall/vcbeppall.xml index 5afe836a..880aee4b 100644 Binary files a/PROMS/Formats/fmtall/vcbeppall.xml and b/PROMS/Formats/fmtall/vcbeppall.xml differ diff --git a/PROMS/Formats/frmFormatCopy.Designer.cs b/PROMS/Formats/frmFormatCopy.Designer.cs index 7871f6a8..01d3baf3 100644 --- a/PROMS/Formats/frmFormatCopy.Designer.cs +++ b/PROMS/Formats/frmFormatCopy.Designer.cs @@ -33,6 +33,8 @@ namespace Formats this.btnCopyFormats = new DevComponents.DotNetBar.ButtonX(); this.btnBrowse = new DevComponents.DotNetBar.ButtonX(); this.buttonX2 = new DevComponents.DotNetBar.ButtonX(); + this.labelX2 = new DevComponents.DotNetBar.LabelX(); + this.LstBxExcludeFiles = new DevComponents.DotNetBar.ListBoxAdv(); this.SuspendLayout(); // // txbxPROMSFormatsPath @@ -64,7 +66,7 @@ namespace Formats // this.btnCopyFormats.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnCopyFormats.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnCopyFormats.Location = new System.Drawing.Point(152, 68); + this.btnCopyFormats.Location = new System.Drawing.Point(232, 156); this.btnCopyFormats.Name = "btnCopyFormats"; this.btnCopyFormats.Size = new System.Drawing.Size(84, 27); this.btnCopyFormats.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; @@ -88,7 +90,7 @@ namespace Formats // this.buttonX2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.buttonX2.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.buttonX2.Location = new System.Drawing.Point(329, 68); + this.buttonX2.Location = new System.Drawing.Point(409, 156); this.buttonX2.Name = "buttonX2"; this.buttonX2.Size = new System.Drawing.Size(75, 23); this.buttonX2.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; @@ -96,17 +98,52 @@ namespace Formats this.buttonX2.Text = "Exit"; this.buttonX2.Click += new System.EventHandler(this.buttonX2_Click); // - // Form1 + // labelX2 + // + // + // + // + this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.labelX2.Location = new System.Drawing.Point(12, 41); + this.labelX2.Name = "labelX2"; + this.labelX2.Size = new System.Drawing.Size(200, 23); + this.labelX2.TabIndex = 5; + this.labelX2.Text = "Excluding Format Files that Start with:"; + // + // LstBxExcludeFiles + // + this.LstBxExcludeFiles.AutoScroll = true; + // + // + // + this.LstBxExcludeFiles.BackgroundStyle.Class = "ListBoxAdv"; + this.LstBxExcludeFiles.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.LstBxExcludeFiles.CausesValidation = false; + this.LstBxExcludeFiles.CheckStateMember = null; + this.LstBxExcludeFiles.ContainerControlProcessDialogKey = true; + this.LstBxExcludeFiles.DragDropSupport = true; + this.LstBxExcludeFiles.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LstBxExcludeFiles.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; + this.LstBxExcludeFiles.Location = new System.Drawing.Point(57, 70); + this.LstBxExcludeFiles.Name = "LstBxExcludeFiles"; + this.LstBxExcludeFiles.ShowToolTips = false; + this.LstBxExcludeFiles.Size = new System.Drawing.Size(134, 76); + this.LstBxExcludeFiles.TabIndex = 6; + this.LstBxExcludeFiles.Text = "listBoxAdv1"; + // + // frmFormatCopy // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(496, 107); + this.ClientSize = new System.Drawing.Size(496, 191); + this.Controls.Add(this.LstBxExcludeFiles); + this.Controls.Add(this.labelX2); this.Controls.Add(this.buttonX2); this.Controls.Add(this.btnBrowse); this.Controls.Add(this.btnCopyFormats); this.Controls.Add(this.labelX1); this.Controls.Add(this.txbxPROMSFormatsPath); - this.Name = "Form1"; + this.Name = "frmFormatCopy"; this.Text = "Form1"; this.ResumeLayout(false); @@ -119,6 +156,8 @@ namespace Formats private DevComponents.DotNetBar.ButtonX btnCopyFormats; private DevComponents.DotNetBar.ButtonX btnBrowse; private DevComponents.DotNetBar.ButtonX buttonX2; + private DevComponents.DotNetBar.LabelX labelX2; + private DevComponents.DotNetBar.ListBoxAdv LstBxExcludeFiles; } } diff --git a/PROMS/Formats/frmFormatCopy.cs b/PROMS/Formats/frmFormatCopy.cs index d90b34e8..b29c8e71 100644 --- a/PROMS/Formats/frmFormatCopy.cs +++ b/PROMS/Formats/frmFormatCopy.cs @@ -14,7 +14,11 @@ namespace Formats public frmFormatCopy() { InitializeComponent(); - SetDefaults(); + foreach (string excludeThis in excludeThese) + { + LstBxExcludeFiles.Items.Add(excludeThis); + } + SetDefaults(); } private void SetDefaults() @@ -92,10 +96,11 @@ namespace Formats if (!txbxPROMSFormatsPath.Text.EndsWith(@"\")) txbxPROMSFormatsPath.Text += @"\"; } + public string[] excludeThese = { "WPS", "WPB", "VCBEPP" }; + private bool ExcludeFromCopy(string fn) { // don't copy formats whos file name starts with.. - string[] excludeThese = { "WPS", "WEP", "WPB", "VCBEPP" }; foreach (string excludeThis in excludeThese) if (fn.ToUpper().StartsWith(excludeThis)) return true; return false; diff --git a/PROMS/Formats/frmFormatCopy.resx b/PROMS/Formats/frmFormatCopy.resx index 19dc0dd8..d58980a3 100644 --- a/PROMS/Formats/frmFormatCopy.resx +++ b/PROMS/Formats/frmFormatCopy.resx @@ -112,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs index 2a263265..0a2451f9 100644 --- a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs +++ b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs @@ -264,9 +264,11 @@ namespace ROEditor File.Delete(FstNew); // remove ROFST.NEW if (OrphanedRecords.Length > 0) { - StreamWriter sw = new StreamWriter(VlnSettings.TemporaryFolder + @"\Orphaned RO Records.txt"); - sw.Write(OrphanedRecords.ToString()); - sw.Close(); + using (StreamWriter sw = new StreamWriter(Path.Combine(FstDir, @"Orphaned RO Records.txt"), false)) + { + sw.Write(OrphanedRecords.ToString()); + sw.Close(); + } MessageBox.Show("The file Orphaned RO Records.txt has been created", "Warning - Orphan RO Record"); } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs index 15b2ffda..61904404 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs @@ -19,6 +19,7 @@ using System.Drawing; using System.Collections.Generic; using System.ComponentModel; using System.Text.RegularExpressions; +using System.Linq; namespace VEPROMS.CSLA.Library { @@ -143,6 +144,8 @@ namespace VEPROMS.CSLA.Library } #endregion #region SortingChildren + private static bool IsInManualOrderNullFix = false; + [NonSerialized] public Csla.SortedBindingList _SortedChildFolders; public Csla.SortedBindingList SortedChildFolders @@ -151,6 +154,29 @@ namespace VEPROMS.CSLA.Library { if (ChildFolders != null) { + //B2025-018 Issues with folder order in tree view + // if any ChildFolders with a missing Manual Order + // set them to the end of the list + // use IsInManualOrderNullFix - so, if setting ChildFolders Currently, + // do not try to set them (thus creating an infinite loop) + if (!IsInManualOrderNullFix && ChildFolders.Any(x => x.ManualOrder == null)) + { + IsInManualOrderNullFix = true; + foreach (FolderInfo fi in ChildFolders.Where(x => x.ManualOrder == null)) + { + using (FolderInfo parfolderinfo = FolderInfo.Get(fi.ParentID)) + { + using (Folder fldr = fi.Get()) + { + fldr.ManualOrder = parfolderinfo.NewManualOrder(9999); + fldr.Save(); + } + } + } + RefreshChildFolders(); + IsInManualOrderNullFix = false; + } + if (_SortedChildFolders == null) { _SortedChildFolders = new SortedBindingList(ChildFolders); @@ -166,6 +192,10 @@ namespace VEPROMS.CSLA.Library return _SortedChildFolders; } } + + //B2025-018 Issues with folder order in tree view + //Note: this should be called from the parent item + //As you want to put this into the sorted order of the parent item public double? NewManualOrder(int index) { double? retval = 1; @@ -174,13 +204,27 @@ namespace VEPROMS.CSLA.Library else if (index == 0) { if (retval >= SortedChildFolders[index].ManualOrder) // If one is too big, then divide first value in half - retval = SortedChildFolders[index].ManualOrder / 2; + retval = SortedChildFolders[index].ManualOrder / 2.0; } else if (SortedChildFolders.Count > index) { - retval += SortedChildFolders[index - 1].ManualOrder; // Just go to the next whole number - if (retval >= SortedChildFolders[index].ManualOrder) - retval = (SortedChildFolders[index - 1].ManualOrder + SortedChildFolders[index].ManualOrder) / 2; + //B2025-018 Issues with folder order in tree view + //filter to just items with the same parent + //want new order to be halfway between the previous item + //and the next ManualOrder + var tmp = SortedChildFolders.Where(x => x.ParentID == FolderID); + var lbound = SortedChildFolders[index - 1].ManualOrder; + var ubound = tmp.OrderBy(y => y.ManualOrder).FirstOrDefault(x => x.ManualOrder > lbound)?.ManualOrder; + if (ubound != null) + { + retval = ((ubound - lbound) / 2.0) + lbound; + } + else + { + //in this case, item before is highest for that parent + //so just make this 1 more + retval = lbound + 1; + } } else { diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 031ece04..4b680ed0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -805,7 +805,21 @@ namespace VEPROMS.CSLA.Library } } } - + // B2025-020 Null Reference fix. Added check for valid index into the TransitionTypeList + if (!forceConvertToText) + { + if (traninfo.TranType >= itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList.Count) + { + forceConvertToText = true; + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition type is not available"); + using (Content content = Content.Get(itemInfo.MyContent.ContentID)) + { + content.FixTransitionText(traninfo, true); + content.Save(); + } + } + } if (!forceConvertToText) { if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Folder.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Folder.cs index fb8a0a45..0232759d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Folder.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Folder.cs @@ -769,6 +769,15 @@ namespace VEPROMS.CSLA.Library tmp.MyParent = myParent; tmp.Name = name; tmp.ShortName = shortName; + + //B2025-018 Issues with folder order in tree view + //if no manual order is set, add it at the end + if (myParent != null) + { + using (FolderInfo parfolderinfo = FolderInfo.Get(myParent.FolderID)) + tmp.ManualOrder = parfolderinfo.NewManualOrder(9999); + } + return tmp; } public static Folder New(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config, DateTime dts, string usrID) @@ -784,6 +793,15 @@ namespace VEPROMS.CSLA.Library tmp.Config = config; tmp.DTS = dts; tmp.UsrID = usrID; + + //B2025-018 Issues with folder order in tree view + //if no manual order is set, add it at the end + if (myParent != null && manualOrder == null) + { + using (FolderInfo parfolderinfo = FolderInfo.Get(myParent.FolderID)) + tmp.ManualOrder = parfolderinfo.NewManualOrder(9999); + } + return tmp; } public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config, DateTime dts, string usrID) @@ -813,6 +831,15 @@ namespace VEPROMS.CSLA.Library tmp.MyFormat = myFormat; tmp.ManualOrder = manualOrder; tmp.Config = config; + + //B2025-018 Issues with folder order in tree view + //if no manual order is set, add it at the end + if (myParent != null && manualOrder == null) + { + using (FolderInfo parfolderinfo = FolderInfo.Get(myParent.FolderID)) + tmp.ManualOrder = parfolderinfo.NewManualOrder(9999); + } + return tmp; } public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, double? manualOrder, string config) diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index e60b358b..5fcb43b6 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -983,19 +983,22 @@ namespace Volian.Controls.Library SectionInfo si2 = (tn as VETreeNode).VEObject as SectionInfo; if (si2.MyDocVersion.MultiUnitCount > 1) { - MenuItem mps = new MenuItem("Print Section"); - int k = 0; - foreach (string s in si2.MyDocVersion.UnitNames) + if (!si2.IsSubsection) { - k++; - MenuItem mp = mps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Tag = k; + MenuItem mps = new MenuItem("Print Section"); + int k = 0; + foreach (string s in si2.MyDocVersion.UnitNames) + { + k++; + MenuItem mp = mps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); + mp.Tag = k; + } + cm.MenuItems.Add(mps); } - cm.MenuItems.Add(mps); } else { - cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); + if(!si2.IsSubsection) cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); } } } @@ -2812,23 +2815,27 @@ namespace Volian.Controls.Library int f2 = -1; string uniquename = _LastFolderInfo.MyParent.UniqueChildName("New Folder"); int myindex = SelectedNode.Index + ((newtype == MenuSelections.FolderAfter) ? 1 : 0); - FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.FolderID); - double? myorder = parfolderinfo.NewManualOrder(myindex); - using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID)) - { - ShowBrokenRules(folder.BrokenRulesCollection); - SetLastValues(FolderInfo.Get(folder.FolderID)); - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(uniquename, folder.FolderConfig)) == DialogResult.OK) + //B2025-018 Issues with folder order in tree view + //since before/after folder is at same level as current folder + //so need to use the parents order to determine where to place it + using (FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.MyParent.FolderID)) + { double? myorder = parfolderinfo.NewManualOrder(myindex); + using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID)) { - folder.Save(); - tn = new VETreeNode((IVEDrillDownReadOnly)_LastFolderInfo); - if (newtype == MenuSelections.FolderBefore) SelectedNode.Parent.Nodes.Insert(SelectedNode.Index, tn); - if (newtype == MenuSelections.FolderAfter) SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 1, tn); + ShowBrokenRules(folder.BrokenRulesCollection); + SetLastValues(FolderInfo.Get(folder.FolderID)); + if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(uniquename, folder.FolderConfig)) == DialogResult.OK) + { + folder.Save(); + tn = new VETreeNode((IVEDrillDownReadOnly)_LastFolderInfo); + if (newtype == MenuSelections.FolderBefore) SelectedNode.Parent.Nodes.Insert(SelectedNode.Index, tn); + if (newtype == MenuSelections.FolderAfter) SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 1, tn); + } + else + f2 = folder.FolderID; } - else - f2 = folder.FolderID; + if (f2 != -1) Folder.Delete(f2); } - if (f2 != -1) Folder.Delete(f2); } } }