Пример #1
0
        /// <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);
                    }
                }
            }
        }
Пример #2
0
        /// <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);
                    }
                }
            }
        }
Пример #3
0
        /// <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);
        }
Пример #4
0
 /// <summary>
 /// Remove a given snapshot from snapshot list.
 /// </summary>
 /// <param name="report">Report associated with snapshot</param>
 /// <param name="snapshotId">snapshot id to remove</param>
 public void RemoveSnapshot(string report, string snapshotId)
 {
     lock (objectlock)
     {
         RndReportInfo repInfo = ReportsInfo[report];
         if (repInfo.Snapshots.Contains(snapshotId))
         {
             repInfo.Snapshots.Remove(snapshotId);
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Add a new snapshot to snapshot list
 /// </summary>
 /// <param name="report">Report associated with snapshot</param>
 /// <param name="snapshotId">Snapshot to add</param>
 public void AddSnapshot(string report, string snapshotId)
 {
     lock (objectlock)
     {
         RndReportInfo repInfo = ReportsInfo[report];
         if (!repInfo.Snapshots.Contains(snapshotId))
         {
             repInfo.Snapshots.Add(snapshotId);
         }
         else
         {
             // already exists.
         }
     }
 }
        public void RndListReportSnapshots()
        {
            IContentManager instance  = this.ContentManager;
            string          rndReport = GetOrCreateNextReport();

            RSItemHistorySnapshot[] snapshots = null;
            RndReportInfo           repInfo   = null;

            if (!string.IsNullOrEmpty(rndReport))
            {
                snapshots = instance.SoapAccessor.Management.ListItemHistory(rndReport);
                repInfo   = instance.RndContentManager.GetReportInfo(rndReport);
                if (snapshots.Count() != repInfo.Snapshots.Count)
                {
                    // no good data, should we fail? Note that somebody could've deleted/added row by now.
                }
            }
        }
Пример #7
0
 /// <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;
             }
         }
     }
 }
        public void RndMoveReport()
        {
            IContentManager instance   = this.ContentManager;
            string          rndReport  = GetOrCreateNextReport();
            string          rndNewName = CreateNewReportName(instance);

            if (!string.IsNullOrEmpty(rndReport))
            {
                if (!rndReport.Contains(rndNewName)) // no dupe
                {
                    int    index         = rndReport.LastIndexOf('/');
                    string newReportPath = string.Format(@"{0}/{1}", rndReport.Substring(0, index), rndNewName);

                    instance.SoapAccessor.Management.MoveItem(rndReport, newReportPath); // move

                    RndReportInfo repInfo = instance.RndContentManager.GetReportInfo(rndReport);
                    repInfo.ItemPath = newReportPath;
                    instance.RndContentManager.RemoveReport(rndReport);
                    instance.RndContentManager.AddReportInfo(repInfo);
                }
            }
        }