B2019-076: support for folder/working draft level proc set specific info (moved code from VlnSvgPageHelper to here)

B2019-076: support for folder/working draft level proc set specific info & C2019-023: default values on outside transitions SI
B2019-076: make folder/working draft level proc set specific info consistent
B2019-076: Move GetInheritedSIValue from here to DocVersionExt.cs so it is accessible from TransitionExt.cs
This commit is contained in:
Kathy Ruffing 2019-05-21 12:34:47 +00:00
parent aaf2c74371
commit 311d442b57
4 changed files with 72 additions and 36 deletions

View File

@ -859,6 +859,30 @@ namespace VEPROMS.CSLA.Library
return _UnitNames;
}
}
#region Proc Set Specific info support
public static string GetInheritedSIValue(ProcedureInfo pi, string fieldName)
{
string val = null;
DocVersionConfig dvConfig = new DocVersionConfig(pi.MyDocVersion.Config);
if (dvConfig != null)
{
val = dvConfig.GetValue("SI", fieldName);
if (val != null && val != "") return val; // the value exists within the docversion level
}
FolderInfo fi = pi.MyDocVersion.MyFolder;
while (fi != null)
{
FolderConfig folderConfig = new FolderConfig(fi.Config);
if (folderConfig != null)
{
val = folderConfig.GetValue("SI", fieldName);
if (val != null && val != "") return val; // the value exists within this folder
}
fi = fi.ActiveParent as FolderInfo;
}
return val;
}
#endregion
}
#region VersionPastingPartCriteria
[Serializable()]

View File

