B2022-026 RO Memory reduction coding

This commit is contained in:
2022-05-26 19:55:07 +00:00
parent 61febac1a0
commit 27993553cb
21 changed files with 6827 additions and 5160 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -48,10 +48,13 @@ namespace VEPROMS.CSLA.Library
get
{
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) return false;
ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID);
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
string rofstPath = rdi.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath)) return false;
FileInfo fiRofst = new FileInfo(rofstPath);
// if the database Ro.Fst is newer or if the files have identical DTS,
@@ -60,7 +63,11 @@ namespace VEPROMS.CSLA.Library
// next see if the data is the same size, i.e. byte count of record and byte count
// of file. If different sizes, the date/time stamp check will hold.
if (fiRofst.Length != roFstInfo.ROLookup.Length) return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
// B2022-026 RO Memory reduction - new logic
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
if (bytes != null && fiRofst.Length != bytes.Length)
return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
// rofsts of the size of the file & compare bytes.
@@ -249,15 +256,18 @@ namespace VEPROMS.CSLA.Library
get
{
if (DocVersionAssociations == null || DocVersionAssociationCount==0) return false;
ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID);
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
string rofstPath = rdi.FolderPath + @"\ro.fst";
//if (!File.Exists(rofstPath)) return false;
if (!pathExists(rofstPath))
{
_MyLog.WarnFormat("RO Path '{0}' could not be found", rofstPath);
return false;
}
FileInfo fiRofst = new FileInfo(rofstPath);
// if the database Ro.Fst is newer or if the files have identical DTS,
@@ -265,14 +275,21 @@ namespace VEPROMS.CSLA.Library
// put this in a dictionary so we don't have to keep testing to see if the file version of ro.fst is newer than database version
string key = string.Format("{0}-{1}", DocVersionAssociations[0].ROFstID, fiRofst.LastWriteTimeUtc);
if (NewerRoFstLookup.ContainsKey(key)) return NewerRoFstLookup[key];
if (roFstInfo.DTS >= fiRofst.LastWriteTimeUtc) return AddToRoFstLookup(key, false);
TimeSpan ts = roFstInfo.DTS - fiRofst.LastWriteTimeUtc;
if (ts.TotalSeconds > -1F) return AddToRoFstLookup(key, false);
// next see if the data is the same size, i.e. byte count of record and byte count
// of file. If different sizes, the date/time stamp check will hold.
if (fiRofst.Length != roFstInfo.ROLookup.Length) return AddToRoFstLookup(key,fiRofst.LastWriteTimeUtc > roFstInfo.DTS);
// B2022-026 RO Memory reduction - new logic
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
if (bytes != null && fiRofst.Length != bytes.Length)
return AddToRoFstLookup(key, fiRofst.LastWriteTimeUtc > roFstInfo.DTS);
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
// rofsts of the size of the file & compare bytes.

View File

