use DisplayNumber and DisplayText

This commit is contained in:
John Jenko 2009-07-24 21:32:16 +00:00
parent 73407f36d0
commit cf69fdd572
2 changed files with 21 additions and 15 deletions

View File

@ -85,7 +85,7 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo myItem in myEntry.MyContent.ContentItems) foreach (ItemInfo myItem in myEntry.MyContent.ContentItems)
{ {
ItemInfo proc = myItem.MyProcedure; ItemInfo proc = myItem.MyProcedure;
sb.Append(sep + proc.MyContent.Number + " - " + proc.MyContent.Text); sb.Append(sep + proc.DisplayNumber + " - " + proc.DisplayText);
sep = "\r\n "; sep = "\r\n ";
} }
} }

View File

@ -856,9 +856,11 @@ namespace VEPROMS.CSLA.Library
//return string.Format("{0}{1} {2}", (editable == null ? "" : (editable.IsDirty ? "* " : "")), //return string.Format("{0}{1} {2}", (editable == null ? "" : (editable.IsDirty ? "* " : "")),
// (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : MyContent.Number), MyContent.Text); // (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : MyContent.Number), MyContent.Text);
ContentInfo cont = MyContent; ContentInfo cont = MyContent;
string number = cont.Number; //string number = cont.Number;
string number = DisplayNumber;
if (cont.Type >= 20000) number = Ordinal.ToString() + "."; if (cont.Type >= 20000) number = Ordinal.ToString() + ".";
return string.Format("{0} {1}", number, cont.Text).Trim(); return string.Format("{0} {1}", number, DisplayText).Trim();
//return string.Format("{0} {1}", number, cont.Text).Trim();
//return string.Format("{0} {1}", cont.Number, cont.Text); //return string.Format("{0} {1}", cont.Number, cont.Text);
//return "Now is the time for all good men to come to the aid of their country!"; //return "Now is the time for all good men to come to the aid of their country!";
} }
@ -882,7 +884,7 @@ namespace VEPROMS.CSLA.Library
} }
public string ShortSearchPath public string ShortSearchPath
{ {
get { return Regex.Replace(_SearchPath, "\x11.*?\x07", "\x07"); } get { return ConvertToDisplayText(Regex.Replace(_SearchPath, "\x11.*?\x07", "\x07")); }
} }
internal int _SearchAnnotationID; internal int _SearchAnnotationID;
public int SearchAnnotationID public int SearchAnnotationID
@ -903,6 +905,10 @@ namespace VEPROMS.CSLA.Library
{ {
get { return ConvertToDisplayText(MyContent.Text); } get { return ConvertToDisplayText(MyContent.Text); }
} }
public string DisplayNumber
{
get { return ConvertToDisplayText(MyContent.Number); }
}
public static string ConvertToDisplayText(string txt) public static string ConvertToDisplayText(string txt)
{ {
string retval = txt; string retval = txt;
@ -960,11 +966,11 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : (nz(MyContent.Number,"")==""? MyContent.Text: MyContent.Number)); string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : (nz(DisplayNumber,"")==""? DisplayText: DisplayNumber));
ItemInfo parent = this; ItemInfo parent = this;
while (parent.MyPrevious != null) parent = parent.MyPrevious; while (parent.MyPrevious != null) parent = parent.MyPrevious;
if (parent.ItemPartCount == 0) if (parent.ItemPartCount == 0)
return number + ", " + MyContent.Text; return number + ", " + DisplayText;
else else
{ {
PartInfo partInfo = parent.ItemParts[0]; PartInfo partInfo = parent.ItemParts[0];
@ -1097,12 +1103,12 @@ namespace VEPROMS.CSLA.Library
get get
{ {
if (MyContent.MyEntry == null) if (MyContent.MyEntry == null)
return MyContent.Number + " - " + MyContent.Text; return DisplayNumber + " - " + DisplayText;
string toolTip = MyProcedure.TabToolTip + "\r\n"; string toolTip = MyProcedure.TabToolTip + "\r\n";
if (MyContent.Number != "") if (MyContent.Number != "")
toolTip += MyContent.Number + " - " + MyContent.Text; toolTip += DisplayNumber + " - " + DisplayText;
else else
toolTip += MyContent.Text; toolTip += DisplayText;
DocumentInfo myDocument = MyContent.MyEntry.MyDocument; DocumentInfo myDocument = MyContent.MyEntry.MyDocument;
if (myDocument.LibTitle != "") if (myDocument.LibTitle != "")
{ {
@ -1117,12 +1123,12 @@ namespace VEPROMS.CSLA.Library
get get
{ {
if (MyContent.MyEntry == null) if (MyContent.MyEntry == null)
return MyContent.Number; return DisplayNumber.Replace("\u2011","-");
if (MyContent.Number != "") if (MyContent.Number != "")
return ((MyContent.MyEntry.MyDocument.LibTitle ?? "")== "" ? "" : "\xA3 ") + MyContent.Number; return ((MyContent.MyEntry.MyDocument.LibTitle ?? "")== "" ? "" : "\xA3 ") + DisplayNumber;
if (MyContent.Text.Length <= 10) if (DisplayText.Length <= 10)
return MyContent.Text; return DisplayText.Replace("\u2011", "-");
return MyContent.Text.Split(" ,.;:-_".ToCharArray())[0] + "..."; return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0]+ "...";
} }
} }
#region IVEReadOnlyItem #region IVEReadOnlyItem
@ -1431,7 +1437,7 @@ namespace VEPROMS.CSLA.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex); throw new DbCslaException("Error on ItemInfoList.GetListFromTextSearch", ex);
} }
} }
[Serializable()] [Serializable()]