@ -966,13 +966,23 @@ namespace VEPROMS.CSLA.Library
int indxcn = str.IndexOf(":");
string pt1 = str.Substring(1, indxcn - 1);
string pt2 = str.Substring(indxcn+1, str.Length - 2 - indxcn);
string defval = null;
if (pt2.IndexOf('|')>-1) // C2019-023: allow default value on outside transition proc set specific info data
{
if (pt2.Length>pt2.IndexOf('|')+1) defval = pt2.Substring(pt2.IndexOf('|')+1);
pt2 = pt2.Substring(0, pt2.IndexOf('|'));
}
string add = null;
if (pt1.StartsWith("SI")) // SI fields go to the folder specific information
add = fc.GetValue(pt1, pt2);
if (pt1.StartsWith("SI")) // B2019-076: SI fields go to the procedure set specific information (folder or working draft level, SI)
add = DocVersionInfo.GetInheritedSIValue(tb._ToItem.MyProcedure, pt2);
else
add = pc.GetValue(pt1, pt2);
if (add == null || add == "") foundnull = true; // don't do prefix if any of the fields are null.
else repStr.Add(str, add);
if (add == null || add == "")
{
if (defval != null) add = defval;
else foundnull = true; // don't do prefix if any of the fields are null and don't have a default value
}
if (!foundnull) repStr.Add(str, add);
}
if (!foundnull)
{

View File

@ -659,14 +659,14 @@ namespace Volian.Controls.Library
else
cm.MenuItems.Add("Import Procedure Set", new EventHandler(mi_Click));
if (DoSpecificInfo)
cm.MenuItems.Add("Folder Specific Information", new EventHandler(mi_Click));
cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click));
}
//_MyLog.WarnFormat("Context Menu 1b - {0}", GC.GetTotalMemory(true));
if (ui.IsAdministrator() || ui.IsSetAdministrator(fi))
{
if (fi.MyParent != null) // don't allow insert before/after if at top node
{
if (!ui.IsAdministrator() && DoSpecificInfo) cm.MenuItems.Add("Folder Specific Information", new EventHandler(mi_Click));
if (!ui.IsAdministrator() && DoSpecificInfo) cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click));
cm.MenuItems.Add("Insert Folder Before", new EventHandler(mi_Click));
cm.MenuItems.Add("Insert Folder After", new EventHandler(mi_Click));
}
@ -690,7 +690,7 @@ namespace Volian.Controls.Library
OwnerInfoList.Reset();
oil = OwnerInfoList.GetByVersionID(dvi.VersionID);
if (dvi.ActiveFormat.PlantFormat.FormatData.SpecificInfo)
cm.MenuItems.Add("Working Draft Specific Information", new EventHandler(mi_Click));
cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click));
cm.MenuItems.Add("Refresh Checked Out Procedures", new EventHandler(mi_Click));
cm.MenuItems.Add("New Procedure", new EventHandler(mi_Click));
if (dvi.MultiUnitCount > 1)
@ -1006,7 +1006,7 @@ namespace Volian.Controls.Library
{
/*
--Folder level
see if we need to disable "Export Procedure Set" or "Folder Specific Information"
see if we need to disable "Export Procedure Set" or "Procedure Set Specific Information"
*/
if (tn.MovedToSeparateWindow)
{
@ -1044,7 +1044,7 @@ namespace Volian.Controls.Library
{
foreach (MenuItem itm in cm.MenuItems)
{
if (itm.Text == "Export Procedure Set" || itm.Text == "Folder Specific Information")
if (itm.Text == "Export Procedure Set" || itm.Text == "Procedure Set Specific Information")
itm.Enabled = false;
}
}
@ -1071,7 +1071,7 @@ namespace Volian.Controls.Library
foreach (MenuItem itm in cm.MenuItems)
{
if (itm.Text == "Approve All Procedures" || itm.Text == "Report All Procedures Inconsistencies" ||
itm.Text == "Working Draft Specific Information" || itm.Text == "Approve All Procedures for" ||
itm.Text == "Procedure Set Specific Information" || itm.Text == "Approve All Procedures for" ||
itm.Text == "Approve Some Procedures" || itm.Text == "Approve Some Procedures for")
itm.Enabled = false;
@ -1652,7 +1652,8 @@ namespace Volian.Controls.Library
MenuItem mi = sender as MenuItem;
if (mi == null)
return;
if (mi.Text == "Working Draft Specific Information" || mi.Text == "Folder Specific Information")
// B2019-076: make folder/working draft level proc set specific info consistent (various places in this file were changed from Folder Specific & Working Draft Specific)
if (mi.Text == "Procedure Set Specific Information")
{
VETreeNode tn = SelectedNode as VETreeNode;
OnNodeSI(this, new vlnTreeEventArgs(tn, null, 0));

View File

@ -2070,7 +2070,7 @@ i = 0;
plstr = plstr.Replace(token, un);
break;
default:
if (token.Contains(@"SI-")) // folder or working draft specific information.
if (token.Contains(@"SI-")) // procedure set specific information. (at folder or working draft levels)
{
DocVersionConfig dvConfig = new DocVersionConfig(section.MyProcedure.MyDocVersion.Config);
FolderConfig folderConfig = new FolderConfig(section.MyProcedure.MyDocVersion.MyFolder.Config);
@ -2081,13 +2081,13 @@ i = 0;
string val = null;
if (qindx == -1)
{
val = GetInheritedSIValue(section.MyProcedure, token.Substring(4, token.Length - 5));
val = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, token.Substring(4, token.Length - 5));
plstr = plstr.Replace(token, val);
}
else
{
string pstok = token.Substring(indx + 1, qindx - indx - 1);
plstr = GetInheritedSIValue(section.MyProcedure, pstok);
plstr = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, pstok);
//if (dvConfig != null)
// plstr = dvConfig.GetValue("SI", pstok);
//if ((plstr == null || plstr == "") && folderConfig != null)
@ -2193,28 +2193,29 @@ i = 0;
}
return retval;
}
private string GetInheritedSIValue(ProcedureInfo pi, string fieldName)
{
string val = null;
DocVersionConfig dvConfig = new DocVersionConfig(pi.MyDocVersion.Config);
if (dvConfig != null)
{
val = dvConfig.GetValue("SI", fieldName);
if (val != null && val != "") return val; // the value exists within the docversion level
}
FolderInfo fi = pi.MyDocVersion.MyFolder;
while (fi != null)
{
FolderConfig folderConfig = new FolderConfig(fi.Config);
if (folderConfig != null)
{
val = folderConfig.GetValue("SI", fieldName);
if (val != null && val != "") return val; // the value exists within this folder
}
fi = fi.ActiveParent as FolderInfo;
}
return val;
}
// B2019-076: moved the following to DocVersionExt.cs to make it available to transitionext.cs code.
//private string GetInheritedSIValue(ProcedureInfo pi, string fieldName)
//{
// string val = null;
// DocVersionConfig dvConfig = new DocVersionConfig(pi.MyDocVersion.Config);
// if (dvConfig != null)
// {
// val = dvConfig.GetValue("SI", fieldName);
// if (val != null && val != "") return val; // the value exists within the docversion level
// }
// FolderInfo fi = pi.MyDocVersion.MyFolder;
// while (fi != null)
// {
// FolderConfig folderConfig = new FolderConfig(fi.Config);
// if (folderConfig != null)
// {
// val = folderConfig.GetValue("SI", fieldName);
// if (val != null && val != "") return val; // the value exists within this folder
// }
// fi = fi.ActiveParent as FolderInfo;
// }
// return val;
//}
private static ItemInfo ValveGetFirstStep(VEPROMS.CSLA.Library.SectionInfo section)
{
ItemInfo firstHigh = null;