Added code to support conversion to text of invalid referenced objects and invalid transitions

Added command line switch NOUPDATERO to prevent updating referenced objects
Added code to support conversion to text of invalid transitions
This commit is contained in:
Rich 2015-02-05 03:52:57 +00:00
parent af0e36b6c6
commit e3b5351b30
6 changed files with 370 additions and 21 deletions

View File

@ -1594,6 +1594,7 @@ namespace VEPROMS.CSLA.Library
tran.MyItemToID.UpdateTransitionText();
}
}
tmp.UpdateROText();
using (Content cont = tmp.MyContent.Get())
{
if (cont.ContentTransitionCount > 0)

View File

@ -18,6 +18,10 @@ namespace VEPROMS.CSLA.Library
}
public void FixTransitionText(TransitionInfo tran)
{
FixTransitionText(tran, false);
}
public void FixTransitionText(TransitionInfo tran, bool forceConvertToText)
{
//string transText = tran.ResolvePathTo();
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
////string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
@ -29,6 +33,8 @@ namespace VEPROMS.CSLA.Library
// Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
//}
string newvalue = tran.ResolvePathTo();
if (forceConvertToText)
newvalue = "?";
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
@ -38,7 +44,7 @@ namespace VEPROMS.CSLA.Library
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1)
{
int myIndex = m.Groups[4].Index + mm.Index;
int myIndex = m.Groups[4].Index + mm.Index;
int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ")
{
@ -47,7 +53,14 @@ namespace VEPROMS.CSLA.Library
}
string gg = Text.Substring(myIndex, myLength);
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
if (gg != newvalue)
if (gg != newvalue && newvalue == "?")
{
string rv = ConvertTransitionToText(tran, newvalue);
//Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength);
Annotation.MakeAnnotation(this.ContentItems[0].MyItem, ItemInfo.VolianCommentType, "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
break;
}
else if (gg != newvalue)
{
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
break; // Text has been processed
@ -106,6 +119,120 @@ namespace VEPROMS.CSLA.Library
}
}
}
public string ConvertTransitionToText(TransitionInfo tran, string value)
{
string retval = null;
string newvalue = value;
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
//string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousg.ROUsageID);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
int lastIndex = 0;
string newText = Text;
foreach (Match mm in ms)
{
int offset = mm.Index;
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1)
{
string prefix = GetMyPrefix(mm.Index, lastIndex);
string suffix = GetMySuffix(mm.Index + mm.Length);
int myIndex = m.Groups[4].Index + mm.Index;
int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ")
{
myIndex = m.Groups[3].Index + mm.Index;
myLength += m.Groups[3].Length;
}
string gg = newText.Substring(myIndex, myLength);
retval = gg;
gg = gg.Replace("{", @"\{").Replace("}", @"\}");
string part1 = newText.Substring(0, mm.Index);
string part2 = gg;
string part3 = newText.Substring(mm.Index + mm.Length);
//modify part1 based on prefix
if (prefix == @"\v ")
part1 = part1.Substring(0, part1.Length - 3);
else
part1 = part1.Substring(0, part1.Length - 3) + " ";
//modify part3 based on suffix
if (suffix == @"\v0 ")
part3 = part3.Substring(4);
else
part3 = suffix.Replace(@"\v0", "") + part3.Substring(suffix.Length);
if (gg.Contains(@"\u8209?"))
{
Match mmm = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (mmm == null)
newvalue = newvalue.Replace(@"\u8209?", "-");
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
Text = part1 + part2 + part3;
break; // Text has been processed
}
lastIndex = mm.Index + mm.Length;
}
Console.WriteLine("Text: {0} NewText: {1}", Text, newText);
return retval;
}
public string ConvertTransitionToText(int tranID, int tranType, string value)
{
string retval = null;
string newvalue = value;
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tranType, tranID);
int lastIndex = 0;
string newText = Text;
foreach (Match mm in ms)
{
int offset = mm.Index;
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1)
{
string prefix = GetMyPrefix(mm.Index, lastIndex);
string suffix = GetMySuffix(mm.Index + mm.Length);
int myIndex = m.Groups[4].Index + mm.Index;
int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ")
{
myIndex = m.Groups[3].Index + mm.Index;
myLength += m.Groups[3].Length;
}
string gg = newText.Substring(myIndex, myLength);
retval = gg;
gg = gg.Replace("{", @"\{").Replace("}", @"\}");
string part1 = newText.Substring(0, mm.Index);
string part2 = gg;
string part3 = newText.Substring(mm.Index + mm.Length);
//modify part1 based on prefix
if (prefix == @"\v ")
part1 = part1.Substring(0, part1.Length - 3);
else
part1 = part1.Substring(0, part1.Length - 3) + " ";
//modify part3 based on suffix
if (suffix == @"\v0 ")
part3 = part3.Substring(4);
else
part3 = suffix.Replace(@"\v0", "") + part3.Substring(suffix.Length);
if (gg.Contains(@"\u8209?"))
{
Match mmm = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (mmm == null)
newvalue = newvalue.Replace(@"\u8209?", "-");
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
Text = part1 + part2 + part3;
break; // Text has been processed
}
lastIndex = mm.Index + mm.Length;
}
Console.WriteLine("Text: {0} NewText: {1}", Text, newText);
return retval;
}
private string GetMySuffix(int start)
{
string txt = Text.Substring(start);
@ -159,6 +286,7 @@ namespace VEPROMS.CSLA.Library
myLength += m.Groups[3].Length;
}
string gg = newText.Substring(myIndex, myLength);
retval = gg;
gg = gg.Replace("{", @"\{").Replace("}", @"\}");
string part1 = newText.Substring(0, mm.Index);
string part2 = gg;
@ -271,6 +399,12 @@ namespace VEPROMS.CSLA.Library
public string FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo,string fileNameOnly) // string newvalue)
{
string retval = null;
if (value == "?")
{
retval = this.ConvertROToText(rousg, value, rotype, origROFstInfo);
Annotation.MakeAnnotation(this.ContentItems[0].MyItem, ItemInfo.VolianCommentType, "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(retval)), null);
return retval;
}
string newvalue = value;
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
string findLink = @"<START\].*?\[END>";
@ -407,9 +541,12 @@ namespace VEPROMS.CSLA.Library
if (id == ContentID) return true;
return false;
}
public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii)
public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii)
{
FixTransitionText(tran, tranLookup, ii, false);
}
public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii, bool forceConvertToText)
{
if (ii.InList(4706)) Console.WriteLine("jcb");
//string transText = tran.ResolvePathTo();
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
////string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
@ -427,6 +564,8 @@ namespace VEPROMS.CSLA.Library
newvalue = tran.ResolvePathTo();
else
newvalue = tran.ResolvePathTo(tranLookup);
if (forceConvertToText)
newvalue = "?";
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
@ -510,7 +649,11 @@ namespace VEPROMS.CSLA.Library
}
public void FixTransitionText(TransitionInfo tran, ItemInfo ii)
{
FixTransitionText(tran, null, ii);
FixTransitionText(tran, ii, false);
}
public void FixTransitionText(TransitionInfo tran, ItemInfo ii, bool forceConvertToText)
{
FixTransitionText(tran, null, ii, forceConvertToText);
//string transText = tran.ResolvePathTo(tranLookup);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
////string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);

View File

@ -556,7 +556,9 @@ namespace VEPROMS.CSLA.Library
}
public static int TranCheckCount = 0;
public static int TranFixCount = 0;
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
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);
@ -582,6 +584,15 @@ namespace VEPROMS.CSLA.Library
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
{
TranCheckCount++;
if (IsTransitionToNonEditable(traninfo))
{
TranFixCount++;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true);
Content content = Content.Get(itemInfo.MyContent.ContentID);
content.FixTransitionText(traninfo, true);
content.Save();
return;
}
string oldText = itemInfo.MyContent.Text;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo);
string newText = itemInfo.MyContent.Text;
@ -595,7 +606,25 @@ namespace VEPROMS.CSLA.Library
}
}
}
public static void ResetROCounters()
//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)
{
if (ti.TransitionID == til.TransitionID)
return true;
}
return false;
}
public static void ResetROCounters()
{
ROCheckCount = 0;
ROFixCount = 0;
@ -614,6 +643,38 @@ namespace VEPROMS.CSLA.Library
return _VolianCommentType;
}
}
public void UpdateROText()
{
ROFstInfo rofstinfo = this.MyDocVersion.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(this.MyDocVersion);
lookup.MyDocVersionInfo = this.MyDocVersion;
if (this.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in this.MyContent.ContentRoUsages)
{
if (this.ActiveSection != null)
{
string oldText = this.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this);
string newText = this.MyContent.Text;
if (newText != oldText)
{
Content content = Content.Get(this.MyContent.ContentID);
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", 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)
{
if (itemInfo.MyContent.ContentPartCount > 0)
@ -642,7 +703,7 @@ namespace VEPROMS.CSLA.Library
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
//Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text" + sameMsg, ItemInfo.ConvertToDisplayText(oldText)), null);
Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
}
else
content.FixContentText(rousage, roval, roch.type, rofstinfo);
@ -5431,8 +5492,14 @@ namespace VEPROMS.CSLA.Library
{
return (Procedure)(_Editable = Procedure.Get(ItemID));
}
public static void RefreshTransitions(ProcedureInfo tmp)
public static void RefreshTransitions(ProcedureInfo tmp)
{
RefreshTransitions(tmp, null, null);
}
public static void RefreshTransitions(ProcedureInfo tmp, TransitionInfoList transitionToDisconnected, TransitionInfoList transitionsToNonEditable)
{
TransitionsToDisconnected = transitionToDisconnected;
TransitionsToNonEditable = transitionsToNonEditable;
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);

View File

@ -298,6 +298,7 @@ namespace VEPROMS.CSLA.Library
using (Item item = Get()) ItemInfo.Refresh(item);
// Update all of the content records that have transitions that point to the Siblings or Sibling Children of the new item
tmp.UpdateTransitionText();
tmp.UpdateROText();
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
return tmp;
@ -431,16 +432,16 @@ namespace VEPROMS.CSLA.Library
StepConfig sc = ii.MyConfig as StepConfig;
if (chgid != null && sc.Step_ChangeID != chgid)
{
sc.Step_ChangeID = chgid;
using (Item itm = ii.Get())
{
itm.MyContent.Config = sc.ToString();
itm.MyContent.DTS = DateTime.Now;
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
itm.Save();
}
sc.Step_ChangeID = chgid;
using (Item itm = ii.Get())
{
itm.MyContent.Config = sc.ToString();
itm.MyContent.DTS = DateTime.Now;
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
itm.Save();
}
}
}
// handle all of the children
if (ii.Cautions != null) foreach (ItemInfo chldc in ii.Cautions) PasteSetChangeId(chldc, chgid);
if (ii.Notes != null) foreach (ItemInfo chldn in ii.Notes) PasteSetChangeId(chldn, chgid);
@ -490,6 +491,7 @@ namespace VEPROMS.CSLA.Library
ItemInfo tmp = CopyPasteItemInfoFetch(copyStartID, this.ItemID, type, type, EAddpingPart.Before);
using (Item item = Get()) ItemInfo.Refresh(item);
tmp.UpdateTransitionText();
tmp.UpdateROText();
tmp.UpdatePastedStepTransitionText();
PasteSetChangeId(tmp, chgid);
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
@ -518,6 +520,7 @@ namespace VEPROMS.CSLA.Library
// of any previous cautions or notes.
if (tmp.IsCaution || tmp.IsNote) ResetOrdinal();
tmp.UpdateTransitionText();
tmp.UpdateROText();
tmp.UpdatePastedStepTransitionText();
PasteSetChangeId(tmp, chgid);
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
@ -609,6 +612,7 @@ namespace VEPROMS.CSLA.Library
if (tmp.IsCaution || tmp.IsNote) ResetOrdinal();
// Update all of the content records that have transitions that point to the Siblings or Sibling Children of the new item
tmp.UpdateTransitionText();
tmp.UpdateROText();
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
return tmp;
}
@ -675,7 +679,12 @@ namespace VEPROMS.CSLA.Library
oldContent = content;
}
if (oldContent == null) oldContent = content;
oldContent.FixTransitionText(tran);
//check to see if noneditable
bool forceConvertToText;
SectionConfig sc = tran.MyItemToID.ActiveSection.MyConfig as SectionConfig;
//SectionConfig sc = new SectionConfig(tran.MyItemToID.ActiveSection.MyConfig.ToString());
forceConvertToText = (sc.SubSection_Edit == "N");
oldContent.FixTransitionText(tran, forceConvertToText);
//if (content.IsDirty)
//{
// content.DTS = DateTime.Now;
@ -710,7 +719,12 @@ namespace VEPROMS.CSLA.Library
{
using (Content content = tran.MyContent.Get())
{
content.FixTransitionText(tran);
//check to see if noneditable
bool forceConvertToText;
SectionConfig sc = tran.MyItemToID.ActiveSection.MyConfig as SectionConfig;
//SectionConfig sc = new SectionConfig(tran.MyItemToID.ActiveSection.MyConfig.ToString());
forceConvertToText = (sc.SubSection_Edit == "N");
content.FixTransitionText(tran, forceConvertToText);
if (content.IsDirty)
content.Save();
else // Update ContentInfo objects to reflect the change in the transition
@ -737,6 +751,7 @@ namespace VEPROMS.CSLA.Library
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
// Update all of the content records that have transitions that point to the Siblings or Sibling Children of the new item
tmp.UpdateTransitionText();
tmp.UpdateROText();
MyContent.RefreshContentParts();
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
return tmp;
@ -1301,6 +1316,7 @@ namespace VEPROMS.CSLA.Library
// of any previous cautions or notes.
if (newItemInfo.IsCaution || newItemInfo.IsNote) newItemInfo.ResetOrdinal();
newItemInfo.UpdateTransitionText();
newItemInfo.UpdateROText();
newItemInfo.UpdatePastedStepTransitionText();
// Add to tree
if (newItemInfo.NextItemCount > 0)

View File

@ -293,7 +293,8 @@ namespace VEPROMS.CSLA.Library
{
docver.DocVersionAssociations[0].MyROFst = rofst;
docver.Save();
UpdateROValuesText(origROFst, rofst, DocVersionInfo.Get(docver.VersionID));
if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOUPDATERO"))
UpdateROValuesText(origROFst, rofst, DocVersionInfo.Get(docver.VersionID));
return rofst;
}
@ -333,7 +334,8 @@ namespace VEPROMS.CSLA.Library
}
// Now update the usages: compare old to new rofsts and update usages accordingly, i.e. modified
// values, deleted ros, etc.
UpdateROValuesText(origROFst, rofst, DocVersionInfo.Get(docver.VersionID));
if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOUPDATERO"))
UpdateROValuesText(origROFst, rofst, DocVersionInfo.Get(docver.VersionID));
return rofst;
}
}

