Esempio n. 1
0
        public Response <GetSegmentAndDetailResponse> GetSegmentAndDetail(SegmentRequest request)
        {
            Response <GetSegmentAndDetailResponse> response = new Response <GetSegmentAndDetailResponse>()
            {
                Result = new GetSegmentAndDetailResponse()
            };

            if (request == null || request.ID == 0)
            {
                ArgumentNullException ex = new ArgumentNullException("GetSegmentAndDetail request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                SegmentAccessor             accessor = new SegmentAccessor();
                Segment                     segment;
                IEnumerable <SegmentDetail> segmentDetailCollection;
                accessor.GetSegmentAndDetail(request.ID, out segment, out segmentDetailCollection);
                response.Result.Segment = segment;
                response.Result.SegmentDetailCollection = segmentDetailCollection;
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }