Example #1
0
        public GetScoringMapResponse GetScoringMap()
        {
            _isAnonymousAuthentication = true;
            ScoringEngine         scoringEngine = CreateScoringEngineWithRequestValidation();
            GetScoringMapResponse scoringMap    = scoringEngine.GetScoringMap();

            return(scoringMap);
        }
Example #2
0
        private ScoringEngine CreateScoringEngine()
        {
            var args = new ConstructorArgument[] {
                new ConstructorArgument("userConnection", UserConnection)
            };
            ScoringEngine scoringEngine = ClassFactory.Get <ScoringEngine>(args);

            return(scoringEngine);
        }
Example #3
0
 public IActionResult Score(string rawChecklist)
 {
     try {
         _logger.LogInformation("Calling External Score() with a raw Checklist XML data");
         return(Ok(ScoringEngine.ScoreChecklistString(rawChecklist)));
     }
     catch (Exception ex) {
         _logger.LogError(ex, "Score() Error creating External Score for XML string passed in");
         return(BadRequest());
     }
 }
Example #4
0
        private ScoringEngine CreateScoringEngineWithRequestValidation()
        {
            HttpRequest   request       = HttpContext.Current.Request;
            ScoringEngine scoringEngine = CreateScoringEngine();
            string        validationExceptionMessage = scoringEngine.ValidateAuthKey(request);

            if (!string.IsNullOrEmpty(validationExceptionMessage))
            {
                throw new WebFaultException <string>(validationExceptionMessage, System.Net.HttpStatusCode.Forbidden);
            }
            return(scoringEngine);
        }
Example #5
0
        public ActionResult ScoreMe()
        {
            List <Frame> frames = ScoringEngine.SetupFrames();
            var          model  = new BowlingViewModel();

            model.NineFrames = frames;
            model.LastFrame  = new TenthFrame {
                FirstScore = "0", SecondScore = "0", ThirdScore = "0"
            };
            //return View(frames);
            return(View(model));
        }
Example #6
0
        public GetSynchronizationDataResponse GetSynchronizationData(string schemaName, string lastSynchronizationDate,
                                                                     Guid lastSynchronizationId, List <string> columns, int limit)
        {
            _isAnonymousAuthentication = true;
            GetSynchronizationDataResponse response = new GetSynchronizationDataResponse();

            response.Columns = columns;
            ScoringEngine scoringEngine = CreateScoringEngineWithRequestValidation();

            response.Data
                = scoringEngine.GetSynchronizationRecords(schemaName, lastSynchronizationDate, lastSynchronizationId,
                                                          columns, limit);
            return(response);
        }
Example #7
0
        public void SaveScoredData(string schemaName, string schemaColumnName,
                                   Dictionary <string, object> scoredData)
        {
            HttpRequest request = HttpContext.Current.Request;

            if (request.HttpMethod == WebRequestMethods.Http.Head)
            {
                return;
            }
            if (request.HttpMethod != WebRequestMethods.Http.Post)
            {
                throw new HttpException(HttpStatusCode.MethodNotAllowed, "Method not allowed");
            }
            _isAnonymousAuthentication = true;
            ScoringEngine scoringEngine = CreateScoringEngineWithRequestValidation();

            scoringEngine.SaveScoredResults(schemaName, schemaColumnName, scoredData);
        }
Example #8
0
 public ActionResult ScoreMe(BowlingViewModel viewModel)
 {
     ScoringEngine.CalculateScore(viewModel.NineFrames, viewModel.LastFrame);
     TempData["frames"] = viewModel.NineFrames;
     return(RedirectToAction("Index"));
 }