public IAttributeSetInstanceExtensionFieldGroupStateEvent GetStateEvent(string id, long version)
 {
     try {
         var idObj = id;
         return(_attributeSetInstanceExtensionFieldGroupApplicationService.GetStateEvent(idObj, version));
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Ejemplo n.º 2
0
 public void Patch(string id, [FromBody] MergePatchAttributeSetInstanceExtensionFieldGroupDto value)
 {
     try {
         AttributeSetInstanceExtensionFieldGroupsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _attributeSetInstanceExtensionFieldGroupApplicationService.When(value as IMergePatchAttributeSetInstanceExtensionFieldGroup);
     } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public IEnumerable <AttributeSetInstanceExtensionFieldGroupStateDto> GetAll(string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null)
 {
     try {
         IEnumerable <IAttributeSetInstanceExtensionFieldGroupState> states = null;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             states = _attributeSetInstanceExtensionFieldGroupApplicationService.Get(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver())
                                                                                     , AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         else
         {
             states = _attributeSetInstanceExtensionFieldGroupApplicationService.Get(AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())
                                                                                     , AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         var stateDtos = new List <AttributeSetInstanceExtensionFieldGroupStateDto>();
         foreach (var s in states)
         {
             var dto = s is AttributeSetInstanceExtensionFieldGroupStateDto ? (AttributeSetInstanceExtensionFieldGroupStateDto)s : new AttributeSetInstanceExtensionFieldGroupStateDto((AttributeSetInstanceExtensionFieldGroupState)s);
             if (String.IsNullOrWhiteSpace(fields))
             {
                 dto.AllFieldsReturned = true;
             }
             else
             {
                 dto.ReturnedFieldsString = fields;
             }
             stateDtos.Add(dto);
         }
         return(stateDtos);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public AttributeSetInstanceExtensionFieldGroupStateCreatedOrMergePatchedOrDeletedDto GetStateEvent(string id, long version)
 {
     try {
         var idObj = id;
         var conv  = new AttributeSetInstanceExtensionFieldGroupStateEventDtoConverter();
         var se    = _attributeSetInstanceExtensionFieldGroupApplicationService.GetEvent(idObj, version);
         return(se == null ? null : conv.ToAttributeSetInstanceExtensionFieldGroupStateEventDto(se));
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Ejemplo n.º 5
0
 public void Delete(string id, string commandId, string version, string requesterId = default(string))
 {
     try {
         var value = new DeleteAttributeSetInstanceExtensionFieldGroupDto();
         value.CommandId   = commandId;
         value.RequesterId = requesterId;
         value.Version     = (long)Convert.ChangeType(version, typeof(long));
         AttributeSetInstanceExtensionFieldGroupsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _attributeSetInstanceExtensionFieldGroupApplicationService.When(value as IDeleteAttributeSetInstanceExtensionFieldGroup);
     } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public AttributeSetInstanceExtensionFieldStateDto GetAttributeSetInstanceExtensionField(string groupId, string index)
 {
     try {
         var state = (AttributeSetInstanceExtensionFieldState)_attributeSetInstanceExtensionFieldGroupApplicationService.GetAttributeSetInstanceExtensionField(groupId, index);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new AttributeSetInstanceExtensionFieldStateDto(state);
         stateDto.AllFieldsReturned = true;
         return(stateDto);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
        public HttpResponseMessage Post([FromBody] CreateAttributeSetInstanceExtensionFieldGroupDto value)
        {
            try {
                if (value.Id == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "AttributeSetInstanceExtensionFieldGroup");
                }
                _attributeSetInstanceExtensionFieldGroupApplicationService.When(value as ICreateAttributeSetInstanceExtensionFieldGroup);
                var idObj = value.Id;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
 public IEnumerable <PropertyMetadata> GetMetadataFilteringFields()
 {
     try {
         var filtering = new List <PropertyMetadata>();
         foreach (var p in AttributeSetInstanceExtensionFieldGroupMetadata.Instance.Properties)
         {
             if (p.IsFilteringProperty)
             {
                 filtering.Add(p);
             }
         }
         return(filtering);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.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 ApiControllerTypeConverter(), new PropertyTypeResolver()));
         }
         else
         {
             count = _attributeSetInstanceExtensionFieldGroupApplicationService.GetCount(AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()));
         }
         return(count);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Ejemplo n.º 10
0
        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 = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public AttributeSetInstanceExtensionFieldGroupStateDto Get(string id, string fields = null)
 {
     try {
         var idObj = id;
         var state = (AttributeSetInstanceExtensionFieldGroupState)_attributeSetInstanceExtensionFieldGroupApplicationService.Get(idObj);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new AttributeSetInstanceExtensionFieldGroupStateDto(state);
         if (String.IsNullOrWhiteSpace(fields))
         {
             stateDto.AllFieldsReturned = true;
         }
         else
         {
             stateDto.ReturnedFieldsString = fields;
         }
         return(stateDto);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Ejemplo n.º 13
0
 public Type ResolveTypeByPropertyName(string propertyName)
 {
     return(AttributeSetInstanceExtensionFieldGroupsControllerUtils.GetFilterPropertyType(propertyName));
 }