/// <summary> /// Add or replace Report Info /// If exists, replace existing item with fresh object. /// If new, create one and add to the list. /// Replace should not come to play, but if neeeded here it is /// </summary> /// <param name="reportPath">Report to add to list</param> public void AddOrReplaceReport(string reportPath) { RndReportInfo repInfo = new RndReportInfo(reportPath, false, false); lock (objectlock) { if (Reports.Contains(reportPath)) { if (ReportsInfo.ContainsKey(reportPath)) { ReportsInfo[repInfo.ItemPath] = repInfo; } } else { Reports.Add(reportPath); if (ReportsInfo.ContainsKey(reportPath)) { ReportsInfo[repInfo.ItemPath] = repInfo; } else { ReportsInfo.Add(reportPath, repInfo); } } } }
/// <summary> /// Add report info to the list as well as to Reports List /// </summary> /// <param name="info">Report Information Object</param> public void AddReportInfo(RndReportInfo info) { string reportPath = info.ItemPath; lock (objectlock) { if (Reports.Contains(reportPath)) { if (ReportsInfo.ContainsKey(reportPath)) { ReportsInfo[reportPath] = info; } } else { if (ReportsInfo.ContainsKey(reportPath)) { ReportsInfo[reportPath] = info; } else { ReportsInfo.Add(reportPath, info); } } } }
/// <summary> /// Get Report Info for given report /// </summary> /// <param name="reportPath">Report Item to get info</param> /// <returns>RndReportInfo object or null</returns> public RndReportInfo GetReportInfo(string reportPath) { RndReportInfo reportInfo = null; if (ReportsInfo.ContainsKey(reportPath)) { reportInfo = ReportsInfo[reportPath]; } return(reportInfo); }
/// <summary> /// Remove report from the list /// </summary> /// <param name="reportPath">report to remove</param> public void RemoveReport(string reportPath) { lock (objectlock) { if (Reports.Contains(reportPath)) { Reports.Remove(reportPath); } if (ReportsInfo.ContainsKey(reportPath)) { ReportsInfo.Remove(reportPath); } } }
/// <summary> /// Update report information. /// If aleady exists, just replace, else add /// </summary> /// <param name="repInfo">Report Information</param> public void UpdateReport(RndReportInfo repInfo) { lock (objectlock) { if (!Reports.Contains(repInfo.ItemPath)) { Reports.Add(repInfo.ItemPath); ReportsInfo.Add(repInfo.ItemPath, repInfo); } else { if (ReportsInfo.ContainsKey(repInfo.ItemPath)) { ReportsInfo[repInfo.ItemPath] = repInfo; } } } }