コード例 #1
0
        public ServeService(IContactRepository contactService,
                            IContactRelationshipRepository contactRelationshipService,
                            IOpportunityRepository opportunityService,
                            MinistryPlatform.Translation.Repositories.Interfaces.IEventRepository eventService,
                            IParticipantRepository participantService,
                            IGroupParticipantRepository groupParticipantService,
                            IGroupRepository groupService,
                            ICommunicationRepository communicationService,
                            IAuthenticationRepository authenticationService,
                            IConfigurationWrapper configurationWrapper,
                            IApiUserRepository apiUserService,
                            IResponseRepository responseService)
        {
            _contactService             = contactService;
            _contactRelationshipService = contactRelationshipService;
            _opportunityService         = opportunityService;
            _eventService            = eventService;
            _participantService      = participantService;
            _groupParticipantService = groupParticipantService;
            _groupService            = groupService;
            _communicationService    = communicationService;
            _authenticationService   = authenticationService;
            _configurationWrapper    = configurationWrapper;
            _apiUserService          = apiUserService;
            _responseService         = responseService;
            _serveGroupType          = _configurationWrapper.GetConfigIntValue("ServeGroupType");

            _rsvpYes = _configurationWrapper.GetConfigIntValue("RSVPYesId");
        }
コード例 #2
0
 public ArticleController(IBaseService <article> baseService, IArticleRepository articleRepository, IRequestRepository requestRepository, IResponseRepository responseRepository) : base(baseService)
 {
     _baseService        = baseService;
     _articleRepository  = articleRepository;
     _requestRepository  = requestRepository;
     _responseRepository = responseRepository;
 }
コード例 #3
0
 public ResponseService(
     IResponseRepository responseRepository,
     IMapper mapper)
 {
     _responseRepository = responseRepository;
     _mapper             = mapper;
 }
 public OrchestratorEventBusServiceBusMessageProcessor(ILogger logger, IEventBusMessagePublisher messagePublisher,
                                                       IResponseRepository responseRepository, INotificationService notificationService)
 {
     this._logger              = logger;
     this._messagePublisher    = messagePublisher;
     this._responseRepository  = responseRepository;
     this._notificationService = notificationService;
 }
コード例 #5
0
 public NsSafeRebusResponseMessageHandler(
     ILogger <NsSafeRebusResponseMessageHandler> logger,
     IResponseRepository responseRepository,
     IDbProvider dbProvider)
 {
     Logger             = logger;
     ResponseRepository = responseRepository;
     DbProvider         = dbProvider;
 }
コード例 #6
0
        /// <summary>
        /// the constructor for this form that fills a calendar with existing data from the API and the business logic from planting days
        /// </summary>
        /// <param name="responseRepository"></param>
        public FormCustomizePlantingDays(IResponseRepository responseRepository)
        {
            _responseRepository = responseRepository;

            InitializeComponent();

            SetBlankCalendar();

            AutoFillPlantingDays();
        }
コード例 #7
0
        /// <summary>
        /// nullifies the response repository, and refreshes the data from the API, saving the new data to a newly instantiated repository, then assigns rainy day logic
        /// </summary>
        private void RefreshApiPull()
        {
            InitializeDataFileXML.PullDataApi();

            _responseRepository = null;

            _responseRepository = new ResponseRepositoryXML();

            AssignRainyDays();
        }
コード例 #8
0
        private static async Task AssertReceivedResponses(this IResponseRepository responseRepository, Guid[] responseIds)
        {
            var savedResponseIds = (await responseRepository.SelectResponses(responseIds))
                                   .Select(response => response.Id).ToArray();

            foreach (var responseId in responseIds)
            {
                savedResponseIds.Should().Contain(responseId);
            }
        }
コード例 #9
0
 public ResponsesController(IResponseRepository thisRepo = null)
 {
     if (thisRepo == null)
     {
         this.responseRepo = new EFResponseRepository();
     }
     else
     {
         this.responseRepo = thisRepo;
     }
 }
コード例 #10
0
 public NServiceBusHost(
     ILogger <NServiceBusHost> logger,
     IConfiguration configuration,
     IEndpointInstance endpointInstance,
     IResponseRepository responseRepository)
 {
     Logger             = logger;
     Configuration      = configuration;
     EndpointInstance   = endpointInstance;
     ResponseRepository = responseRepository;
 }
