Пример #1
0
 public IEnumerable <AttributeSetInstanceExtensionFieldMvoStateDto> GetAll(string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null)
 {
     try {
         IEnumerable <IAttributeSetInstanceExtensionFieldMvoState> states = null;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             states = _attributeSetInstanceExtensionFieldMvoApplicationService.Get(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver())
                                                                                   , AttributeSetInstanceExtensionFieldMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         else
         {
             states = _attributeSetInstanceExtensionFieldMvoApplicationService.Get(AttributeSetInstanceExtensionFieldMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())
                                                                                   , AttributeSetInstanceExtensionFieldMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         var stateDtos = new List <AttributeSetInstanceExtensionFieldMvoStateDto>();
         foreach (var s in states)
         {
             var dto = s is AttributeSetInstanceExtensionFieldMvoStateDto ? (AttributeSetInstanceExtensionFieldMvoStateDto)s : new AttributeSetInstanceExtensionFieldMvoStateDto((AttributeSetInstanceExtensionFieldMvoState)s);
             if (String.IsNullOrWhiteSpace(fields))
             {
                 dto.AllFieldsReturned = true;
             }
             else
             {
                 dto.ReturnedFieldsString = fields;
             }
             stateDtos.Add(dto);
         }
         return(stateDtos);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #2
0
 public IAttributeSetInstanceExtensionFieldMvoStateEvent GetStateEvent(string id, long version)
 {
     try {
         var idObj = AttributeSetInstanceExtensionFieldMvosControllerUtils.ParseIdString(id);
         return(_attributeSetInstanceExtensionFieldMvoApplicationService.GetStateEvent(idObj, version));
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #3
0
 public void Patch(string id, [FromBody] MergePatchAttributeSetInstanceExtensionFieldMvoDto value)
 {
     try {
         AttributeSetInstanceExtensionFieldMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _attributeSetInstanceExtensionFieldMvoApplicationService.When(value as IMergePatchAttributeSetInstanceExtensionFieldMvo);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #4
0
 public AttributeSetInstanceExtensionFieldMvoStateCreatedOrMergePatchedOrDeletedDto GetStateEvent(string id, long version)
 {
     try {
         var idObj = AttributeSetInstanceExtensionFieldMvosControllerUtils.ParseIdString(id);
         var conv  = new AttributeSetInstanceExtensionFieldMvoStateEventDtoConverter();
         var se    = _attributeSetInstanceExtensionFieldMvoApplicationService.GetStateEvent(idObj, version);
         return(se == null ? null : conv.ToAttributeSetInstanceExtensionFieldMvoStateEventDto(se));
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #5
0
 public void Delete(string id, string commandId, string version, string requesterId = default(string))
 {
     try {
         var value = new DeleteAttributeSetInstanceExtensionFieldMvoDto();
         value.CommandId   = commandId;
         value.RequesterId = requesterId;
         value.AttrSetInstEFGroupVersion = (long)Convert.ChangeType(version, typeof(long));
         AttributeSetInstanceExtensionFieldMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _attributeSetInstanceExtensionFieldMvoApplicationService.When(value as IDeleteAttributeSetInstanceExtensionFieldMvo);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #6
0
 public IEnumerable <PropertyMetadata> GetMetadataFilteringFields()
 {
     try {
         var filtering = new List <PropertyMetadata>();
         foreach (var p in AttributeSetInstanceExtensionFieldMvoMetadata.Instance.Properties)
         {
             if (p.IsFilteringProperty)
             {
                 filtering.Add(p);
             }
         }
         return(filtering);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #7
0
 public long GetCount(string filter = null)
 {
     try
     {
         long count = 0;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             count = _attributeSetInstanceExtensionFieldMvoApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver()));
         }
         else
         {
             count = _attributeSetInstanceExtensionFieldMvoApplicationService.GetCount(AttributeSetInstanceExtensionFieldMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()));
         }
         return(count);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #8
0
 public IEnumerable <PropertyMetadataDto> GetMetadataFilteringFields()
 {
     try {
         var filtering = new List <PropertyMetadataDto>();
         foreach (var p in AttributeSetInstanceExtensionFieldMvoMetadata.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 = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #9
0
 public AttributeSetInstanceExtensionFieldMvoStateDto Get(string id, string fields = null)
 {
     try {
         var idObj = AttributeSetInstanceExtensionFieldMvosControllerUtils.ParseIdString(id);
         var state = (AttributeSetInstanceExtensionFieldMvoState)_attributeSetInstanceExtensionFieldMvoApplicationService.Get(idObj);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new AttributeSetInstanceExtensionFieldMvoStateDto(state);
         if (String.IsNullOrWhiteSpace(fields))
         {
             stateDto.AllFieldsReturned = true;
         }
         else
         {
             stateDto.ReturnedFieldsString = fields;
         }
         return(stateDto);
     } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #10
0
 public Type ResolveTypeByPropertyName(string propertyName)
 {
     return(AttributeSetInstanceExtensionFieldMvosControllerUtils.GetFilterPropertyType(propertyName));
 }