Esempio n. 1
0
        public bool Process(
            ExaminationEvent transactionEvent,
            ILog logger)
        {
            var p = TflService.GetNflPlayer(
                transactionEvent.PlayerId);
            var eventDate = transactionEvent.EventDate
                            ?? transactionEvent.ExaminationDateTime;

            if (TflService.IsSameDay(p, eventDate))
            {
                logger.Info($@"Cut for {
					p.PlayerName
					} ignored: Same day contract rule"                    );
                return(false);
            }

            if (string.IsNullOrEmpty(p.TeamCode))
            {
                if (logger != null)
                {
                    logger.Info($"{p.PlayerName} is already a free agent");
                }
                return(true);
            }

            var result = TflService.EndContract(
                p,
                transactionEvent.EventDate ?? transactionEvent.ExaminationDateTime,
                isRetirement: false);

            return(result);
        }
        public bool Process(
            ExaminationEvent transactionEvent,
            ILog logger)
        {
            var p = TflService.GetNflPlayer(transactionEvent.PlayerId);

            return(TflService.InjurePlayer(p));
        }
Esempio n. 3
0
 public StudentSubmitExaminationPaper(DateTime submitTimestamp, User submitBy, ExaminationEvent examinationEvent, IList <WrittenSet> writtenSets, IList <MultipleChoiceSet> multipleChoiceSet)
 {
     SubmitTimestamp   = submitTimestamp;
     this.SubmitBy     = submitBy;
     ExaminationEvent  = examinationEvent;
     WrittenSets       = writtenSets;
     MultipleChoiceSet = multipleChoiceSet;
 }
Esempio n. 4
0
 public bool Process(
     ExaminationEvent transactionEvent,
     ILog logger)
 {
     //TODO:  Figure out how to handle these
     logger.Info($"NEWBIE {transactionEvent}");
     return(true);
 }
Esempio n. 5
0
        public bool Process(
            ExaminationEvent transactionEvent,
            ILog logger)
        {
            logger.Trace("Processing Retirement");

            var p = TflService.GetNflPlayer(
                transactionEvent.PlayerId);

            return(TflService.EndContract(
                       p,
                       transactionEvent.EventDate ?? transactionEvent.ExaminationDateTime,
                       isRetirement: true));
        }
        public async Task <ExaminationEvent> CreateExaminationEvent(ExaminationEvent examinationEvent)
        {
            ExaminationEvent    examinationEventDeserialize = null;
            HttpResponseMessage responseMessage;
            string examinationEventSerialized = JsonSerializer.Serialize(examinationEvent);

            Console.WriteLine(examinationEventSerialized);
            var content = new StringContent(examinationEventSerialized, Encoding.UTF8, "application/json");

            // 1. Send POST request
            try
            {
                responseMessage =
                    await client.PostAsync(uri + "/examinationevent/createExaminationEvent", content);

                // 2. Check if the resource was found, else throw exception to the client
                if (responseMessage.StatusCode == HttpStatusCode.NotFound)
                {
                    throw new Exception("Ooops, resource not found");
                }
            }
            // 3. Catch the exception in case the Server is not running
            catch (HttpRequestException e)
            {
                throw new Exception("No connection could be made because the server is not responding");
            }

            string serverMessage = responseMessage.Content.ReadAsStringAsync().Result;

            // 4. Check the response status codes, else throws the error message to the client
            if (responseMessage.IsSuccessStatusCode)
            {
                // 5. Deserialize the object
                string readAsStringAsync = await responseMessage.Content.ReadAsStringAsync();

                examinationEventDeserialize = JsonSerializer.Deserialize <ExaminationEvent>(readAsStringAsync);
            }
            else if (responseMessage.StatusCode == HttpStatusCode.ServiceUnavailable)
            {
                throw new Exception(serverMessage);
            }
            else if (responseMessage.StatusCode == HttpStatusCode.BadRequest)
            {
                throw new Exception(serverMessage);
            }

            return(examinationEventDeserialize);
        }
        public async Task <ExaminationEvent> GetExaminationPaper(string examId)
        {
            ExaminationEvent    fetchedExaminationEventPaper = null;
            HttpResponseMessage responseMessage;

            // 1. Send GET request
            try
            {
                responseMessage =
                    await client.GetAsync($"{uri}/examinationevent/getExaminationPaper/{examId}");

                // 2. Check if the resource was found, else throw exception to the client
                if (responseMessage.StatusCode == HttpStatusCode.NotFound)
                {
                    throw new Exception("Ooops, resource not found");
                }
            }
            // 3. Catch the exception in case the Server is not running
            catch (HttpRequestException e)
            {
                throw new Exception("No connection could be made because the server is not responding");
            }

            string serverMessage = responseMessage.Content.ReadAsStringAsync().Result;

            // 4. Check the response status codes, else throws the error message to the client
            if (responseMessage.IsSuccessStatusCode)
            {
                // 5. Deserialize the object
                string readAsStringAsync = await responseMessage.Content.ReadAsStringAsync();

                fetchedExaminationEventPaper = JsonSerializer.Deserialize <ExaminationEvent>(readAsStringAsync);
            }
            else if (responseMessage.StatusCode == HttpStatusCode.ServiceUnavailable)
            {
                throw new Exception(serverMessage);
            }
            else if (responseMessage.StatusCode == HttpStatusCode.BadRequest)
            {
                throw new Exception(serverMessage);
            }

            return(fetchedExaminationEventPaper);
        }