コード例 #1
0
 public void Add_Filter_Data()
 {
     IUserContext userContext = CoreData.UserManager.GetCurrentUser();
     var          viewManager = new SpeciesObservationFieldDescriptionViewManager(userContext, SessionHandler.MySettings);
     SpeciesObservationFieldDescriptionsViewModel viewModel = viewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
     var dic  = viewModel.FieldDescriptionsByImportance;
     var dic2 = viewModel.FieldDescriptionsByClass;
 }
        /// <summary>
        /// Get only searchable fields.
        /// </summary>
        /// <returns>Dictionary that contains class relations to lists of ISpeciesObservationFieldDescription.</returns>
        private Dictionary <String, List <ISpeciesObservationFieldDescription> > GetSearchableFields()
        {
            IUserContext userContext = CoreData.UserManager.GetCurrentUser();
            var          viewManager = new SpeciesObservationFieldDescriptionViewManager(userContext, SessionHandler.MySettings);
            SpeciesObservationFieldDescriptionsViewModel viewModel = viewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
            var fieldDescriptions = viewModel.SearchableFieldDescriptionsByClass;

            return(fieldDescriptions);
        }
        public void GetTaxonTree_CarnivoraTaxon_GetTree()
        {
            // Arrange
            LoginApplicationUser();
            var viewManager = new SpeciesObservationFieldDescriptionViewManager(SessionHandler.UserContext, SessionHandler.MySettings);

            // Act
            SpeciesObservationFieldDescriptionsViewModel model = viewManager.CreateSpeciesObservationFieldDescriptionsViewModel();

            // Assert
            Assert.IsNotNull(model.FieldDescriptionsByProjectName);
        }
コード例 #4
0
        public List <Dictionary <string, string> > GetTablePagedResultInBbox(int start, int pageSize, double bottom, double left, double right, double top)
        {
            Polygon bbox = GetPolygon(bottom, left, right, top);
            SpeciesObservationList speciesObservationList = GetPagedSpeciesObservationList(start, pageSize, null, bbox);
            var fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(UserContext, MySettings);
            var fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
            SpeciesObservationsData speciesObservationsData = new SpeciesObservationsData(speciesObservationList, fieldDescriptionsViewModel);
            var viewManager = new SpeciesObservationTableViewManager(UserContext, MySettings);
            ViewTableViewModel viewModel                  = viewManager.CreateViewTableViewModel();
            var speciesObservationDataManager             = new SpeciesObservationDataManager(UserContext, MySettings);
            List <Dictionary <string, string> > dicResult = speciesObservationDataManager.GetObservationsDataList(speciesObservationsData.SpeciesObservationViewModels, viewModel.TableFields);

            return(dicResult);
        }
        private SpeciesObservationsData CreateSpeciesObservationData(IUserContext userContext, AnalysisPortal.MySettings.MySettings mySettings)
        {
            SpeciesObservation speciesObservation = new SpeciesObservation();

            speciesObservation.Taxon         = new SpeciesObservationTaxon();
            speciesObservation.Taxon.TaxonID = "1";
            SpeciesObservationList speciesObservationList = new SpeciesObservationList();

            speciesObservationList.Add(speciesObservation);
            var fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(userContext, mySettings);
            var fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
            SpeciesObservationsData speciesObservationsData = new SpeciesObservationsData(speciesObservationList, fieldDescriptionsViewModel);

            return(speciesObservationsData);
        }
コード例 #6
0
        private static SpeciesObservationsData CreateSpeciesObservationDataSample()
        {
            SpeciesObservation      speciesObservation;
            SpeciesObservationList  speciesObservationList;
            SpeciesObservationsData speciesObservationsData;

            speciesObservation               = new SpeciesObservation();
            speciesObservation.Taxon         = new SpeciesObservationTaxon();
            speciesObservation.Taxon.TaxonID = "27";
            speciesObservationList           = new SpeciesObservationList();
            speciesObservationList.Add(speciesObservation);
            var fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(SessionHandler.UserContext, SessionHandler.MySettings);
            var fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();

            speciesObservationsData = new SpeciesObservationsData(speciesObservationList, fieldDescriptionsViewModel);
            return(speciesObservationsData);
        }
