public IDictionary<string, object> GetExtendedData()
{
_kpiDataList = new List<KPIData>();
var kpiDataDict = new Dictionary<string, object>();
var kpiXmlValue = new XmlDocument();
try
{
if (!string.IsNullOrEmpty(this.KPIData))
kpiXmlValue.LoadXml(this.KPIData);
}
catch (Exception ex)
{
Logger.WriteException(ex);
}
var kpiDataNodes = kpiXmlValue.SelectNodes("KPI/data");
if (kpiDataNodes != null)
{
foreach (XmlNode kpiDataNode in kpiDataNodes)
{
var key = kpiDataNode.Attributes["Label"] == null ? string.Empty : kpiDataNode.Attributes["Label"].Value;
if (string.IsNullOrEmpty(key) || kpiDataDict.ContainsKey(key))
continue;
var goal = kpiDataNode.SelectSingleNode("goal");
var actual = kpiDataNode.SelectSingleNode("actual");
if (goal == null || actual == null)
continue;
int goalValue;
int actualValue;
if (!int.TryParse(goal.InnerText, out goalValue) || !int.TryParse(actual.InnerText, out actualValue))
continue;
var kpiData = new KPIData(key, goalValue, actualValue);
kpiDataDict.Add(key, kpiData);
_kpiDataList.Add(kpiData);
}
}
return kpiDataDict;
}