Example #1
0
        public bool UpdateEvent(Event[] events)
        {
            var eventsDto = convert.ToEventDto(events);
            var model     = new bool();

            using (var client = new TeamService.EventServiceClient())
            {
                try
                {
                    client.Open();
                    model = client.UpdateEvents(eventsDto);
                    client.Close();
                }

                catch (FaultException <CustomException> customEx)
                {
                    log.Error(customEx.Message);
                    return(false);
                }
                catch (CommunicationException commEx)
                {
                    log.Error(commEx.Message);
                    return(false);
                }
            }
            return(model);
        }
Example #2
0
        public bool DeleteEvent(int matchId)
        {
            var model = new bool();

            using (var client = new TeamService.EventServiceClient())
            {
                try
                {
                    client.Open();
                    model = client.DeleteEvents(matchId);
                    client.Close();
                }

                catch (FaultException <CustomException> customEx)
                {
                    log.Error(customEx.Message);
                    return(false);
                }
                catch (CommunicationException commEx)
                {
                    log.Error(commEx.Message);
                    return(false);
                }
            }
            return(model);
        }
Example #3
0
        public IReadOnlyList <EventDto> GetEventByMatch(int matchId)
        {
            var model = new List <EventDto>();

            using (var client = new TeamService.EventServiceClient())
            {
                try
                {
                    client.Open();
                    var events = client.GetEvents(matchId);
                    foreach (var _event in events)
                    {
                        model.Add(_event);
                    }
                    client.Close();
                    if (model == null)
                    {
                        throw new NullReferenceException();
                    }
                }
                catch (FaultException <CustomException> customEx)
                {
                    log.Error(customEx.Message);
                    return(null);
                }
                catch (CommunicationException commEx)
                {
                    log.Error(commEx.Message);
                    return(null);
                }
                catch (NullReferenceException nullEx)
                {
                    log.Error(nullEx.Message);
                    return(null);
                }
            }

            return(model);
        }