コード例 #7
0
        public SpeciesObservationsData CalculateSpeciesObservations(CoordinateSystemId displayCoordinateSystemId)
        {
            var displayCoordinateSystem = new CoordinateSystem(displayCoordinateSystemId);
            var searchCriteriaManager   = new SpeciesObservationSearchCriteriaManager(UserContext);
            var searchCriteria          = searchCriteriaManager.CreateSearchCriteria(MySettings, displayCoordinateSystem);

            if (UserContext.CurrentRole.IsNull() && UserContext.CurrentRoles.Count > 0)
            {
                UserContext.CurrentRole = UserContext.CurrentRoles[0];
            }

            var speciesObservationList      = CoreData.SpeciesObservationManager.GetSpeciesObservations(UserContext, searchCriteria, displayCoordinateSystem);
            var fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(UserContext, MySettings);
            var fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
            var speciesObservationsData     = new SpeciesObservationsData(speciesObservationList, fieldDescriptionsViewModel);

            return(speciesObservationsData);
        }
コード例 #8
0
        public List <ResultObservationsListItem> GetTablePagedResultInBboxAsItems(int start, int pageSize, double bottom, double left, double right, double top)
        {
            Polygon bbox = GetPolygon(bottom, left, right, top);
            SpeciesObservationList speciesObservationList = GetPagedSpeciesObservationList(start, pageSize, null, bbox);
            var fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(UserContext, MySettings);
            var fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
            SpeciesObservationsData speciesObservationsData = new SpeciesObservationsData(speciesObservationList, fieldDescriptionsViewModel);

            List <ResultObservationsListItem> list = new List <ResultObservationsListItem>();

            foreach (SpeciesObservationViewModel speciesObservationViewModel in speciesObservationsData.SpeciesObservationViewModels)
            {
                list.Add(ResultObservationsListItem.Create(speciesObservationViewModel));
            }

            return(list);
            //speciesObservationsData.SpeciesObservationViewModels
            //var viewManager = new SpeciesObservationTableViewManager(UserContext, MySettings);
            //ViewTableViewModel viewModel = viewManager.CreateViewTableViewModel();
            //var speciesObservationDataManager = new SpeciesObservationDataManager(UserContext, MySettings);
            //List<Dictionary<string, string>> dicResult = speciesObservationDataManager.GetObservationsDataList(speciesObservationsData.SpeciesObservationViewModels, viewModel.TableFields);
            //return dicResult;
        }
コード例 #9
0
        public List <Dictionary <string, string> > GetTablePagedResult(int start, int pageSize)
        {
            SpeciesObservationFieldDescriptionViewManager fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(UserContext, MySettings);
            SpeciesObservationFieldDescriptionsViewModel  fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();
            SpeciesObservationList  speciesObservationList  = GetPagedSpeciesObservationList(start, pageSize, null, null);
            SpeciesObservationsData speciesObservationsData = new SpeciesObservationsData(speciesObservationList, fieldDescriptionsViewModel);
            var viewManager = new SpeciesObservationTableViewManager(UserContext, MySettings);
            ViewTableViewModel viewModel                  = viewManager.CreateViewTableViewModel();
            var speciesObservationDataManager             = new SpeciesObservationDataManager(UserContext, MySettings);
            List <Dictionary <string, string> > dicResult = speciesObservationDataManager.GetObservationsDataList(speciesObservationsData.SpeciesObservationViewModels, viewModel.TableFields);

            return(dicResult);
        }
        /// <summary>
        /// Gets the species observation view model.
        /// </summary>
        /// <param name="observationId">The observation id.</param>
        /// <returns>A species observation view model.</returns>
        public SpeciesObservationViewModel GetSpeciesObservationViewModel(int observationId)
        {
            var         displayCoordinateSystem = mySettings.Presentation.Map.DisplayCoordinateSystem;
            List <long> speciesObservationIds   = new List <long> {
                observationId
            };
            SpeciesObservationList speciesObservationList = CoreData.SpeciesObservationManager.GetSpeciesObservations(userContext, speciesObservationIds, displayCoordinateSystem);
            SpeciesObservationFieldDescriptionViewManager fieldDescriptionViewManager = new SpeciesObservationFieldDescriptionViewManager(userContext, mySettings);
            SpeciesObservationFieldDescriptionsViewModel  fieldDescriptionsViewModel  = fieldDescriptionViewManager.CreateSpeciesObservationFieldDescriptionsViewModel();

            if (speciesObservationList.Count > 0)
            {
                ISpeciesObservation         speciesObservation          = speciesObservationList[0];
                SpeciesObservationViewModel speciesObservationViewModel =
                    SpeciesObservationViewModel.CreateFromSpeciesObservation(speciesObservation, fieldDescriptionsViewModel);
                return(speciesObservationViewModel);
            }

            return(null);
        }