Ejemplo n.º 1
0
        public async Task WhenAsync(MergePatchShipmentPackageDto c)
        {
            var idObj         = ShipmentPackageProxyUtils.ToIdString((c as IMergePatchShipmentPackage).ShipmentPackageId);
            var uriParameters = new ShipmentPackageUriParameters();

            uriParameters.Id = idObj;

            var req  = new ShipmentPackagePatchRequest(uriParameters, (MergePatchShipmentPackageDto)c);
            var resp = await _ramlClient.ShipmentPackage.Patch(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
        }
Ejemplo n.º 2
0
        public async virtual Task <IShipmentPackageContentState> GetShipmentPackageContentAsync(ShipmentPackageId shipmentPackageId, string shipmentItemSeqId)
        {
            var uriParameters = new ShipmentPackageContentUriParameters();

            uriParameters.ShipmentPackageId = ((new ValueObjectTextFormatter <ShipmentPackageId>())).ToString(shipmentPackageId);
            uriParameters.ShipmentItemSeqId = shipmentItemSeqId;

            var req  = new ShipmentPackageContentGetRequest(uriParameters);
            var resp = await _ramlClient.ShipmentPackageContent.Get(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToShipmentPackageContentState());
        }
Ejemplo n.º 3
0
        public async Task <IShipmentPackageState> GetHistoryStateAsync(ShipmentPackageId shipmentPackageId, long version)
        {
            var idObj         = ShipmentPackageProxyUtils.ToIdString(shipmentPackageId);
            var uriParameters = new ShipmentPackageHistoryStateUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new ShipmentPackageHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.ShipmentPackageHistoryState.Get(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToShipmentPackageState());
        }
Ejemplo n.º 4
0
        public async Task <IShipmentPackageEvent> GetStateEventAsync(ShipmentPackageId shipmentPackageId, long version)
        {
            var idObj         = ShipmentPackageProxyUtils.ToIdString(shipmentPackageId);
            var uriParameters = new ShipmentPackageStateEventUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new ShipmentPackageStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.ShipmentPackageStateEvent.Get(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Ejemplo n.º 5
0
        public async Task <IShipmentPackageState> GetAsync(ShipmentPackageId shipmentPackageId)
        {
            IShipmentPackageState state = null;
            var idObj         = ShipmentPackageProxyUtils.ToIdString(shipmentPackageId);
            var uriParameters = new ShipmentPackageUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentPackageGetRequest(uriParameters);

            var resp = await _ramlClient.ShipmentPackage.Get(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToShipmentPackageState();
            return(state);
        }
Ejemplo n.º 6
0
        public async Task <IEnumerable <IShipmentPackageState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IShipmentPackageState> states = null;
            var q = new ShipmentPackagesGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = ShipmentPackageProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = ShipmentPackageProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = ShipmentPackageProxyUtils.GetFilterQueryValueString(filter);
            var req = new ShipmentPackagesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.ShipmentPackages.Get(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToShipmentPackageState());
            return(states);
        }
Ejemplo n.º 7
0
        public async Task WhenAsync(DeleteShipmentPackageDto c)
        {
            var idObj         = ShipmentPackageProxyUtils.ToIdString((c as IDeleteShipmentPackage).ShipmentPackageId);
            var uriParameters = new ShipmentPackageUriParameters();

            uriParameters.Id = idObj;

            var q = new ShipmentPackageDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new ShipmentPackageDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.ShipmentPackage.Delete(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
        }
Ejemplo n.º 8
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new ShipmentPackagesCountGetQuery();

            q.Filter = ShipmentPackageProxyUtils.GetFilterQueryValueString(filter);
            var req = new ShipmentPackagesCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.ShipmentPackagesCount.Get(req);

            ShipmentPackageProxyUtils.ThrowOnHttpResponseError(resp);
            string str = await resp.RawContent.ReadAsStringAsync();

            if (str.StartsWith("\""))
            {
                str = str.Substring(1);
            }
            if (str.EndsWith("\""))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(long.Parse(str));
        }