public ReviewObservation(FiftyMeterPointSurvey survey, FiftyMeterDataEntry entry, IUserStateManager state, IGlobalMap globalMap)
        {
            State     = state;
            DataEntry = entry;

            SamplingPointName =
                state.PointsRemaining.Union(state.PointsCompleted).Single(x => x.Id.Equals(survey.LocationId)).Name;

            Species species = globalMap.SpeciesList.Find(x => x.AlphaCode.Equals(entry.SpeciesCode));

            if (species == null)
            {
                Warning = "Unknown species code. ";
            }
            else
            {
                SpeciesName = species.CommonName;

                if (entry.CountBeyond50 > species.WarningCount)
                {
                    Warning += "Unusually high count beyond 50m, please verify. ";
                }
                if (entry.CountWithin50 > species.WarningCount)
                {
                    Warning += "Unusually high count within 50m, please verify. ";
                }
            }
        }
 public UserStateController(IUserStateManager userStateManager, INowProvider nowProvider, IAccountRepository accountRepository, ITimeWarpAuthenticationManager authenticationManager)
 {
     _userStateManager      = userStateManager;
     _nowProvider           = nowProvider;
     _accountRepository     = accountRepository;
     _authenticationManager = authenticationManager;
 }
Example #3
0
 public RoomStateController(IUserStateManager userStateManager, IRoomRepository rooms, IRoomRemovalPolicy roomRemovalPolicy, INowProvider nowProvider)
 {
     _userStateManager  = userStateManager;
     _rooms             = rooms;
     _roomRemovalPolicy = roomRemovalPolicy;
     _nowProvider       = nowProvider;
 }
Example #4
0
        public ReportHelperInfo(IApplicationHost host)
        {
            _host = host;
            IServiceLocator locator = host.Locator;

            _dbContext        = locator.GetService <IDbContext>() ?? throw new ArgumentNullException(nameof(_dbContext));
            _localizer        = locator.GetService <ILocalizer>() ?? throw new ArgumentNullException(nameof(_localizer));
            _userStateManager = locator.GetServiceOrNull <IUserStateManager>() ?? throw new ArgumentNullException(nameof(_userStateManager));
        }
Example #5
0
        public AccountController()
        {
            // DI ready
            var serviceLocator = ServiceLocator.Current;

            _host             = serviceLocator.GetService <IApplicationHost>();
            _dbContext        = serviceLocator.GetService <IDbContext>();
            _localizer        = serviceLocator.GetService <ILocalizer>();
            _userStateManager = serviceLocator.GetService <IUserStateManager>();
            _host.StartApplication(false);
        }
        public static List <ReviewSupplemental> GetReviewSupplementalList(IUserStateManager state, IGlobalMap globalMap)
        {
            // TODO: use of state should be moved to a presenter class

            List <ReviewSupplemental> reviewList = new List <ReviewSupplemental>();

            state.SiteVisit.SupplementalObservations.ForEach(x =>
            {
                reviewList.Add(new ReviewSupplemental(x, globalMap));
            });

            return(reviewList);
        }
Example #7
0
        public BaseController()
        {
            // DI ready
            IServiceLocator locator = ServiceLocator.Current;

            _host             = locator.GetService <IApplicationHost>();
            _dbContext        = locator.GetService <IDbContext>();
            _renderer         = locator.GetServiceOrNull <IRenderer>();
            _workflowEngine   = locator.GetServiceOrNull <IWorkflowEngine>();
            _localizer        = locator.GetService <ILocalizer>();
            _scripter         = locator.GetService <IDataScripter>();
            _messageService   = locator.GetServiceOrNull <IMessageService>();
            _userStateManager = locator.GetServiceOrNull <IUserStateManager>();
        }
Example #8
0
 public BaseController(IServiceLocator currentLocator = null)
 {
     // DI ready
     _locator              = currentLocator ?? ServiceLocator.Current;
     _host                 = _locator.GetService <IApplicationHost>();
     _dbContext            = _locator.GetService <IDbContext>();
     _renderer             = _locator.GetServiceOrNull <IRenderer>();
     _workflowEngine       = _locator.GetServiceOrNull <IWorkflowEngine>();
     _localizer            = _locator.GetService <ILocalizer>();
     _scripter             = _locator.GetService <IDataScripter>();
     _messageService       = _locator.GetServiceOrNull <IMessageService>();
     _userStateManager     = _locator.GetServiceOrNull <IUserStateManager>();
     _externalDataProvider = _locator.GetServiceOrNull <IExternalDataProvider>();
     _tokenProvider        = _locator.GetService <ITokenProvider>();
     _userLocale           = _locator.GetService <IUserLocale>();
 }
        /// <summary>
        /// Factory method to build and retrieve all observation information for a particular site visit, for use on the review page.
        /// </summary>
        /// <returns></returns>
        public static List <ReviewObservation> GetReviewList(IUserStateManager state, IGlobalMap globalMap)
        {
            // TODO: use of state should be moved to a presenter class
            List <ReviewObservation> reviewList = new List <ReviewObservation>();

            state.SiteVisit.PointSurveys.OrderBy(x => x.StartTimeStamp).ToList().ForEach(x =>
            {
                List <FiftyMeterDataEntry> entryList = new List <FiftyMeterDataEntry>();
                FiftyMeterDataEntryFactory.CreateEntriesFromPointCounts <PointCountBeyond50>(
                    x.Observations.OfType <PointCountBeyond50>().ToList <PointCountBeyond50>(), entryList);
                FiftyMeterDataEntryFactory.CreateEntriesFromPointCounts <PointCountWithin50>(
                    x.Observations.OfType <PointCountWithin50>().ToList <PointCountWithin50>(), entryList);

                entryList.ForEach(y =>
                {
                    reviewList.Add(new ReviewObservation(x, y, state, globalMap));
                });
            });

            return(reviewList.OrderBy(x => x.SamplingPointName).ToList());
        }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SupplementalObservationFacade"/> class.
 /// </summary>
 /// <param name="state">The state.</param>
 public SupplementalObservationFacade(IUserStateManager state)
 {
     // TODO: use of state should be moved to a presenter class
     _state = state;
 }
 /// <summary>
 /// Fifties the meter data entry.
 /// </summary>
 /// <param name="_state">The _state.</param>
 public FiftyMeterDataEntryFacade(IUserStateManager state)
 {
     // TODO: use of state should be moved to a presenter class
     _state = state;
 }
 public ApprovalCodeManager(IUserStateManager pStateManager)
 {
     _stateManager = pStateManager;
 }
Example #13
0
 public SiteConditionsPresenterTss SetUserState(IUserStateManager userState)
 {
     base.UserState = userState;
     return(this);
 }