@@ -326,26 +326,31 @@ namespace VEPROMS.CSLA.Library
public partial class ItemInfo : IVEDrillDownReadOnly
{
private bool _PrintAllAtOnce = false;
public bool PrintAllAtOnce
{
get { return _PrintAllAtOnce; }
set { _PrintAllAtOnce = value; }
}
public SectionInfo GetSectionInfo()
{
if (this is SectionInfo) return this as SectionInfo;
return SectionInfo.Get(ItemID);
}
public StepInfo GetStepInfo()
{
if (this is StepInfo) return this as StepInfo;
return StepInfo.Get(ItemID);
}
public ProcedureInfo GetProcedureInfo()
{
if (this is ProcedureInfo) return this as ProcedureInfo;
return ProcedureInfo.Get(ItemID);
}
private string _EnhType = null;
public string EnhType
{
@@ -379,10 +384,12 @@ namespace VEPROMS.CSLA.Library
if (id == ItemID) return true;
return false;
}
public static bool IsInCache(int itemID)
{
return _CacheByPrimaryKey.ContainsKey(itemID.ToString());
}
public static string ReplaceLinkWithNewID(string tmpForLink)
{
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
@@ -394,6 +401,7 @@ namespace VEPROMS.CSLA.Library
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
return tmpForLink;
}
public void SetHeader(VE_Font myFont, string myText)
{
_MyHeader = new MetaTag(myFont);
@@ -402,6 +410,7 @@ namespace VEPROMS.CSLA.Library
_MyHeader.Text = myText;
_MyHeader.Justify = ContentAlignment.MiddleCenter;
}
public void MoveItem(IVEDrillDownReadOnly pInfo, int index)
{
using (ItemInfoList movedItems = ItemInfoList.GetMoveItem(ItemID, index))
@@ -416,6 +425,7 @@ namespace VEPROMS.CSLA.Library
if (parentInfo != null)
ItemInfo.ResetParts(parentInfo.ItemID);
}
public static void Refresh(ItemInfo tmp)
{
string key = tmp.ItemID.ToString();
@@ -424,6 +434,7 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key])
tmpInfo.RefreshFields(tmp);
}
protected virtual void RefreshFields(ItemInfo tmp)
{
if (_PreviousID != tmp.PreviousID)
@@ -574,6 +585,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
/// <summary>
/// The following method is used only in print because the 'printed' data is loaded into
/// memory before printing. Find the next item from memory (do not go out to database).
@@ -596,43 +608,35 @@ namespace VEPROMS.CSLA.Library
}
return null;
}
public static void ResetTranCounters()
{
TranCheckCount = 0;
TranFixCount = 0;
TranConvertCount = 0;// B2018-002 - Invalid Transitions - Initialize Transition Conversion Count
}
public static int TranCheckCount = 0;
public static int TranFixCount = 0;
public static int TranConvertCount = 0;// B2018-002 - Invalid Transitions - Declare Transition Conversion Count
internal static TransitionInfoList TransitionsToDisconnected;
internal static TransitionInfoList TransitionsToNonEditable;
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
//TransitionInfoList til = TransitionInfoList.GetByFromID(itemInfo.ItemID);
//Console.WriteLine("Procedure: {0}, transitions: {1}", (itemInfo as ProcedureInfo).DisplayNumber, til.Count);
//foreach (TransitionInfo traninfo in til)
//{
// string oldText = itemInfo.MyContent.Text;
// itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
// string newText = itemInfo.MyContent.Text;
// if (newText != oldText)
// {
// Content content = Content.Get(itemInfo.MyContent.ContentID);
// content.FixTransitionText(traninfo);
// content.Save();
// }
//}
if (itemInfo == null) return;
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
//List<ItemInfo> myItems = new List<ItemInfo>();
foreach (ItemInfo ii in pi.MyItems)
// myItems.Add(ii);
//foreach (ItemInfo ii in myItems)
{
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
}
}
}
// B2018-002 - Invalid Transitions - Convert Invalid Transitions to Text
// An invalid transition is a transition embedded in the content text that does not match the transition table record.
if(ConvertInvalidTransitionsToText(itemInfo))
@@ -642,18 +646,7 @@ namespace VEPROMS.CSLA.Library
{
bool forceConvertToText = false;
TranCheckCount++;
//if (TransitionsToNonEditable != null)
//{
// if (IsTransitionToNonEditable(traninfo))
// {
// forceConvertToText = true;
// TranFixCount++;
// itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to Non-Editable Step");
// Content content = Content.Get(itemInfo.MyContent.ContentID);
// content.FixTransitionText(traninfo, true);
// content.Save();
// }
//}
if (!forceConvertToText)
{
if (traninfo.MyItemToID.ActiveSection != null)
@@ -661,6 +654,7 @@ namespace VEPROMS.CSLA.Library
SectionConfig sc = traninfo.MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N" && traninfo.MyItemToID.IsStep); // Bug fix B2016-081 also check if transition is to a step element
}
if (forceConvertToText)
{
TranFixCount++;
@@ -670,11 +664,14 @@ namespace VEPROMS.CSLA.Library
content.Save();
}
}
if (!forceConvertToText)
{
if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
{
forceConvertToText = true;
TranFixCount++;
@@ -683,13 +680,17 @@ namespace VEPROMS.CSLA.Library
content.FixTransitionText(traninfo, true);
content.Save();
}
}
}
}
if (!forceConvertToText)
{
if (itemInfo.MyDocVersion != null && traninfo.MyItemToID.MyDocVersion != null && itemInfo.MyDocVersion.VersionID != traninfo.MyItemToID.MyDocVersion.VersionID) //different doc version
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
{
forceConvertToText = true;
TranFixCount++;
@@ -698,8 +699,10 @@ namespace VEPROMS.CSLA.Library
content.FixTransitionText(traninfo, true);
content.Save();
}
}
}
}
if (!forceConvertToText)
{
string oldText = itemInfo.MyContent.Text;
@@ -718,6 +721,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
// // B2018-002 - Invalid Transitions - Method to check for invalid transitions and convert them to text
public static bool ConvertInvalidTransitionsToText(ItemInfo itemInfo)
{
@@ -729,25 +733,30 @@ namespace VEPROMS.CSLA.Library
retval = false;
if (itemInfo.MyContent.Text.Contains("Link:Transition"))
{
//Console.WriteLine("\"TranCount\"\t\"{0}\"\t{1}\t{2}\t{3}", itemInfo.ShortPath, itemInfo.ItemID, mc.Count, itemInfo.MyContent.ContentTransitionCount);
Content content = Content.Get(itemInfo.MyContent.ContentID);
//if (itemInfo.InList(616031, 615898, 5516866))
// Console.WriteLine("here");
if (itemInfo.MyContent.ContentTransitions != null)
{
foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions)
{
Transition.Delete(ct.TransitionID);
}
}
itemInfo.MyContent.RefreshContentTransitions();
//if (content.Text.Contains("Link:TransitionRange"))
// Console.WriteLine("Here");
while (content.Text.Contains("Link:Transition"))
{
TranCheckCount++;
TranConvertCount++;
if (content.FixTransitionText(null, true))
{
ContentInfo.OnStaticContentInfoChange(itemInfo, new StaticContentInfoEventArgs("", "", ""));
if (itemInfo.MyContent.MyGrid != null)
{
content.ConvertTransitionToTextInGrid(null, null);
}
content.Save();
}
else // B2018-043 Eliminate infinite loop for invalid transition structure
@@ -759,14 +768,21 @@ namespace VEPROMS.CSLA.Library
}
}
}
// B2021-008: Delete the transition record if there is no link in the text
if (mc.Count == 0 && itemInfo.MyContent.ContentTransitionCount > 0)
{
TranCheckCount++;
TranFixCount++;
if (itemInfo.MyContent.ContentTransitions != null)
{
foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions)
{
Transition.Delete(ct.TransitionID);
}
}
itemInfo.MyContent.RefreshContentTransitions();
}
@@ -800,10 +816,12 @@ namespace VEPROMS.CSLA.Library
string txt = myContent.Text;
string regDelete = @"(\\v |)\<START\]\#Link\:Transition(|Range)\:[0-9]+ [0-9]+ [0-9]+(| [0-9]+)\[END\>(\\v0 |)";
string txt2=txt;
do{
txt = txt2;
txt2 = Regex.Replace(txt, regDelete, "");
} while(txt2 != txt);
if(txt2 != myContent.Text)
{
using(Content tmp = myContent.Get())
@@ -814,15 +832,7 @@ namespace VEPROMS.CSLA.Library
AddInvalidTransitionAnnotation(itemInfo, "Removed Empty Transition Text");
}
}
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
//{
// foreach (TransitionInfo til in TransitionsToDisconnected)
// {
// if (ti.TransitionID == til.TransitionID)
// return true;
// }
// return false;
//}
private static bool IsTransitionToNonEditable(TransitionInfo ti)
{
foreach (TransitionInfo til in TransitionsToNonEditable)
@@ -832,32 +842,39 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public static void ResetROCounters()
{
ROCheckCount = 0;
ROFixCount = 0;
}
public static int ROCheckCount = 0;
public static int ROFixCount = 0;
private static AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood
public static AnnotationType VolianCommentType
{
get
{
if (_VolianCommentType == null)
_VolianCommentType = AnnotationType.GetByName("Volian Comment");
if (_VolianCommentType == null)
_VolianCommentType = AnnotationType.MakeAnnotationType("Volian Comment", null);
return _VolianCommentType;
}
}
public void UpdateROText()
{
if (this.MyDocVersion.DocVersionAssociationCount == 0) return;
ROFstInfo rofstinfo = this.MyDocVersion.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(this.MyDocVersion);
lookup.MyDocVersionInfo = this.MyDocVersion;
lookup.MyItemInfo = this; // B2022-020 to pass information into error log if needed
if (this.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in this.MyContent.ContentRoUsages)
@@ -878,33 +895,39 @@ namespace VEPROMS.CSLA.Library
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
}
}
else
{
content.FixContentText(rousage, roval, roch.type, rofstinfo);
}
content.Save();
}
}
}
}
}
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo)
// B2022-026 RO Memory Reduction code - pass in ROFstInfo
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, ROFstInfo origROFst)
{
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
//List<ItemInfo> myItems = new List<ItemInfo>();
foreach (ItemInfo ii in pi.MyItems)
// myItems.Add(ii);
//foreach (ItemInfo ii in myItems)
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo);
{
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, origROFst);
}
}
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
lookup.MyDocVersionInfo = docVersionInfo;
}
// B2022-026 RO Memory Reduction code - get ROLookup from passed in ROFstInfo
ROFSTLookup lookup = origROFst.GetROFSTLookup(docVersionInfo);
lookup.MyItemInfo = itemInfo; // B2022-020 to pass information into error log if needed
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
@@ -915,8 +938,9 @@ namespace VEPROMS.CSLA.Library
string oldText = itemInfo.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, origROFst, itemInfo);
string newText = itemInfo.MyContent.Text;
if (DifferentROtext(newText,oldText))
{
//ShowDifference(oldText, newText); // debug - display in Visual Studio Output window
@@ -924,7 +948,7 @@ namespace VEPROMS.CSLA.Library
Content content = Content.Get(itemInfo.MyContent.ContentID);
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
oldText = content.ConvertROToText(rousage, roval, roch.type, origROFst);
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
@@ -934,7 +958,7 @@ namespace VEPROMS.CSLA.Library
}
else
{
content.FixContentText(rousage, roval, roch.type, rofstinfo);
content.FixContentText(rousage, roval, roch.type, origROFst);
}
content.UserID = Volian.Base.Library.VlnSettings.UserID;
content.DTS = DateTime.Now;
@@ -949,12 +973,17 @@ namespace VEPROMS.CSLA.Library
{
string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
string ot = oldText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
if (nt.Equals(ot))
{
return false;
}
return true;
}
#region debug
#region Debug Code
//private static void ShowDifference(string oldText, string newText)
//{
// string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
@@ -974,7 +1003,9 @@ namespace VEPROMS.CSLA.Library
// }
// Console.WriteLine("{0}='{1}'",title,sb.ToString());
//}
#endregion // debug
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo.MyContent.ContentPartCount > 0)
@@ -995,21 +1026,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
//internal static long ticksROUsage;
//internal static long ticksItems;
//internal static long ticksTrans;
//internal static void ResetTicks()
//{
// ticksROUsage = 0;
// ticksItems = 0;
// ticksTrans = 0;
//}
//internal static void ShowTicks()
//{
// Console.WriteLine("ROUsage: {0}", TimeSpan.FromTicks(ticksROUsage).TotalSeconds);
// Console.WriteLine("Items: {0}", TimeSpan.FromTicks(ticksItems).TotalSeconds);
// Console.WriteLine("Transitions: {0}", TimeSpan.FromTicks(ticksTrans).TotalSeconds);
//}
public static string GetCombinedTab(ItemInfo itemInfo, string parTab)
{
string pTab = parTab == null ? "" : parTab;
@@ -1034,6 +1051,7 @@ namespace VEPROMS.CSLA.Library
if (itemInfo.HasParentTab) return thisTab.Trim(); // F2020-023: if tab includes parent tab already, don't concatenate it
return pTab + thisTab.Trim();
}
internal static void SetParentSectionAndDocVersion(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo == null) return;
@@ -1044,17 +1062,20 @@ namespace VEPROMS.CSLA.Library
itemInfo.ActiveSection = sectionInfo;
itemInfo.ActiveFormat = itemInfo.MyContent.MyFormat != null ? itemInfo.MyContent.MyFormat : sectionInfo == null ? itemParent.ActiveFormat : sectionInfo.ActiveFormat;
itemInfo.MyDocVersion = docVersionInfo;
if (itemInfo.IsStep)
{
ItemInfo ip = itemParent as ItemInfo;
itemInfo.CombinedTab = (ip == null) ? itemInfo.MyTab.CleanText.Trim() : GetCombinedTab(itemInfo, ip.CombinedTab);
}
if (docVersionInfo.DocVersionAssociationCount == 1)
{
string otherChildUnit = null;
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
//rofstinfo.docVer = docVersionInfo;
string rawPrcNum = itemInfo.MyProcedure.MyContent.Number;
// C2022-001 see if we need to get the Other child info from ROLookUp
if (rawPrcNum.ToUpper().StartsWith("<U\\U8209?OTHER")) // proc number has <u-otherxxx> in its definiation (procedure property page)
{
@@ -1064,11 +1085,11 @@ namespace VEPROMS.CSLA.Library
}
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo, otherChildUnit);
lookup.MyDocVersionInfo = docVersionInfo;
lookup.MyItemInfo = itemInfo; // B2022-020 to pass information into error log if needed
//DateTime dts = DateTime.Now;
if (itemInfo.MyContent.ContentGridCount > 0)
itemInfo.MyContent.LoadNonCachedGrid();
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
@@ -1087,39 +1108,27 @@ namespace VEPROMS.CSLA.Library
// Force Error Message
docVersionInfo.GetROFst(0);
}
//TimeSpan ts = DateTime.Now.Subtract(dts);
//ticksROUsage += ts.Ticks;
//dts = DateTime.Now;
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
//ItemInfo il = null;
foreach (ItemInfo ii in pi.MyItems)
{
SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, tranLookup);
//if(ii._MyPrevious == null)
// ii.MyPrevious = il;
//if (il != null) il.NextItem = ii;
//il = ii;
}
}
}
//ts = DateTime.Now.Subtract(dts);
//ticksItems += ts.Ticks;
//dts = DateTime.Now;
if (itemInfo.MyContent.ContentTransitionCount > 0)
{
//itemInfo.UpdateTransitionText();
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
{
//itemInfo.UpdateTransitionText();
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup, itemInfo);
}
}
//ts = DateTime.Now.Subtract(dts);
//ticksTrans += ts.Ticks;
}
private int _PrintBias = 0;
public int PrintBias
{
@@ -7127,10 +7136,11 @@ namespace VEPROMS.CSLA.Library
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshTransitions(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion, tranLookup);
}
public static void RefreshReferenceObjects(ProcedureInfo tmp)
// B2022-026 RO Memory Reduction code - added ROFstInfo parameter
public static void RefreshReferenceObjects(ProcedureInfo tmp, ROFstInfo origROFst)
{
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion);
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion, origROFst);
}
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
{

View File

@@ -16,6 +16,7 @@ namespace VEPROMS.CSLA.Library
Procedure = 0, Document = 1, DocVersion = 2, Folder = 3, Session = 4
}
#endregion
#region SessionInfoList stuff
public partial class SessionInfoList
{
@@ -67,6 +68,7 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region SessionInfo stuff
public partial class SessionInfo
{
@@ -750,6 +752,7 @@ namespace VEPROMS.CSLA.Library
#endregion
}
#endregion
#region OwnerInfo stuff
public partial class OwnerInfoList
{
@@ -1072,29 +1075,36 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region UserInfo stuff
public partial class UserInfo
{
public static bool CanEdit(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo!=null && myDVI!=null && (myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsWriter(myDVI));
}
public static bool CanEditROs(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsROEditor(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, FolderInfo fi)
{
return myUserInfo != null && fi != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(fi.MyParent); //B2020-111 allow if set amin controls parent
}
public bool IsAdministrator()
{
if (this.UserMembershipCount == 0)
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1108,6 +1118,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
//B2020-111, B2020-114, C2020-035 this was setting the passed in parameter, such that the first time this
// was called, the passed in parameter was set to the top node (VEPROMS). The check of other folders
// would then be skipped (from where is called)
@@ -1115,6 +1126,7 @@ namespace VEPROMS.CSLA.Library
{
if (this.UserMembershipCount == 0 || fldinf == null)
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1137,10 +1149,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsSetAdministrator(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1162,10 +1176,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsWriter(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1187,10 +1203,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsReviewer(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1212,10 +1230,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsROEditor(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1237,6 +1257,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
// B2018-112 added for easy check if user's PROMS Security allows making edits - used in StepTabRibbon - SetButtonAndMenuEnabling()
public bool IsAllowedToEdit(DocVersionInfo dvi)
{
@@ -1259,6 +1280,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on UserInfo.GetByUserID", ex);
}
}
[Serializable()]
protected class GetByUserIDCriteria
{
@@ -1270,6 +1292,7 @@ namespace VEPROMS.CSLA.Library
_UserID = userID;
}
}
private void DataPortal_Fetch(GetByUserIDCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] UserInfo.DataPortal_Fetch", GetHashCode());
@@ -1307,5 +1330,6 @@ namespace VEPROMS.CSLA.Library
}
}
}
#endregion
}

File diff suppressed because it is too large Load Diff