Esempio n. 1
0
        public ReportOrViewSpecList(ReportSpecList oldList)
        {
            RevisionIndex = oldList.RevisionIndex;
            var oldReports       = oldList.Select(item => new ReportOrViewSpec(item));
            var convertedReports = ReportSharing.ConvertAll(oldReports, new SrmDocument(SrmSettingsList.GetDefault()));

            AddRange(convertedReports.Select(view => new ReportOrViewSpec(view)));
            ValidateLoad();
        }
Esempio n. 2
0
        public ReportOrViewSpecList(ReportSpecList oldList)
        {
            RevisionIndex = oldList.RevisionIndex;
            var oldReports       = oldList.Select(item => new ReportOrViewSpec(item));
            var convertedReports = ReportSharing.ConvertAll(oldReports, new SrmDocument(SrmSettingsList.GetDefault()));

            AddRange(convertedReports.Select(view => new ReportOrViewSpec(view)));
            // ReSharper disable once VirtualMemberCallInConstructor
            ValidateLoad();
        }
Esempio n. 3
0
        /// <summary>
        /// Construct a new PersistedViews, migrating over the values from the old ViewSpecList
        /// and ReportSpecList properties.  Views that are in use by an external tool get put in
        /// the External Tools group, and views that are
        /// </summary>
        public PersistedViews(ReportSpecList reportSpecList, ViewSpecList viewSpecList, ToolList toolList)
        {
            var viewItems = new List <ViewSpec>();

            if (null != viewSpecList)
            {
                viewItems.AddRange(viewSpecList.ViewSpecs);
            }
            if (null != reportSpecList)
            {
                RevisionIndex = reportSpecList.RevisionIndex + 1;
                foreach (var newView in ReportSharing.ConvertAll(reportSpecList.Select(reportSpec => new ReportOrViewSpec(reportSpec)),
                                                                 new SrmDocument(SrmSettingsList.GetDefault())))
                {
                    if (viewItems.Any(viewSpec => viewSpec.Name == newView.Name))
                    {
                        continue;
                    }
                    viewItems.Add(newView);
                }
            }
            var viewSpecLists = new Dictionary <ViewGroup, Dictionary <string, ViewSpec> >();

            foreach (var viewItem in viewItems)
            {
                ViewGroup group;
                if (toolList.Any(tool => tool.ReportTitle == viewItem.Name))
                {
                    group = ExternalToolsGroup;
                }
                else
                {
                    group = MainGroup;
                }
                Dictionary <string, ViewSpec> list;
                if (!viewSpecLists.TryGetValue(group, out list))
                {
                    list = new Dictionary <string, ViewSpec>();
                    viewSpecLists.Add(group, list);
                }
                if (!list.ContainsKey(viewItem.Name))
                {
                    list.Add(viewItem.Name, viewItem);
                }
                else
                {
                    for (int i = 1;; i++)
                    {
                        string name = viewItem.Name + i;
                        if (!list.ContainsKey(name))
                        {
                            list.Add(name, viewItem.SetName(name));
                            break;
                        }
                    }
                }
            }
            foreach (var entry in viewSpecLists)
            {
                SetViewSpecList(entry.Key.Id, new ViewSpecList(entry.Value.Values));
            }
            AddDefaults();
        }
Esempio n. 4
0
 /// <summary>
 /// Construct a new PersistedViews, migrating over the values from the old ViewSpecList 
 /// and ReportSpecList properties.  Views that are in use by an external tool get put in
 /// the External Tools group, and views that are
 /// </summary>
 public PersistedViews(ReportSpecList reportSpecList, ViewSpecList viewSpecList, ToolList toolList)
 {
     var viewItems = new List<ViewSpec>();
     if (null != viewSpecList)
     {
         viewItems.AddRange(viewSpecList.ViewSpecs);
     }
     if (null != reportSpecList)
     {
         RevisionIndex = reportSpecList.RevisionIndex + 1;
         foreach (var newView in ReportSharing.ConvertAll(reportSpecList.Select(reportSpec => new ReportOrViewSpec(reportSpec)),
                     new SrmDocument(SrmSettingsList.GetDefault())))
         {
             if (viewItems.Any(viewSpec => viewSpec.Name == newView.Name))
             {
                 continue;
             }
             viewItems.Add(newView);
         }
     }
     var viewSpecLists = new Dictionary<ViewGroup, Dictionary<string, ViewSpec>>();
     foreach (var viewItem in viewItems)
     {
         ViewGroup group;
         if (toolList.Any(tool => tool.ReportTitle == viewItem.Name))
         {
             group = ExternalToolsGroup;
         }
         else
         {
             group = MainGroup;
         }
         Dictionary<string, ViewSpec> list;
         if (!viewSpecLists.TryGetValue(group, out list))
         {
             list = new Dictionary<string, ViewSpec>();
             viewSpecLists.Add(group, list);
         }
         if (!list.ContainsKey(viewItem.Name))
         {
             list.Add(viewItem.Name, viewItem);
         }
         else
         {
             for (int i = 1;; i++)
             {
                 string name = viewItem.Name + i;
                 if (!list.ContainsKey(name))
                 {
                     list.Add(name, viewItem.SetName(name));
                     break;
                 }
             }
         }
     }
     foreach (var entry in viewSpecLists)
     {
         SetViewSpecList(entry.Key.Id, new ViewSpecList(entry.Value.Values));
     }
     AddDefaults();
 }