コード例 #11
0
        /*private IElasticClient _elasticClient;*/

        public AdminController(IConfiguration config, IFeedbackRepository feedbackRepository, IQuestionRepository questionRepository,
                               IResponseRepository responseRepository, IEquipmentRepository equipmentRepository, IEquipmentGroup equipmentGroup)
        {
            _config              = config;
            _feedbackRepository  = feedbackRepository;
            _questionRepository  = questionRepository;
            _responseRepository  = responseRepository;
            _equipmentRepository = equipmentRepository;
            _equipmentGroup      = equipmentGroup;
            /*  _elasticClient = elasticClient;*/
        }
コード例 #12
0
        /// <summary>
        /// This refreshes the data and initializes the form with a calendar using the days from the forecast, but leaving the contents empty to allow the user to click on a Get Weather button themselves
        /// </summary>
        private void FreshApiPullGetWeather()
        {
            InitializeDataFileXML.PullDataApi();

            _responseRepository = null;

            _responseRepository = new ResponseRepositoryXML();

            InitializeComponent();

            SetBlankCalendar();
        }
コード例 #13
0
 public FeedBackController(IMapper mapper,
                           ISurveyRepository surveyRepository,
                           ITokenRepository tokenRepository,
                           IQuestionOptionRepository questionOptionRepository,
                           IResponseRepository responseRepository)
 {
     _mapper                   = mapper;
     _surveyRepository         = surveyRepository;
     _tokenRepository          = tokenRepository;
     _questionOptionRepository = questionOptionRepository;
     _responseRepository       = responseRepository;
 }
コード例 #14
0
 public ResponseService(
     IResponseRepository responseRepository,
     ICommentRepository commentRepository,
     ILogger <ResponseService> logger,
     ISessionService sessionService,
     ILikeRepository <Response> likeRepository)
 {
     _responseRepository = responseRepository;
     _commentRepository  = commentRepository;
     _logger             = logger;
     _sessionService     = sessionService;
     _likeRepository     = likeRepository;
 }
コード例 #15
0
 public SafeRebusHost(
     ILogger <SafeRebusHost> logger,
     IBus bus,
     IRabbitMqUtility rabbitMqUtility,
     IConfiguration configuration,
     IResponseRepository responseRepository)
 {
     Logger             = logger;
     Bus                = bus;
     RabbitMqUtility    = rabbitMqUtility;
     Configuration      = configuration;
     ResponseRepository = responseRepository;
 }
コード例 #16
0
        public AutoResponderService(IMailboxConfiguration mailboxConfiguration, 
                                    IEmailProvider emailProvider, 
                                    IResponseRepository responseRepository, 
                                    ITemplateRepository templateRepository, 
                                    IReferenceGenerator referenceGenerator, 
                                    IAutoResponseServiceSettings autoResponseServiceSettings)
        {
            Check.If(mailboxConfiguration).IsNotNull();
            Check.If(emailProvider).IsNotNull();
            Check.If(responseRepository).IsNotNull();
            Check.If(templateRepository).IsNotNull();
            Check.If(referenceGenerator).IsNotNull();
            Check.If(autoResponseServiceSettings).IsNotNull();

            _mailboxConfiguration = mailboxConfiguration;
            _emailProvider = emailProvider;
            _responseRepository = responseRepository;
            _templateRepository = templateRepository;
            _referenceGenerator = referenceGenerator;
            _autoResponseServiceSettings = autoResponseServiceSettings;
        }
コード例 #17
0
        public IResponseRepository Create(string connectionString, string clientName, string environment)
        {
            string key = connectionString.ToUpper() + "|" + clientName.ToUpper() + "|" + environment.ToUpper();
            IResponseRepository repo = null;

            if (repositories.TryGetValue(key, out repo))
            {
                return(repo);
            }

            // we need to create a new one
            lock (_lock)
            {
                if (repositories.TryGetValue(key, out repo))
                {
                    return(repo);
                }
                repo = new ResponseRepository(connectionString, clientName);
                repositories.Add(key, repo);
            }

            return(repo);
        }
コード例 #18
0
 public ResponseModelCollectionProcessor(IResponseRepository repo)
 {
     _repo = repo;
 }
コード例 #19
0
 public ResponsesController(IRespondentRepository respondentRepository, IResponseRepository responseRepository, ISurveyRepository surveyRepository)
 {
     this.respondentRepository = respondentRepository;
       this.responseRepository = responseRepository;
       this.surveyRepository = surveyRepository;
 }
