Logic to call the function to create the RO Summary Report

Added functions to for use in generating the RO Summary Report
Enabled the RO Summary Report and added logic to support the gathering of information for the report
Added logic to generate the RO Summary Report
This commit is contained in:
2014-12-19 19:46:27 +00:00
parent eec2b3cbae
commit 174bac97f7
4 changed files with 319 additions and 51 deletions

View File

@@ -146,10 +146,12 @@ namespace VEPROMS.CSLA.Library
private int TableID;
private Dictionary<string, rochild> dicRos;
private Dictionary<int, rochild> dicRosIntIDs;
private Dictionary<string, string> dicRoDBs;
public void Reset()
{
dicRos = null;
dicRosIntIDs = null;
dicRoDBs = null;
}
#endregion
#region AppSupport
@@ -160,6 +162,8 @@ namespace VEPROMS.CSLA.Library
dicRosIntIDs = null;
if (dicRos != null)dicRos.Clear();
dicRos = null;
if (dicRoDBs != null) dicRoDBs.Clear();
dicRoDBs = null;
}
private Dictionary<string, string> _dicROAPIDLookup;
public string GetAccPageID(string roid)
@@ -349,9 +353,39 @@ namespace VEPROMS.CSLA.Library
}
return ""; // no accessory page ID found
}
// Get the the RO's Description
public string GetRoDescription(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.title;
if (rochld.children != null)
{
foreach (rochild child in rochld.children)
if (child.roid.ToUpper() == ROID16 || (child.roid.EndsWith("0041") && ROID16.EndsWith("0000")))
return child.title;
// if there isn't a specific match for multi-return values, default to the first child.
return rochld.children[0].title;
}
}
return ""; // no Title/Description found
}
//public string GetRoValueAccIDAndDescription(string ROID16)
//{
// string rtnstr = GetRoValue(ROID16);
// rtnstr += " " + GetRoACID(ROID16);
// rtnstr += " " + GetRoDescription(ROID16);
// return rtnstr;
//}
public rochild GetRoChild12(string ROID16)
{
string ROID = ROID16.Substring(0, 12);
string ROID = (ROID16.Length < 12)?ROID16 : 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()))
@@ -361,6 +395,8 @@ namespace VEPROMS.CSLA.Library
}
rochild tmp = new rochild();
tmp.ID = -1;
if (ROID16.Length == 4)
tmp.title = dicRoDBs[ROID16];
return tmp;
}
public rochild GetRoChild(string ROID)
@@ -440,8 +476,12 @@ namespace VEPROMS.CSLA.Library
{
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();
string tmp = roc.title;
if (roc.appid != "")
if (roc.title.Contains(roc.appid))
tmp = roc.title.Replace(roc.appid, string.Format("<{0}>", roc.appid)).Trim();
else
tmp = string.Format("[{0}] {1}", roc.appid, roc.title);
titlePath.Add(tmp);
do
{
@@ -453,7 +493,26 @@ namespace VEPROMS.CSLA.Library
titlePath.Reverse();
return titlePath;
}
public List<string> GetROTitleAndGroupPathForSummary(string ROID)
{
List<string> titlePath = new List<string>();
rochild roc = GetRoChild(ROID);
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 = GetRoChild(parent);
if (roc.ID > 0)
titlePath.Add(roc.title);
} while (roc.ID > 0);
titlePath.Reverse();
return titlePath;
}
public DateTime GetRoFSTdts()
{
return MyDocVersionInfo.DocVersionAssociations[0].MyROFst.DTS;
}
// 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)
@@ -473,6 +532,42 @@ namespace VEPROMS.CSLA.Library
{
return myHdr.myDbs;
}
public int GetRODatabaseTitleIndex(string roid)
{
rochild roc = GetRoChild12(roid);
int parentID = roc.ParentID;
return Convert.ToInt32("0x"+roid.Substring(0, 4),16);
}
public string GetRODatabaseTitle(string roid)
{
return GetRODatabaseTitle(GetRODatabaseTitleIndex(roid));
}
public string GetRODatabaseTitle(int idx)
{
string dbtitle ="RO Database Title Not Found";
for (int i = 0; i < myHdr.myDbs.Length; i++)
if (myHdr.myDbs[i].dbiID == idx)
{
dbtitle = myHdr.myDbs[i].dbiTitle;
break;
}
return dbtitle;
}
public rodbi GetRODatabase(int idx)
{
for (int i = 0; i < myHdr.myDbs.Length; i++)
if (myHdr.myDbs[i].dbiID == idx)
return myHdr.myDbs[i];
return myHdr.myDbs[0];
}
public rodbi GetRODatabase(string roid)
{
int idx = Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
for (int i = 0; i < myHdr.myDbs.Length; i++)
if (myHdr.myDbs[i].dbiID == idx)
return myHdr.myDbs[i];
return myHdr.myDbs[0];
}
//public string GetDefaultROPrefix()
//{
// if (docVer != null)
@@ -745,6 +840,7 @@ namespace VEPROMS.CSLA.Library
{
if (dicRos == null) dicRos = new Dictionary<string, rochild>();
if (dicRosIntIDs == null) dicRosIntIDs = new Dictionary<int, rochild>();
if (dicRoDBs == null) dicRoDBs = new Dictionary<string, string>();
myHdr.hSize = BitConverter.ToInt32(ab, 0);
myHdr.hYear = BitConverter.ToInt16(ab, 4);
@@ -775,6 +871,7 @@ namespace VEPROMS.CSLA.Library
myHdr.myDbs[i].dbiTitle = Encoding.Default.GetString(ab, iPtr, StringLength(ab, iPtr));
iPtr = BitConverter.ToInt32(ab, offset + 26) + hdrOffset + 6;
myHdr.myDbs[i].dbiAP = Encoding.Default.GetString(ab, iPtr, StringLength(ab, iPtr));
dicRoDBs.Add(string.Format("{0:X4}",TableID), myHdr.myDbs[i].dbiTitle);
}
}
#endregion