Revert to previous version

This commit is contained in:
Rich
2018-01-19 19:21:42 +00:00
parent 05f04b75ef
commit b1fa1603b2
8 changed files with 49 additions and 167 deletions

View File

@@ -46,11 +46,7 @@ namespace VEPROMS.CSLA.Library
string lookFor;
if (tran == null)
{
// B2018-002 - Invalid Transitions - Handle Range Transitions
int loc1 = Text.IndexOf("#Link:Transition:", 0);
if(loc1 > 0) loc1+=("#Link:Transition:").Length;
else
loc1 = Text.IndexOf("#Link:TransitionRange:", 0)+ ("#Link:TransitionRange:").Length;;
int loc1 = Text.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
int loc2 = Text.IndexOf(" ", loc1);
string trantype = Text.Substring(loc1, loc2 - loc1);
loc1 = loc2 + 1;
@@ -81,12 +77,8 @@ namespace VEPROMS.CSLA.Library
using (Item myitem = this.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 transition is converted to text]
//Check for validity
// B2018-002 - Invalid Transitions - Add a prefix of invalid if the transition record is missing
string prefix = "";
if (tran == null) prefix = "Invalid ";
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", prefix + string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
// B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
}
if(tran != null)
Transition.Delete(tran.TransitionID);
@@ -182,12 +174,7 @@ namespace VEPROMS.CSLA.Library
string lookFor;
if (tran == null)
{
// B2018-002 - Invalid Transitions - Added code to support range transitions
int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0);
if (loc1 > 0) loc1 += ("#Link:Transition:").Length;
else
loc1 = MyGrid.Data.IndexOf("#Link:TransitionRange:", 0) + ("#Link:TransitionRange:").Length; ;
//int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
int loc2 = MyGrid.Data.IndexOf(" ", loc1);
string trantype = MyGrid.Data.Substring(loc1, loc2 - loc1);
loc1 = loc2 + 1;
@@ -241,11 +228,7 @@ namespace VEPROMS.CSLA.Library
string lookFor;
if (tran == null)
{
// B2018-002 - Invalid Transitions - Added code to support range transitions
int loc1 = Text.IndexOf("#Link:Transition:", 0);
if (loc1 > 0) loc1 += ("#Link:Transition:").Length;
else
loc1 = Text.IndexOf("#Link:TransitionRange:", 0) + ("#Link:TransitionRange:").Length; ;
int loc1 = Text.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
int loc2 = Text.IndexOf(" ", loc1);
string trantype = Text.Substring(loc1, loc2 - loc1);
loc1 = loc2 + 1;
@@ -775,8 +758,7 @@ namespace VEPROMS.CSLA.Library
return _CacheByPrimaryKey.ContainsKey(contentID.ToString());
}
public static event StaticContentInfoEvent StaticContentInfoChange;
// B2018-002 - Invalid Transitions - Changed to Public
public static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
private static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{
if (StaticContentInfoChange != null)
StaticContentInfoChange(sender, args);

View File

@@ -590,11 +590,9 @@ namespace VEPROMS.CSLA.Library
{
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)
@@ -623,9 +621,7 @@ namespace VEPROMS.CSLA.Library
//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))
if (itemInfo.MyContent.ContentTransitionCount > 0)
{
itemInfo.ResetOrdinal();
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
@@ -665,14 +661,14 @@ namespace VEPROMS.CSLA.Library
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++;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to External Procedure using Internal Format");
Content content = Content.Get(itemInfo.MyContent.ContentID);
content.FixTransitionText(traninfo, true);
content.Save();
}
{
forceConvertToText = true;
TranFixCount++;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to External Procedure using Internal Format");
Content content = Content.Get(itemInfo.MyContent.ContentID);
content.FixTransitionText(traninfo, true);
content.Save();
}
}
if (!forceConvertToText)
{
@@ -680,14 +676,14 @@ namespace VEPROMS.CSLA.Library
{
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++;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to Outside Procedure using Internal Format");
Content content = Content.Get(itemInfo.MyContent.ContentID);
content.FixTransitionText(traninfo, true);
content.Save();
}
{
forceConvertToText = true;
TranFixCount++;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to Outside Procedure using Internal Format");
Content content = Content.Get(itemInfo.MyContent.ContentID);
content.FixTransitionText(traninfo, true);
content.Save();
}
}
}
if (!forceConvertToText)
@@ -697,7 +693,7 @@ namespace VEPROMS.CSLA.Library
string newText = itemInfo.MyContent.Text;
// B2017-165 added check of newValue (special case for old 16-bit transition that was not fixed by the customer)
string newValue = traninfo.ResolvePathTo(itemInfo.ActiveFormat, itemInfo, traninfo.TranType, traninfo.MyItemToID, traninfo.MyItemRangeID);
if (newText != oldText || newValue == "?")
if (newText != oldText|| newValue == "?")
{
TranFixCount++;
Content content = Content.Get(itemInfo.MyContent.ContentID);
@@ -708,42 +704,6 @@ 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)
{
bool retval = true;
MatchCollection mc = Regex.Matches(itemInfo.MyContent.Text, @"\#Link\:Transition");
if (itemInfo.MyContent.ContentTransitionCount <= 0 || mc.Count > itemInfo.MyContent.ContentTransitionCount)
{
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();
}
}
}
}
return retval;
}
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
//{
// foreach (TransitionInfo til in TransitionsToDisconnected)

View File

@@ -1456,6 +1456,8 @@ namespace VEPROMS.CSLA.Library
string str = BuildSectionPath(ToSections);
str = Regex.Replace(str, @"\<U\>", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"\<ID\>", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase);
if(str != str1)
Console.WriteLine("Difference In Strings: {0}\r\n{1}",str,str1);
//if (!str.EndsWith(".") && tb._ToItem.ItemID != tb._ToItem.ActiveSection.ItemID)
tb.StepPrefix = ".";
tb.SectionNumberLength = str.Length;