コード例 #20
0
        public static Task AssertReceivedResponses(this IResponseRepository responseRepository, SafeRebusRequest[] requests)
        {
            var requestIds = requests.Select(request => request.Id).ToArray();

            return(responseRepository.AssertReceivedResponses(requestIds));
        }
コード例 #21
0
 public ResponsesController(IResponseRepository surveyResponseRepository)
 {
     _surveyResponseRepository = surveyResponseRepository;
 }
コード例 #22
0
 public AdminController(IResponseRepository repo)
 {
     repository = repo;
 }
コード例 #23
0
ファイル: MessageService.cs プロジェクト: tom29739/helpmebot
 /// <summary>
 /// Initialises a new instance of the <see cref="MessageService"/> class.
 /// </summary>
 /// <param name="responseRepository">
 /// The response Repository.
 /// </param>
 public MessageService(IResponseRepository responseRepository)
 {
     this.responseRepository = responseRepository;
     this.random = new Random();
 }
コード例 #24
0
 public ResponsesController(IResponseRepository responseRepository)
 {
     this.responseRepository = responseRepository;
 }
コード例 #25
0
 public HomeController(IResponseRepository repo)
 {
     repository = repo;
 }
コード例 #26
0
 public GeneralCases(IResponseRepository responseRepository)
 {
     this.responseRepository = responseRepository ?? throw new System.ArgumentNullException(nameof(responseRepository));
 }
 public GetOrderResponsesCommandHandler(IResponseRepository repository)
 {
     _repository = repository;
 }
        private void ProcessScore(HttpContext context)
        {
            Interlocked.Increment(ref RequestCount);

            // GET RESPONSE
            ItemScoreResponse itemScoreResponse;

            // Get XML
            using (XmlReader reader = XmlReader.Create(context.Request.InputStream))
            {
                itemScoreResponse = HttpWebHelper.DeserializeXml <ItemScoreResponse>(reader);
                reader.Close();
            }

            // get the context token and deserialize it
            string decryptedToken = GetContextToken(itemScoreResponse);
            ItemScoreRequestContextToken tokenData = null;

            // get test data
            try
            {
                tokenData = JsonHelper.Deserialize <ItemScoreRequestContextToken>(decryptedToken);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("Could not read contextToken: {0},  Error: {1}.", decryptedToken ?? "(null)", ex.Message));
            }

            // create response
            ScoredResponse scoredResponse = new ScoredResponse()
            {
                ItemKey         = tokenData.ItemKey,
                OppKey          = tokenData.oppKey,
                Sequence        = tokenData.reportingVersion ?? -1,
                Score           = itemScoreResponse.Score.ScoreInfo.Points,
                ScoreStatus     = itemScoreResponse.Score.ScoreInfo.Status.ToString(),
                ScoreRationale  = null,
                ScoreDimensions = HttpWebHelper.SerializeXml(itemScoreResponse.Score.ScoreInfo)
            };

            string hubDBIP     = tokenData.TISIP;
            string hubDBName   = tokenData.TISDbName;
            string clientName  = tokenData.clientName;
            string environment = tokenData.environment;

            // create function for submitting scores
            Action submitScore = delegate
            {
                Interlocked.Increment(ref ProgressCount);

                try
                {
                    if (String.IsNullOrEmpty(hubDBIP))
                    {
                        // must be sending items for scoring in the TDSReport format where we don't send
                        //  this information in the context token.  In this case, we can only support a single configured hub.
                        //  Grab the info from that hub.
                        IAdminRepository     cloudRepository = ServiceLocator.Resolve <IAdminRepository>();
                        List <DataStoreInfo> hubs            = cloudRepository.GetMonitoredDataStores(ScoringDaemonSettings.MachineName);
                        hubs = hubs.FindAll(h => h.ClientName == clientName).ToList <DataStoreInfo>();
                        if (hubs.Count == 0)
                        {
                            throw new ApplicationException(String.Format("No hubs are configured for client: {0} on machine: {1}", clientName, ScoringDaemonSettings.MachineName));
                        }
                        if (hubs.Count > 1)
                        {
                            throw new ApplicationException(String.Format("TIS item scoring callback handler only supports a single hub per client for this type of request.  {0} are configured for client: {1}.", hubs.Count, clientName));
                        }
                        hubDBIP     = ScoringDaemonSettings.HubIP(hubs[0]);
                        hubDBName   = hubs[0].DBName;
                        clientName  = hubs[0].ClientName;
                        environment = hubs[0].Environment;
                    }

                    // Save score to DB
                    IResponseRepository responseRepo = ServiceLocator.Resolve <IResponseRespositoryFactory>()
                                                       .Create(ScoringDaemonSettings.HubConnectionString(hubDBIP, hubDBName), clientName, environment);

                    if (responseRepo == null)
                    {
                        // this is really unusual. We got a item score response for an unknown hub.
                        string errorMessage =
                            String.Format(
                                "Got a score response for a hub that we dont monitor. oppKey:{0}, itemKey: {1}, sequence:{2}, clientName: {3}, environment: {4}",
                                scoredResponse.OppKey, scoredResponse.ItemKey, scoredResponse.Sequence, clientName, environment);
                        throw new InvalidDataException(errorMessage);
                    }

                    //run resolution rule if there is one
                    //Zach 12/11/2014 TODO: Add checks or try/catches around each part of running the rule to give more specific error messages?
                    TISItemResolutionRule rule = TISItemResolutionRule.CreateRule(tokenData.itemType, scoredResponse.ItemKey, clientName);
                    if (rule != null)
                    {
                        TDSQASystemAPI.TestResults.ItemScoreInfo resolvedScore = rule.ResolveItemScore(Serialization.DeserializeXml <TDSQASystemAPI.TestResults.ItemScoreInfo>(scoredResponse.ScoreDimensions));
                        scoredResponse.Score           = (int)resolvedScore.Points;
                        scoredResponse.ScoreStatus     = resolvedScore.Status == TDSQASystemAPI.TestResults.ScoringStatus.Scored ? ScoringStatus.Scored.ToString() : ScoringStatus.ScoringError.ToString();
                        scoredResponse.ScoreDimensions = HttpWebHelper.SerializeXml(resolvedScore);
                    }

                    responseRepo.UpdateItemScore(scoredResponse);
                }
                catch (Exception ex)
                {
                    Interlocked.Decrement(ref ProgressCount);
                    Interlocked.Increment(ref ErrorCount);

                    LastError = String.Format("{0} ({1})", ex.Message, DateTime.Now);

                    // wasn't logging the exception.  See TDS.Shared.Logging.TraceLog.ToString()
                    string id = tokenData == null ? "Unknown" : tokenData.ToString();
                    TDSLogger.Application.Error(new ApplicationException(String.Format("Error submitting callback score for: {0}", id), ex));
                    //TDSLogger.Application.Error(new TraceLog("Error submitting callback score.", ex));

                    return;
                }

                Interlocked.Decrement(ref ProgressCount);
                Interlocked.Increment(ref SuccessCount);
            };

            // check if thread pooling is enabled for callbacks
            if (WorkerPool != null)
            {
                // async
                if (!WorkerPool.Enqueue(submitScore))
                {
                    Interlocked.Increment(ref RejectCount);
                }
            }
            else
            {
                // sync
                submitScore();
            }
        }
コード例 #29
0
 public ResponseController(IResponseRepository repo)
 {
     Repo = repo;
 }
コード例 #30
0
 public QuestionsController(IUsersRepository usersRep, IQuestionRepository questionRep, IResponseRepository responseRep)
 {
     this.usersRep    = usersRep;
     this.questionRep = questionRep;
     this.responseRep = responseRep;
 }
コード例 #31
0
 public ResponseManager(IResponseRepository repo)
 {
     _repo = repo;
 }
コード例 #32
0
 /// <summary>
 /// instantiate the ResponseBusiness class object with the repository as the input parameter set the internal copy of _responseRepository equal to the input parameter so that the business class is using repository that you pass it from the business class's calling method and uses it throughout its methods like Insert, Delete, etc
 /// </summary>
 /// <param name="repository"></param>
 public ResponseBusiness(IResponseRepository repository)
 {
     _responseRepository = repository;
 }
コード例 #33
0
 /// <summary>
 /// implements the Dispose() method to comply with the IDisposable interface
 /// </summary>
 public void Dispose()
 {
     _responseRepository = null;
 }
コード例 #34
0
 public ResponseService(IResponseRepository repository)
 {
     _repository = repository;
 }