View File

@ -468,6 +468,124 @@ namespace VEPROMS.CSLA.Library
this.RaiseListChangedEvents = true;
}
#endregion
#region TransitionsToDisconnected
private class TransitionsToDisconnectedCriteria
{
public TransitionsToDisconnectedCriteria(string docVersionList)
{
_DocVersionList = docVersionList;
}
private string _DocVersionList;
public string DocVersionList
{
get { return _DocVersionList; }
set { _DocVersionList = value; }
}
}
public static TransitionInfoList GetTransitionsToDisconnected(string docVersionList)
{
try
{
TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new TransitionsToDisconnectedCriteria(docVersionList));
TransitionInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on TransitionInfoList.GetTransitionsToDisconnected", ex);
}
}
private void DataPortal_Fetch(TransitionsToDisconnectedCriteria criteria)
{
this.RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_FetchTransitionsToDisconnected", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getTransitionsToDisconnected";
cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read()) this.Add(new TransitionInfo(dr));
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_FetchTransitionsToDisconnected", ex);
throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
#region TransitionsToNonEditable
private class TransitionsToNonEditableCriteria
{
public TransitionsToNonEditableCriteria(string docVersionList)
{
_DocVersionList = docVersionList;
}
private string _DocVersionList;
public string DocVersionList
{
get { return _DocVersionList; }
set { _DocVersionList = value; }
}
}
public static TransitionInfoList GetTransitionsToNonEditable(string docVersionList)
{
try
{
TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new TransitionsToNonEditableCriteria(docVersionList));
TransitionInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on TransitionInfoList.GetTransitionsToNonEditable", ex);
}
}
private void DataPortal_Fetch(TransitionsToNonEditableCriteria criteria)
{
this.RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_FetchTransitionsToNonEditable", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getTransitionsToNonEditable";
cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read()) this.Add(new TransitionInfo(dr));
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_FetchTransitionsToNonEditable", ex);
throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
}
public class TransitionBuilder
{
@ -672,6 +790,8 @@ namespace VEPROMS.CSLA.Library
}
if(_AppendMethods==null)
SetupMethods();
if (toItem.MyDocVersion == null)
return "?";
string retval = BuildString(tb);
// Added for transitions to un-numbered steps
if (retval == string.Empty)