public HttpResponseMessage Post([FromBody] CreatePartyDto value) { try { value.PartyTypeId = PartyTypeIds.Organization; if (value.PartyId == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "Party"); } _partyApplicationService.When(value as ICreateParty); var idObj = value.PartyId; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <PropertyMetadata> GetMetadataFilteringFields() { try { var filtering = new List <PropertyMetadata>(); foreach (var p in OrganizationStructureMetadata.Instance.Properties) { if (p.IsFilteringProperty) { filtering.Add(p); } } return(filtering); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void OrderShipGroupAction(string orderId, string shipGroupSeqId, [FromBody] OrderCommandDtos.OrderShipGroupActionRequestContent content) { try { var cmd = content.ToOrderShipGroupAction(); var idObj = new OrderShipGroupId(orderId, shipGroupSeqId); if (cmd.OrderShipGroupId == null) { cmd.OrderShipGroupId = idObj; } else if (!cmd.OrderShipGroupId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", idObj, cmd.OrderShipGroupId); } _orderApplicationService.When(cmd); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void DocumentAction(string id, [FromBody] InOutCommandDtos.DocumentActionRequestContent content) { try { var cmd = content.ToDocumentAction(); var idObj = id; if (cmd.DocumentNumber == null) { cmd.DocumentNumber = idObj; } else if (!cmd.DocumentNumber.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, cmd.DocumentNumber); } _inOutApplicationService.When(cmd); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void ConfirmAllItemsIssued(string id, [FromBody] ShipmentCommandDtos.ConfirmAllItemsIssuedRequestContent content) { try { var cmd = content.ToConfirmAllItemsIssued(); var idObj = id; if (cmd.ShipmentId == null) { cmd.ShipmentId = idObj; } else if (!cmd.ShipmentId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, cmd.ShipmentId); } _shipmentApplicationService.When(cmd); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public long GetCount(string filter = null) { try { long count = 0; if (!String.IsNullOrWhiteSpace(filter)) { count = _attributeSetInstanceExtensionFieldGroupApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new WebApiControllerTypeConverter(), new PropertyTypeResolver() , n => (AttributeSetInstanceExtensionFieldGroupMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? AttributeSetInstanceExtensionFieldGroupMetadata.Instance.FilteringPropertyAliasDictionary[n] : n))); } else { count = _attributeSetInstanceExtensionFieldGroupApplicationService.GetCount(AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())); } return(count); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteOrganizationStructureDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; OrganizationStructuresControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _organizationStructureApplicationService.When(value as IMergePatchOrganizationStructure); return; } // /////////////////////////////// OrganizationStructuresControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _organizationStructureApplicationService.When(value as ICreateOrganizationStructure); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteAttributeSetInstanceExtensionFieldGroupDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; AttributeSetInstanceExtensionFieldGroupsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetInstanceExtensionFieldGroupApplicationService.When(value as IMergePatchAttributeSetInstanceExtensionFieldGroup); return; } // /////////////////////////////// AttributeSetInstanceExtensionFieldGroupsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetInstanceExtensionFieldGroupApplicationService.When(value as ICreateAttributeSetInstanceExtensionFieldGroup); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <PropertyMetadataDto> GetMetadataFilteringFields() { try { var filtering = new List <PropertyMetadataDto>(); foreach (var p in AttributeSetInstanceExtensionFieldGroupMetadata.Instance.Properties) { if (p.IsFilteringProperty) { var pdto = new PropertyMetadataDto(p.Name, p.TypeName, p.IsFilteringProperty, !String.IsNullOrWhiteSpace(p.SourceChainingName) ? p.SourceChainingName : (!String.IsNullOrWhiteSpace(p.DerivedFrom) ? p.DerivedFrom : p.Name)); filtering.Add(pdto); } } return(filtering); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IInventoryItemRequirementEntryStateDto> GetInventoryItemRequirementEntries(string inventoryItemRequirementId) { try { var states = _inventoryItemRequirementApplicationService.GetInventoryItemRequirementEntries(((new ValueObjectTextFormatter <InventoryItemId>()).Parse(inventoryItemRequirementId))); if (states == null) { return(null); } var stateDtos = new List <IInventoryItemRequirementEntryStateDto>(); foreach (var s in states) { var dto = s is InventoryItemRequirementEntryStateDtoWrapper ? (InventoryItemRequirementEntryStateDtoWrapper)s : new InventoryItemRequirementEntryStateDtoWrapper((IInventoryItemRequirementEntryState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IPhysicalInventoryLineStateDto> GetPhysicalInventoryLines(string physicalInventoryDocumentNumber) { try { var states = _physicalInventoryApplicationService.GetPhysicalInventoryLines(physicalInventoryDocumentNumber); if (states == null) { return(null); } var stateDtos = new List <IPhysicalInventoryLineStateDto>(); foreach (var s in states) { var dto = s is PhysicalInventoryLineStateDtoWrapper ? (PhysicalInventoryLineStateDtoWrapper)s : new PhysicalInventoryLineStateDtoWrapper((IPhysicalInventoryLineState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IShipmentReceiptImageStateDto> GetShipmentReceiptImages(string shipmentId, string shipmentReceiptReceiptSeqId) { try { var states = _shipmentApplicationService.GetShipmentReceiptImages(shipmentId, shipmentReceiptReceiptSeqId); if (states == null) { return(null); } var stateDtos = new List <IShipmentReceiptImageStateDto>(); foreach (var s in states) { var dto = s is ShipmentReceiptImageStateDtoWrapper ? (ShipmentReceiptImageStateDtoWrapper)s : new ShipmentReceiptImageStateDtoWrapper((IShipmentReceiptImageState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeletePartyDto value) { try { value.PartyTypeId = PartyTypeIds.Person; // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; PeopleControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _partyApplicationService.When(value as IMergePatchParty); return; } // /////////////////////////////// PeopleControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _partyApplicationService.When(value as ICreateParty); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IOrderItemShipGroupAssociationStateDto> GetOrderItemShipGroupAssociations(string orderId, string orderShipGroupShipGroupSeqId) { try { var states = _orderApplicationService.GetOrderItemShipGroupAssociations(orderId, orderShipGroupShipGroupSeqId); if (states == null) { return(null); } var stateDtos = new List <IOrderItemShipGroupAssociationStateDto>(); foreach (var s in states) { var dto = s is OrderItemShipGroupAssociationStateDtoWrapper ? (OrderItemShipGroupAssociationStateDtoWrapper)s : new OrderItemShipGroupAssociationStateDtoWrapper((IOrderItemShipGroupAssociationState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IMovementConfirmationLineStateDto> GetMovementConfirmationLines(string movementConfirmationDocumentNumber) { try { var states = _movementConfirmationApplicationService.GetMovementConfirmationLines(movementConfirmationDocumentNumber); if (states == null) { return(null); } var stateDtos = new List <IMovementConfirmationLineStateDto>(); foreach (var s in states) { var dto = s is MovementConfirmationLineStateDtoWrapper ? (MovementConfirmationLineStateDtoWrapper)s : new MovementConfirmationLineStateDtoWrapper((IMovementConfirmationLineState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IGoodIdentificationStateDto> GetGoodIdentifications(string productId) { try { var states = _productApplicationService.GetGoodIdentifications(productId); if (states == null) { return(null); } var stateDtos = new List <IGoodIdentificationStateDto>(); foreach (var s in states) { var dto = s is GoodIdentificationStateDtoWrapper ? (GoodIdentificationStateDtoWrapper)s : new GoodIdentificationStateDtoWrapper((IGoodIdentificationState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IInOutLineImageStateDto> GetInOutLineImages(string inOutDocumentNumber, string inOutLineLineNumber) { try { var states = _inOutApplicationService.GetInOutLineImages(inOutDocumentNumber, inOutLineLineNumber); if (states == null) { return(null); } var stateDtos = new List <IInOutLineImageStateDto>(); foreach (var s in states) { var dto = s is InOutLineImageStateDtoWrapper ? (InOutLineImageStateDtoWrapper)s : new InOutLineImageStateDtoWrapper((IInOutLineImageState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IPicklistItemStateDto> GetPicklistItems(string picklistBinId) { try { var states = _picklistBinApplicationService.GetPicklistItems(picklistBinId); if (states == null) { return(null); } var stateDtos = new List <IPicklistItemStateDto>(); foreach (var s in states) { var dto = s is PicklistItemStateDtoWrapper ? (PicklistItemStateDtoWrapper)s : new PicklistItemStateDtoWrapper((IPicklistItemState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IAttributeUseStateDto> GetAttributeUses(string attributeSetId) { try { var states = _attributeSetApplicationService.GetAttributeUses(attributeSetId); if (states == null) { return(null); } var stateDtos = new List <IAttributeUseStateDto>(); foreach (var s in states) { var dto = s is AttributeUseStateDtoWrapper ? (AttributeUseStateDtoWrapper)s : new AttributeUseStateDtoWrapper((IAttributeUseState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IShipmentPackageContentStateDto> GetShipmentPackageContents(string shipmentPackageId) { try { var states = _shipmentPackageApplicationService.GetShipmentPackageContents(((new ValueObjectTextFormatter <ShipmentPackageId>()).Parse(shipmentPackageId))); if (states == null) { return(null); } var stateDtos = new List <IShipmentPackageContentStateDto>(); foreach (var s in states) { var dto = s is ShipmentPackageContentStateDtoWrapper ? (ShipmentPackageContentStateDtoWrapper)s : new ShipmentPackageContentStateDtoWrapper((IShipmentPackageContentState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IProductCategoryStateDto> GetChildProductCategories(string id) { try { var idObj = id; var states = _productCategoryApplicationService.GetChildProductCategories(idObj); if (states == null) { return(null); } var stateDtos = new List <IProductCategoryStateDto>(); foreach (var s in states) { var dto = s is ProductCategoryStateDtoWrapper ? (ProductCategoryStateDtoWrapper)s : new ProductCategoryStateDtoWrapper((IProductCategoryState)s); dto.AllFieldsReturned = true; stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IAttributeSetInstanceExtensionFieldGroupStateDto Get(string id, string fields = null) { try { var idObj = id; var state = _attributeSetInstanceExtensionFieldGroupApplicationService.Get(idObj); if (state == null) { return(null); } var stateDto = new AttributeSetInstanceExtensionFieldGroupStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IOrganizationStructureStateDto Get(string id, string fields = null) { try { var idObj = OrganizationStructuresControllerUtils.ParseIdString(id); var state = _organizationStructureApplicationService.Get(idObj); if (state == null) { return(null); } var stateDto = new OrganizationStructureStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public ILocatorStateDto GetHistoryState(string id, long version, string fields = null) { try { var idObj = id; var state = _locatorApplicationService.GetHistoryState(idObj, version); if (state == null) { return(null); } var stateDto = new LocatorStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IInventoryPostingRuleStateDto Get(string id, string fields = null) { try { var idObj = id; var state = _inventoryPostingRuleApplicationService.Get(idObj); if (state == null) { return(null); } var stateDto = new InventoryPostingRuleStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IOrderItemShipGrpInvReservationStateDto GetHistoryState(string id, long version, string fields = null) { try { var idObj = OrderItemShipGrpInvReservationsControllerUtils.ParseIdString(id); var state = _orderItemShipGrpInvReservationApplicationService.GetHistoryState(idObj, version); if (state == null) { return(null); } var stateDto = new OrderItemShipGrpInvReservationStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <ILocatorStateDto> Get(string parentId = null, string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null) { try { var parentIdObj = parentId == null ? null : parentId; IEnumerable <ILocatorState> states = null; if (!String.IsNullOrWhiteSpace(filter)) { if (parentIdObj == null) { if (IsOnlyIdReturned(fields)) { var ids = _locatorTreeApplicationService.GetRootIds(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (LocatorMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? LocatorMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); states = LocatorsControllerUtils.ToLocatorStateCollection(ids); } else { states = _locatorTreeApplicationService.GetRoots(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (LocatorMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? LocatorMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } } else { if (IsOnlyIdReturned(fields)) { var ids = _locatorTreeApplicationService.GetChildIds(parentIdObj, CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (LocatorMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? LocatorMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); states = LocatorsControllerUtils.ToLocatorStateCollection(ids); } else { states = _locatorTreeApplicationService.GetChildren(parentIdObj, CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (LocatorMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? LocatorMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } } } else { if (parentIdObj == null) { if (IsOnlyIdReturned(fields)) { var ids = _locatorTreeApplicationService.GetRootIds(LocatorsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); states = LocatorsControllerUtils.ToLocatorStateCollection(ids); } else { states = _locatorTreeApplicationService.GetRoots(LocatorsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } } else { if (IsOnlyIdReturned(fields)) { var ids = _locatorTreeApplicationService.GetChildIds(parentIdObj, LocatorsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); states = LocatorsControllerUtils.ToLocatorStateCollection(ids); } else { states = _locatorTreeApplicationService.GetChildren(parentIdObj, LocatorsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()) , LocatorsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } } } var stateDtos = new List <ILocatorStateDto>(); foreach (var s in states) { var dto = s is LocatorStateDtoWrapper ? (LocatorStateDtoWrapper)s : new LocatorStateDtoWrapper((ILocatorState)s); if (String.IsNullOrWhiteSpace(fields)) { dto.AllFieldsReturned = true; } else { dto.ReturnedFieldsString = fields; } stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public string GetDocumentNumber([FromBody] IdServiceCommandDtos.GetDocumentNumberDto requestContent) { try { return(_idApplicationService.When(requestContent.ToGetDocumentNumber())); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public string GetNextId() { try { return(_attributeIdGenerator.GetNextId()); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public string CreateSOShipment([FromBody] OrderShipGroupServiceCommandDtos.CreateSOShipmentDto requestContent) { try { return(_orderShipGroupApplicationService.When(requestContent.ToCreateSOShipment())); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }