Exemplo n.º 1
0
        /// <summary>
        /// Gets the <see cref="CustomerGroup"/> collection object that matches the selection criteria.
        /// </summary>
        /// <param name="args">The Args (see <see cref="CustomerGroupArgs"/>).</param>
        /// <param name="paging">The <see cref="PagingArgs"/>.</param>
        /// <returns>A <see cref="CustomerGroupCollectionResult"/>.</returns>
        public Task <CustomerGroupCollectionResult> GetByArgsAsync(CustomerGroupArgs args, PagingArgs paging)
        {
            return(ManagerInvoker.Default.InvokeAsync(this, async() =>
            {
                ExecutionContext.Current.OperationType = OperationType.Read;
                EntityBase.CleanUp(args);
                if (_getByArgsOnPreValidateAsync != null)
                {
                    await _getByArgsOnPreValidateAsync(args, paging);
                }

                MultiValidator.Create()
                .Add(args.Validate(nameof(args)).Entity(CustomerGroupArgsValidator.Default))
                .Additional((__mv) => _getByArgsOnValidate?.Invoke(__mv, args, paging))
                .Run().ThrowOnError();

                if (_getByArgsOnBeforeAsync != null)
                {
                    await _getByArgsOnBeforeAsync(args, paging);
                }
                var __result = await CustomerGroupDataSvc.GetByArgsAsync(args, paging);
                if (_getByArgsOnAfterAsync != null)
                {
                    await _getByArgsOnAfterAsync(__result, args, paging);
                }
                Cleaner.Clean(__result);
                return __result;
            }));
        }
Exemplo n.º 2
0
        public IActionResult GetByArgs(string?company = default, string?description = default)
        {
            var args = new CustomerGroupArgs {
                CompanySid = company, Description = description
            };

            return(new WebApiGet <CustomerGroupCollectionResult, CustomerGroupCollection, CustomerGroup>(this, () => Factory.Create <ICustomerGroupManager>().GetByArgsAsync(args, WebApiQueryString.CreatePagingArgs(this)),
                                                                                                         operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the <see cref="CustomerGroup"/> collection object that matches the selection criteria.
        /// </summary>
        /// <param name="args">The Args (see <see cref="CustomerGroupArgs"/>).</param>
        /// <param name="paging">The <see cref="PagingArgs"/>.</param>
        /// <returns>A <see cref="CustomerGroupCollectionResult"/>.</returns>
        public Task <CustomerGroupCollectionResult> GetByArgsAsync(CustomerGroupArgs args, PagingArgs paging)
        {
            return(DataInvoker.Default.InvokeAsync(this, async() =>
            {
                CustomerGroupCollectionResult __result = new CustomerGroupCollectionResult(paging);
                var __dataArgs = ODataMapper.Default.CreateArgs(__result.Paging);
                if (_getByArgsOnBeforeAsync != null)
                {
                    await _getByArgsOnBeforeAsync(args, __dataArgs).ConfigureAwait(false);
                }
                __result.Result = await DynamicsAx.Default.SelectQueryAsync <CustomerGroupCollection, CustomerGroup>(__dataArgs,
                                                                                                                     q => _getByArgsOnQuery == null ? q : _getByArgsOnQuery(q, args, __dataArgs)).ConfigureAwait(false);

                if (_getByArgsOnAfterAsync != null)
                {
                    await _getByArgsOnAfterAsync(__result, args).ConfigureAwait(false);
                }
                return __result;
            }, new BusinessInvokerArgs {
                ExceptionHandler = _getByArgsOnException
            }));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the <see cref="CustomerGroup"/> collection object that matches the selection criteria.
 /// </summary>
 /// <param name="args">The Args (see <see cref="CustomerGroupArgs"/>).</param>
 /// <param name="paging">The <see cref="PagingArgs"/>.</param>
 /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param>
 /// <returns>A <see cref="WebApiAgentResult"/>.</returns>
 public Task <WebApiAgentResult <CustomerGroupCollectionResult> > GetByArgsAsync(CustomerGroupArgs args, PagingArgs paging = null, WebApiRequestOptions requestOptions = null)
 {
     return(CustomerGroupServiceAgent.GetByArgsAsync(args, paging, requestOptions));
 }
 /// <summary>
 /// Gets the <see cref="CustomerGroup"/> collection object that matches the selection criteria.
 /// </summary>
 /// <param name="args">The Args (see <see cref="CustomerGroupArgs"/>).</param>
 /// <param name="paging">The <see cref="PagingArgs"/>.</param>
 /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param>
 /// <returns>A <see cref="WebApiAgentResult"/>.</returns>
 public Task <WebApiAgentResult <CustomerGroupCollectionResult> > GetByArgsAsync(CustomerGroupArgs args, PagingArgs paging = null, WebApiRequestOptions requestOptions = null)
 {
     return(base.GetCollectionResultAsync <CustomerGroupCollectionResult, CustomerGroupCollection, CustomerGroup>("api/v1/customergroups", requestOptions: requestOptions,
                                                                                                                  args: new WebApiArg[] { new WebApiArg <CustomerGroupArgs>("args", args, WebApiArgType.FromUriUseProperties), new WebApiPagingArgsArg("paging", paging) }));
 }
Exemplo n.º 6
0
 private IQueryable <CustomerGroup> GetByArgsOnQuery(IQueryable <CustomerGroup> q, CustomerGroupArgs args, IODataArgs odataArgs)
 {
     return(q.WhereWith(args?.Company, a => a.Company == args.Company)
            .WhereWith(args?.Description, a => a.Description == args.Description));
 }