/// <summary> /// Upserts a <see cref="CustomerGroupCollection"/> as a batch. /// </summary> /// <param name="value">The Value (see <see cref="CustomerGroupCollection"/>).</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> public Task UpdateBatchAsync(CustomerGroupCollection value, RefDataNamespace.Company company) { return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Unspecified; if (value != null) { value?.ForEach(__item => __item.Company = company); } EntityBase.CleanUp(value); if (_updateBatchOnPreValidateAsync != null) { await _updateBatchOnPreValidateAsync(value, company); } MultiValidator.Create() .Add(value.Validate(nameof(value)).Mandatory().Collection(minCount: 1, maxCount: 1, item: new Beef.Validation.Rules.CollectionRuleItem <CustomerGroup>(CustomerGroupValidator.Default))) .Add(company.Validate(nameof(company)).Mandatory().IsValid()) .Additional((__mv) => _updateBatchOnValidate?.Invoke(__mv, value, company)) .Run().ThrowOnError(); if (_updateBatchOnBeforeAsync != null) { await _updateBatchOnBeforeAsync(value, company); } await CustomerGroupDataSvc.UpdateBatchAsync(value); if (_updateBatchOnAfterAsync != null) { await _updateBatchOnAfterAsync(value, company); } })); }
/// <summary> /// Gets the <see cref="CustomerGroup"/> object that matches the selection criteria. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <returns>The selected <see cref="CustomerGroup"/> object where found; otherwise, <c>null</c>.</returns> public Task <CustomerGroup> GetAsync(string id, RefDataNamespace.Company company) { return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Read; EntityBase.CleanUp(id); if (_getOnPreValidateAsync != null) { await _getOnPreValidateAsync(id, company); } MultiValidator.Create() .Add(id.Validate(nameof(id)).Mandatory()) .Add(company.Validate(nameof(company)).Mandatory().IsValid()) .Additional((__mv) => _getOnValidate?.Invoke(__mv, id, company)) .Run().ThrowOnError(); if (_getOnBeforeAsync != null) { await _getOnBeforeAsync(id, company); } var __result = await CustomerGroupDataSvc.GetAsync(id, company); if (_getOnAfterAsync != null) { await _getOnAfterAsync(__result, id, company); } Cleaner.Clean(__result); return __result; })); }
/// <summary> /// Updates the <see cref="CustomerGroup"/> object. /// </summary> /// <param name="value">The <see cref="CustomerGroup"/> object.</param> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <returns>A refreshed <see cref="CustomerGroup"/> object.</returns> public Task <CustomerGroup> UpdateAsync(CustomerGroup value, string id, RefDataNamespace.Company company) { return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Update; if (value != null) { value.Id = id; value.Company = company; } EntityBase.CleanUp(value, id); if (_updateOnPreValidateAsync != null) { await _updateOnPreValidateAsync(value, id, company); } MultiValidator.Create() .Add(value.Validate(nameof(value)).Mandatory().Entity(CustomerGroupValidator.Default)) .Add(company.Validate(nameof(company)).IsValid()) .Additional((__mv) => _updateOnValidate?.Invoke(__mv, value, id, company)) .Run().ThrowOnError(); if (_updateOnBeforeAsync != null) { await _updateOnBeforeAsync(value, id, company); } var __result = await CustomerGroupDataSvc.UpdateAsync(value); if (_updateOnAfterAsync != null) { await _updateOnAfterAsync(__result, id, company); } Cleaner.Clean(__result); return __result; })); }
/// <summary> /// Deletes the <see cref="CustomerGroup"/> object. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> public Task DeleteAsync(string id, RefDataNamespace.Company company) { return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Delete; EntityBase.CleanUp(id); if (_deleteOnPreValidateAsync != null) { await _deleteOnPreValidateAsync(id, company).ConfigureAwait(false); } MultiValidator.Create() .Add(id.Validate(nameof(id)).Mandatory()) .Add(company.Validate(nameof(company)).Mandatory().IsValid()) .Additional((__mv) => _deleteOnValidate?.Invoke(__mv, id, company)) .Run().ThrowOnError(); if (_deleteOnBeforeAsync != null) { await _deleteOnBeforeAsync(id, company).ConfigureAwait(false); } await CustomerGroupDataSvc.DeleteAsync(id, company).ConfigureAwait(false); if (_deleteOnAfterAsync != null) { await _deleteOnAfterAsync(id, company).ConfigureAwait(false); } })); }
/// <summary> /// Gets the <see cref="CustomerGroup"/> object that matches the selection criteria. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <returns>The selected <see cref="CustomerGroup"/> object where found; otherwise, <c>null</c>.</returns> public static Task <CustomerGroup> GetAsync(string id, RefDataNamespace.Company company) { return(DataSvcInvoker.Default.InvokeAsync(typeof(CustomerGroupDataSvc), async() => { var __key = new UniqueKey(id, company); if (ExecutionContext.Current.TryGetCacheValue <CustomerGroup>(__key, out CustomerGroup __val)) { return __val; } var __result = await Factory.Create <ICustomerGroupData>().GetAsync(id, company); ExecutionContext.Current.CacheSet <CustomerGroup>(__key, __result); return __result; }));
/// <summary> /// Deletes the <see cref="CustomerGroup"/> object that matches the selection criteria. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> public Task DeleteAsync(string id, RefDataNamespace.Company company) { return(DataInvoker.Default.InvokeAsync(this, async() => { var __dataArgs = ODataMapper.Default.CreateArgs(); if (_deleteOnBeforeAsync != null) { await _deleteOnBeforeAsync(id, company, __dataArgs).ConfigureAwait(false); } await DynamicsAx.Default.DeleteAsync <CustomerGroup>(__dataArgs, id, ExternalCodeConverter <RefDataNamespace.Company> .Default.ConvertToDest(company)).ConfigureAwait(false); if (_deleteOnAfterAsync != null) { await _deleteOnAfterAsync(id, company).ConfigureAwait(false); } }, new BusinessInvokerArgs { ExceptionHandler = _deleteOnException })); }
/// <summary> /// Gets the <see cref="CustomerGroup"/> object that matches the selection criteria. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <returns>The selected <see cref="CustomerGroup"/> object where found; otherwise, <c>null</c>.</returns> public Task <CustomerGroup> GetAsync(string id, RefDataNamespace.Company company) { return(DataInvoker.Default.InvokeAsync(this, async() => { CustomerGroup __result = null; var __dataArgs = ODataMapper.Default.CreateArgs(); if (_getOnBeforeAsync != null) { await _getOnBeforeAsync(id, company, __dataArgs); } __result = await DynamicsAx.Default.GetAsync <CustomerGroup>(__dataArgs, id, ExternalCodeConverter <RefDataNamespace.Company> .Default.ConvertToDest(company)); if (_getOnAfterAsync != null) { await _getOnAfterAsync(__result, id, company); } return __result; }, new BusinessInvokerArgs { ExceptionHandler = _getOnException })); }
/// <summary> /// Updates the <see cref="CustomerGroup"/> object. /// </summary> /// <param name="value">The <see cref="CustomerGroup"/> object.</param> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult <CustomerGroup> > UpdateAsync(CustomerGroup value, string id, RefDataNamespace.Company company, WebApiRequestOptions requestOptions = null) { if (value == null) { throw new ArgumentNullException("value"); } return(CustomerGroupServiceAgent.UpdateAsync(value, id, company, requestOptions)); }
/// <summary> /// Gets the <see cref="CustomerGroup"/> object that matches the selection criteria. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult <CustomerGroup> > GetAsync(string id, RefDataNamespace.Company company, WebApiRequestOptions requestOptions = null) { return(CustomerGroupServiceAgent.GetAsync(id, company, requestOptions)); }
/// <summary> /// Upserts a <see cref="CustomerGroupCollection"/> as a batch. /// </summary> /// <param name="value">The Value (see <see cref="CustomerGroupCollection"/>).</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult> UpdateBatchAsync(CustomerGroupCollection value, RefDataNamespace.Company company, WebApiRequestOptions requestOptions = null) { return(CustomerGroupServiceAgent.UpdateBatchAsync(value, company, requestOptions)); }
/// <summary> /// Deletes the <see cref="CustomerGroup"/> object that matches the selection criteria. /// </summary> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult> DeleteAsync(string id, RefDataNamespace.Company company, WebApiRequestOptions requestOptions = null) { return(base.DeleteAsync("api/v1/customergroups/{company}/{id}", requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <string>("id", id), new WebApiArg <RefDataNamespace.Company>("company", company) })); }
/// <summary> /// Upserts a <see cref="CustomerGroupCollection"/> as a batch. /// </summary> /// <param name="value">The Value (see <see cref="CustomerGroupCollection"/>).</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult> UpdateBatchAsync(CustomerGroupCollection value, RefDataNamespace.Company company, WebApiRequestOptions requestOptions = null) { return(base.PutAsync("api/v1/customergroups/{company}", requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <CustomerGroupCollection>("value", value, WebApiArgType.FromBody), new WebApiArg <RefDataNamespace.Company>("company", company) })); }
/// <summary> /// Updates the <see cref="CustomerGroup"/> object. /// </summary> /// <param name="value">The <see cref="CustomerGroup"/> object.</param> /// <param name="id">The <see cref="CustomerGroup"/> identifier.</param> /// <param name="company">The Company (see <see cref="RefDataNamespace.Company"/>).</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult <CustomerGroup> > UpdateAsync(CustomerGroup value, string id, RefDataNamespace.Company company, WebApiRequestOptions requestOptions = null) { if (value == null) { throw new ArgumentNullException("value"); } return(base.PutAsync <CustomerGroup>("api/v1/customergroups/{company}/{id}", value, requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <string>("id", id), new WebApiArg <RefDataNamespace.Company>("company", company) })); }
/// <summary> /// Creates the <see cref="UniqueKey"/>. /// </summary> /// <returns>The <see cref="Beef.Entities.UniqueKey"/>.</returns> /// <param name="id">The <see cref="Id"/>.</param> /// <param name="company">The <see cref="Company"/>.</param> public static UniqueKey CreateUniqueKey(string id, RefDataNamespace.Company company) { return(new UniqueKey(id, (string)company)); }
partial void OnAfterCopyFrom(Company from);