logic for Reports (currently just RO Usage reports)

methods for RO Usage Reports
This commit is contained in:
2012-09-13 19:54:26 +00:00
parent cf599335a2
commit 8ffe532d44
3 changed files with 275 additions and 128 deletions

View File

@@ -263,6 +263,28 @@ namespace VEPROMS.CSLA.Library
if (ROID.StartsWith("FFFF")) return "?"; // string.Format("Invalid Unit RO '{0}'", ROID);
return "?"; // string.Format("Invalid RO '{0}'", ROID);
}
// Get the the RO's Accessory Page ID
public string GetRoACID(string ROID16)
{
string ROID = ROID16.Substring(0,12);
if (dicRos == null) ParseIntoDictionary(_ROFst!=null?_ROFst.ROLookup:_ROFstInfo.ROLookup);
// Use the ROID to get the value from the dictionary
if (dicRos.ContainsKey(ROID.ToUpper()))
{
rochild rochld = (rochild)dicRos[ROID.ToUpper()];
if (rochld.value != null && rochld.value != string.Empty)
return rochld.appid;
if (rochld.children != null)
{
foreach (rochild child in rochld.children)
if (child.roid.ToUpper() == ROID16 || (child.roid.EndsWith("0041") && ROID16.EndsWith("0000")))
return child.appid;
// if there isn't a specific match for multi-return values, default to the first child.
return rochld.children[0].appid;
}
}
return ""; // no accessory page ID found
}
public rochild GetRoChild12(string ROID16)
{
string ROID = ROID16.Substring(0, 12);
@@ -304,6 +326,27 @@ namespace VEPROMS.CSLA.Library
} while (roc.ID > 0);
return sb.ToString();
}
// Return the RO Title in a list of strings
// The last item in the list is the actual RO title, the items preceding it are the
// titles of the groups and sub-groups containing the RO
public List<string> GetROTitleAndGroupPath(string ROID)
{
List<string> titlePath = new List<string>();
rochild roc = GetRoChild12(ROID);
//string tmp = roc.title.Replace(roc.appid, "").Replace(roc.value, "").Trim();
string tmp = roc.title.Replace(roc.appid, string.Format("<{0}>",roc.appid)).Trim();
titlePath.Add(tmp);
do
{
string parent = ROID.Substring(0, 4) + string.Format("{0:X8}", roc.ParentID);
roc = GetRoChild12(parent);
if (roc.ID > 0)
titlePath.Add(roc.title);
} while (roc.ID > 0);
titlePath.Reverse();
return titlePath;
}
// The following Method is not correct. It needs to have a RO database id as well as an id. Without that,
// the first RO with a specific id will be found regardless of the RO Database id.
//public rochild GetRoChildFromID(int id)