Exemple #1
0
 public TaxaForDistributionRegionReport(User user, DistributionRegion distRegion, int taxonId = -1) : base(user)
 {
     this.TaxonID            = taxonId;
     this.DistributionRegion = distRegion;
     RegisterViewer(new RTFReportViewerSource());
     var service = new SupportService(user);
 }
Exemple #2
0
        private void AddRegion(DistributionRegionViewModel parent)
        {
            if (parent != null)
            {
                if (!parent.IsExpanded)
                {
                    parent.IsExpanded = true;
                }

                var newRegion = new DistributionRegion {
                    DistRegionName = "<New Distribution Region>", DistRegionParentID = parent.DistRegionID, DistRegionID = -1
                };
                var newVm = new DistributionRegionViewModel(newRegion);
                newVm.Parent = parent;
                parent.Children.Add(newVm);

                newVm.IsSelected = true;
                newVm.IsRenaming = true;

                RegisterPendingChange(new InsertDistributionRegionCommand(newRegion, parent.Model));
            }
            else
            {
                var newRegion = new DistributionRegion {
                    DistRegionName = "<New Distribution Region>", DistRegionParentID = 0, DistRegionID = -1
                };
                var newVm = new DistributionRegionViewModel(newRegion);
                RegionsModel.Add(newVm);

                newVm.IsSelected = true;
                newVm.IsRenaming = true;

                RegisterPendingChange(new InsertDistributionRegionCommand(newRegion, null));
            }
        }
        private void ExportChildRegions(DistributionRegion parent, DataMatrix matrix)
        {
            // First add a row for this parent...
            var row = matrix.AddRow();

            row[0] = Service.GetDistributionFullPath(parent.DistRegionID);
            // Than add any direct children recursively
            if (parent.NumChildren > 0)
            {
                var list = Service.GetDistributionRegions(parent.DistRegionID);
                if (list != null && list.Count > 0)
                {
                    list.ForEach((region) => {
                        ExportChildRegions(region, matrix);
                    });
                }
            }
        }