public async Task <CategorySalesReportByYear> RetrieveCategorySalesReportByYearAsync(
     CategorySalesReportByYear master,
     string currentYear,
     string lastYear,
     CancellationToken cancellationToken = default)
 {
     return(await _genericService.Get <CategorySalesReportByYear>()
            .RetrieveReportAsync(master, new object[] { currentYear, lastYear }, cancellationToken));
 }
        /// <inheritdoc />
        public async Task UpdateRelationshipAsync(object parent, RelationshipAttribute relationship, IReadOnlyCollection <string> relationshipIds)
        {
            _traceWriter.LogMethodStart(new { parent, relationship, relationshipIds });
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            if (relationship == null)
            {
                throw new ArgumentNullException(nameof(relationship));
            }
            if (relationshipIds == null)
            {
                throw new ArgumentNullException(nameof(relationshipIds));
            }

            var typeToUpdate = relationship is HasManyThroughAttribute hasManyThrough
                ? hasManyThrough.ThroughType
                : relationship.RightType;

            var helper = _genericServiceFactory.Get <IRepositoryRelationshipUpdateHelper>(typeof(RepositoryRelationshipUpdateHelper <>), typeToUpdate);
            await helper.UpdateRelationshipAsync((IIdentifiable)parent, relationship, relationshipIds);

            await _dbContext.SaveChangesAsync();
        }
Exemple #3
0
        public async Task <JsonResult> OnGetRetrieveProduct(int id)
        {
            var result = new Dictionary <string, object>()
            {
                { "code", 1 },

                { "product", await _genericServices.Get <DdOrderProduct>().RetrieveAsync(false, new object[] { id }) }
            };

            return(new JsonResult(result));
        }
Exemple #4
0
        public JsonResult OnGetRetrieveProduct(int id)
        {
            var result = new Dictionary <string, object>()
            {
                { "code", 1 },

                { "product", _genericServices.Get <DdOrderProduct>().Retrieve(false, id) }
            };

            return(new JsonResult(result));
        }
Exemple #5
0
        /// <inheritdoc/>
        public IResourceHookContainer GetResourceHookContainer(RightType rightType, ResourceHook hook = ResourceHook.None)
        {
            // checking the cache if we have a reference for the requested container,
            // regardless of the hook we will use it for. If the value is null,
            // it means there was no implementation IResourceHookContainer at all,
            // so we need not even bother.
            if (!_hookContainers.TryGetValue(rightType, out IResourceHookContainer container))
            {
                container = (_genericProcessorFactory.Get <IResourceHookContainer>(typeof(ResourceDefinition <>), rightType));
                _hookContainers[rightType] = container;
            }
            if (container == null)
            {
                return(container);
            }

            // if there was a container, first check if it implements the hook we
            // want to use it for.
            List <ResourceHook> targetHooks;

            if (hook == ResourceHook.None)
            {
                CheckForTargetHookExistence();
                targetHooks = _targetedHooksForRelatedEntities;
            }
            else
            {
                targetHooks = new List <ResourceHook>()
                {
                    hook
                };
            }

            foreach (ResourceHook targetHook in targetHooks)
            {
                if (ShouldExecuteHook(rightType, targetHook))
                {
                    return(container);
                }
            }
            return(null);
        }
        /// <inheritdoc />
        public async Task UpdateRelationshipsAsync(object parent, RelationshipAttribute relationship, IEnumerable <string> relationshipIds)
        {
            var typeToUpdate = (relationship is HasManyThroughAttribute hasManyThrough)
                ? hasManyThrough.ThroughType
                : relationship.RightType;

            var helper = _genericServiceFactory.Get <IRepositoryRelationshipUpdateHelper>(typeof(RepositoryRelationshipUpdateHelper <>), typeToUpdate);
            await helper.UpdateRelationshipAsync((IIdentifiable)parent, relationship, relationshipIds);

            await _context.SaveChangesAsync();
        }
Exemple #7
0
        public JsonResult OnGetRetrieveDddw(int customerId)
        {
            var result = new Dictionary <string, object>()
            {
                { "code", 1 },

                { "creditcards", _genericServices.Get <DdCreditcard>()
                  .Retrieve(false, customerId) },

                { "customerAddresses", _genericServices.Get <DdCustomerAddress>()
                  .Retrieve(false, customerId) }
            };

            return(new JsonResult(result));
        }
        public async Task <JsonResult> OnGetRetrieveDddw(int customerId)
        {
            var result = new Dictionary <string, object>()
            {
                { "code", 1 },

                { "creditcards", await _genericServices.Get <DdCreditcard>()
                  .RetrieveAsync(false, new object[] { customerId }) },

                { "customerAddresses", await _genericServices.Get <DdCustomerAddress>()
                  .RetrieveAsync(false, new object[] { customerId }) }
            };

            return(new JsonResult(result));
        }
 public CategorySalesReportByYear RetrieveCategorySalesReportByYear(
     CategorySalesReportByYear master, string currentYear, string lastYear)
 {
     return(_genericService.Get <CategorySalesReportByYear>().RetrieveReport(master, currentYear, lastYear));
 }