Sort ROs in Groups

Use generic comparison from DisplayRO to sort ROs
Make GreaterValue public so that it can be used for DisplayReports and DisplaySearch to sort ROs consistently.
Remove debug printout
This commit is contained in:
Rich
2014-02-06 18:36:57 +00:00
parent 5e621b46a6
commit 4fd9ef75c4
4 changed files with 30 additions and 24 deletions

View File

@@ -608,7 +608,9 @@ namespace Volian.Controls.Library
tmp.Text = chld[i].title;
tmp.Tag = chld[i];
tmp.CheckBoxVisible = true;
tn.Nodes.Add(tmp);
int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp);
//tn.Nodes.Add(tmp);
DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node();
sub.Text = "VLN_DUMMY_FOR_TREE";
tmp.Nodes.Add(sub);
@@ -676,18 +678,19 @@ namespace Volian.Controls.Library
}
return index;
}
private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?");
//private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?");
private bool GreaterValue(string value1, string value2)
{
Match match1 = _RegExGetNumber.Match(value1);
Match match2 = _RegExGetNumber.Match(value2);
if (match1.Success && match2.Success) // Compare the numeric value
{
double dbl1 = double.Parse(match1.ToString());
double dbl2 = double.Parse(match2.ToString());
return dbl1 > dbl2;
}
return String.Compare(value1, value2, true) > 0;
return DisplayRO.GreaterValue(value1, value2);
// Match match1 = _RegExGetNumber.Match(value1);
// Match match2 = _RegExGetNumber.Match(value2);
// if (match1.Success && match2.Success) // Compare the numeric value
// {
// double dbl1 = double.Parse(match1.ToString());
// double dbl2 = double.Parse(match2.ToString());
// return dbl1 > dbl2;
// }
// return String.Compare(value1, value2, true) > 0;
}