public override GetDeliveryTimeResponse OnGetDeliveryTimeExecute(GetDeliveryTimeRequest request) { IFoccoWebPrazoRepository repository = new FoccoWebPrazoRepository(); var response = new GetDeliveryTimeResponse(); try { response.DeliveryTime = repository.Query(x => (request.CodeTo == 0 || x.CodigoEmpresaPara == request.CodeTo) && (request.CodeFrom == 0 || x.CodigoEmpresaDe == request.CodeFrom)) .Select(x => new DeliveryTime() { Id = x.Id, From = x.CodigoEmpresaDe, To = x.CodigoEmpresaPara, TimeInDays = x.PrazoDias }).ToList(); } catch (Exception ex) { response.Exception = ex; response.Message = ex.Message; } return(response); }
public virtual GetDeliveryTimeResponse GetDeliveryTime(GetDeliveryTimeRequest request) { var response = new GetDeliveryTimeResponse(); try { // Raise Initialization Event var initialization = GetDeliveryTimeInitialization; if (initialization != null) { initialization(request, response); } // Raise Execute Event var execute = GetDeliveryTimeExecute; if (execute != null) { response = execute(request); } // Raise Complete Event var complete = GetDeliveryTimeComplete; if (complete != null) { complete(request, response); } } catch (Exception exception) { // Raise Error Event var error = GetDeliveryTimeError; if (error != null) { error(request, response, exception); } } return(response); }