support for PROC.INI “RO’s” and convert dashes to non-breaking dashes, fix for Fortran format numbers

removed the space from “Procedure Number” for the get profile of ProcedureNumber
Added Unit Specific logic
This commit is contained in:
John Jenko 2011-09-22 19:54:03 +00:00
parent bf8ee98a53
commit e9865f3250
4 changed files with 55 additions and 15 deletions

View File

@ -233,7 +233,7 @@ namespace VEPROMS.CSLA.Library
if (rochld.children != null)
{
foreach (rochild child in rochld.children)
if (child.roid.ToUpper() == ROID16)
if (child.roid.ToUpper() == ROID16 || (child.roid.EndsWith("0041") && ROID16.EndsWith("0000")))
return child.value;
// if there isn't a specific match for multi-return values, default to the first child.
return rochld.children[0].value;
@ -919,6 +919,7 @@ namespace VEPROMS.CSLA.Library
#region FortranFormat
public static string ConvertFortranFormatToScienctificNotation(string str)
{
str = str.Replace(@"\u8209?", "-");
string retval = Regex.Replace(str, "([+-]?)([0-9]+)[.]([0-9]*?)0*E([+-]?[0-9]+)", new MatchEvaluator(FixFortranNumber));
retval = Regex.Replace(retval, "[#](.*?)[#]", "\\up2 $1\\up0 ");// DOS Superscript
retval = Regex.Replace(retval, "[~](.*?)[~]", "\\dn2 $1\\up0 ");// DOS Subscript
@ -926,7 +927,7 @@ namespace VEPROMS.CSLA.Library
}
private static string FixFortranNumber(Match match)
{
StringBuilder sb = new StringBuilder(match.Groups[1].Value);
StringBuilder sb = new StringBuilder(match.Groups[1].Value.Replace("-",@"\u8209?"));
if (match.Groups[3].Length == 0) // Nothing to the right of the decimal
if (match.Groups[2].Value != "1") // Other than "1", multiply it times 10 raised to a power
sb.Append(match.Groups[2].Value + "x10");
@ -935,7 +936,7 @@ namespace VEPROMS.CSLA.Library
else // A number with a decimal point
sb.Append(match.Groups[2].Value + "." + match.Groups[3].Value + "x10");
// Add the exponent as superscript
return sb.ToString() + "\\up2 " + match.Groups[4].Value + "\\up0 ";
return sb.ToString() + "\\up2 " + match.Groups[4].Value.Replace("-",@"\u8209?") + "\\up0 ";
}
#endregion
}

View File

@ -194,7 +194,7 @@ namespace VEPROMS.CSLA.Library
//GetPrivateProfileString("unit", "procedure number", asis, mstr, MAXPATH, "proc.ini");
string pnum = asis;
string mstr = GetProfile("Unit", "Procedure Number");
string mstr = GetProfile("Unit", "ProcedureNumber");
if (!mstr.Equals(string.Empty))
pnum = mstr;
if (pnum.Equals(asis))

View File

@ -1259,7 +1259,12 @@ namespace VEPROMS.CSLA.Library
}
public string DisplayNumber
{
get { return ConvertToDisplayText(MyContent.Number); }
get
{
string str = (this.IsProcedure)?MyDocVersion.UnitSpecific(MyContent.Number,0):MyContent.Number;
return ConvertToDisplayText(str);
}
//get { return ConvertToDisplayText(MyContent.Number); }
}
public static string ConvertToDisplayText(string txt)
{
@ -1992,6 +1997,8 @@ namespace VEPROMS.CSLA.Library
protected void SetTabText()
{
string cltext = null;
if (IsAnd)
Console.WriteLine("and substep");
if (IsParagraph)
{
_MyTab.Text = "";
@ -2627,11 +2634,11 @@ namespace VEPROMS.CSLA.Library
IsReadOnly = true;
}
#region Text Search
public static ItemInfoList GetListFromTextSearch(string docVersionList, string stepTypeList, string searchString, int caseSensitive, ItemSearchIncludeLinks includeLinks, bool includeRtfFormatting, bool includeSpecialCharacters)
public static ItemInfoList GetListFromTextSearch(string docVersionList, string stepTypeList, string searchString, int caseSensitive, ItemSearchIncludeLinks includeLinks, bool includeRtfFormatting, bool includeSpecialCharacters, string unitPrefix)
{
try
{
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters));
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters,unitPrefix));
ItemInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
@ -2686,8 +2693,15 @@ namespace VEPROMS.CSLA.Library
get { return _IncludeSpecialCharacters; }
set { _IncludeSpecialCharacters = value; }
}
private string _UnitPrefix;
public string UnitPrefix
{
get { return _UnitPrefix; }
set { _UnitPrefix = value; }
}
public ItemListSearchCriteria(string docVersionList, string stepTypeList, string searchString,
int caseSensitive, ItemSearchIncludeLinks includeLinks, bool includeRtfFormatting, bool includeSpecialCharacters)
int caseSensitive, ItemSearchIncludeLinks includeLinks, bool includeRtfFormatting, bool includeSpecialCharacters, string unitPrefix)
{
_DocVersionList = docVersionList;
_StepTypeList = stepTypeList;
@ -2696,6 +2710,7 @@ namespace VEPROMS.CSLA.Library
_IncludeLinks = includeLinks;
_IncludeRtfFormatting = includeRtfFormatting;
_IncludeSpecialCharacters = includeSpecialCharacters;
_UnitPrefix = unitPrefix;
}
}
private void DataPortal_Fetch(ItemListSearchCriteria criteria)
@ -2716,6 +2731,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@IncludeLinks", (int) criteria.IncludeLinks);
cm.Parameters.AddWithValue("@IncludeRtfFormatting", criteria.IncludeRtfFormatting ? 1 : 0);
cm.Parameters.AddWithValue("@IncludeSpecialCharacters", criteria.IncludeSpecialCharacters ? 1 : 0);
cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix);
cm.CommandTimeout = 120;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
@ -2755,11 +2771,11 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region RO Search
public static ItemInfoList GetListFromROSearch(string docVersionList, string stepTypeList, string roSearchString)
public static ItemInfoList GetListFromROSearch(string docVersionList, string stepTypeList, string roSearchString, string unitPrefix)
{
try
{
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROSearchCriteria(docVersionList, stepTypeList, roSearchString));
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROSearchCriteria(docVersionList, stepTypeList, roSearchString, unitPrefix));
ItemInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
@ -2790,11 +2806,18 @@ namespace VEPROMS.CSLA.Library
get { return _ROSearchString; }
set { _ROSearchString = value; }
}
public ItemListROSearchCriteria(string docVersionList, string stepTypeList, string roSearchString)
private string _UnitPrefix;
public string UnitPrefix
{
get { return _UnitPrefix; }
set { _UnitPrefix = value; }
}
public ItemListROSearchCriteria(string docVersionList, string stepTypeList, string roSearchString, string unitPrefix)
{
_DocVersionList = docVersionList;
_StepTypeList = stepTypeList;
_ROSearchString = roSearchString;
_UnitPrefix = unitPrefix;
}
}
private void DataPortal_Fetch(ItemListROSearchCriteria criteria)
@ -2811,6 +2834,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList);
cm.Parameters.AddWithValue("@StepTypeList", criteria.StepTypeList);
cm.Parameters.AddWithValue("@ROSearchString", criteria.ROSearchString);
cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
while (dr.Read())
@ -2849,11 +2873,11 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region Annotation Search
public static ItemInfoList GetListFromAnnotationSearch(string docVersionList, string stepTypeList, string annotationTypeList, string searchString, bool caseSensitive)
public static ItemInfoList GetListFromAnnotationSearch(string docVersionList, string stepTypeList, string annotationTypeList, string searchString, bool caseSensitive, string unitPrefix)
{
try
{
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListAnnotationSearchCriteria(docVersionList, stepTypeList, annotationTypeList, searchString, caseSensitive));
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListAnnotationSearchCriteria(docVersionList, stepTypeList, annotationTypeList, searchString, caseSensitive, unitPrefix));
ItemInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
@ -2896,13 +2920,21 @@ namespace VEPROMS.CSLA.Library
get { return _CaseSensitive; }
set { _CaseSensitive = value; }
}
public ItemListAnnotationSearchCriteria(string docVersionList, string stepTypeList, string annotationTypeList, string searchString, bool caseSensitive)
private string _UnitPrefix;
public string UnitPrefix
{
get { return _UnitPrefix; }
set { _UnitPrefix = value; }
}
public ItemListAnnotationSearchCriteria(string docVersionList, string stepTypeList, string annotationTypeList, string searchString, bool caseSensitive, string unitPrefix)
{
_DocVersionList = docVersionList;
_StepTypeList = stepTypeList;
_AnnotationTypeList = annotationTypeList;
_SearchString = searchString;
_CaseSensitive = caseSensitive;
_UnitPrefix = unitPrefix;
}
}
private void DataPortal_Fetch(ItemListAnnotationSearchCriteria criteria)
@ -2921,6 +2953,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@AnnotationTypeList", criteria.AnnotationTypeList);
cm.Parameters.AddWithValue("@SearchString", criteria.SearchString);
cm.Parameters.AddWithValue("@CaseSensitive", criteria.CaseSensitive ? 1 : 0);
cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
while (dr.Read())

View File

@ -479,7 +479,13 @@ namespace VEPROMS.CSLA.Library
private static bool AddTransitionProcNum(TransitionBuilder tb) // Coded for HLP
{
string retstr = tb._ToItem.MyProcedure.MyContent.Number;
// LATER: start with UnitSpecific procedure number.
// start with UnitSpecific procedure number.
string unitnum = tb._ToItem.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber;
if (unitnum.Length > 0)
{
unitnum = unitnum.Replace("-", @"\u8209?");
retstr = unitnum.Replace("#", retstr);
}
// LATER: Format Flag TruncateProcNmAfter1stSpace (dropped plants)
// LATER: Format Flag HardSpTranProcNumb (active plants)
tb.AppendPrefix();