Beispiel #1
0
 public async Task <bool> Delete(ProductGrouping ProductGrouping)
 {
     if (await ValidateId(ProductGrouping))
     {
     }
     return(ProductGrouping.IsValidated);
 }
        public async Task <ProductGrouping> Get(long Id)
        {
            ProductGrouping ProductGrouping = await DataContext.ProductGrouping.AsNoTracking()
                                              .Where(x => x.Id == Id).Select(x => new ProductGrouping()
            {
                CreatedAt   = x.CreatedAt,
                UpdatedAt   = x.UpdatedAt,
                Id          = x.Id,
                Code        = x.Code,
                Name        = x.Name,
                Description = x.Description,
                ParentId    = x.ParentId,
                Path        = x.Path,
                Level       = x.Level,
                Parent      = x.Parent == null ? null : new ProductGrouping
                {
                    Id          = x.Parent.Id,
                    Code        = x.Parent.Code,
                    Name        = x.Parent.Name,
                    Description = x.Parent.Description,
                    ParentId    = x.Parent.ParentId,
                    Path        = x.Parent.Path,
                    Level       = x.Parent.Level,
                },
            }).FirstOrDefaultAsync();

            if (ProductGrouping == null)
            {
                return(null);
            }

            return(ProductGrouping);
        }
        public async Task <ProductGrouping> Get(long Id)
        {
            ProductGrouping ProductGrouping = await UOW.ProductGroupingRepository.Get(Id);

            if (ProductGrouping == null)
            {
                return(null);
            }
            return(ProductGrouping);
        }
Beispiel #4
0
        public Opportunity_ProductGroupingDTO(ProductGrouping ProductGrouping)
        {
            this.Id = ProductGrouping.Id;

            this.Code = ProductGrouping.Code;

            this.Name = ProductGrouping.Name;

            this.ParentId = ProductGrouping.ParentId;

            this.Path = ProductGrouping.Path;

            this.Description = ProductGrouping.Description;
        }
Beispiel #5
0
        public OrderQuote_ProductGroupingDTO(ProductGrouping ProductGrouping)
        {
            this.Id = ProductGrouping.Id;

            this.Code = ProductGrouping.Code;

            this.Name = ProductGrouping.Name;

            this.ParentId = ProductGrouping.ParentId;

            this.Path = ProductGrouping.Path;

            this.Description = ProductGrouping.Description;
        }
Beispiel #6
0
        public DirectSalesOrder_ProductGroupingDTO(ProductGrouping ProductGrouping)
        {
            this.Id = ProductGrouping.Id;

            this.Code = ProductGrouping.Code;

            this.Name = ProductGrouping.Name;

            this.ParentId = ProductGrouping.ParentId;

            this.Path = ProductGrouping.Path;

            this.Description = ProductGrouping.Description;
        }
Beispiel #7
0
        public CustomerLead_ProductGroupingDTO(ProductGrouping ProductGrouping)
        {
            this.Id = ProductGrouping.Id;

            this.Code = ProductGrouping.Code;

            this.Name = ProductGrouping.Name;

            this.ParentId = ProductGrouping.ParentId;

            this.Path = ProductGrouping.Path;

            this.Description = ProductGrouping.Description;
        }
Beispiel #8
0
        public async Task <bool> ValidateId(ProductGrouping ProductGrouping)
        {
            ProductGroupingFilter ProductGroupingFilter = new ProductGroupingFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = ProductGrouping.Id
                },
                Selects = ProductGroupingSelect.Id
            };

            int count = await UOW.ProductGroupingRepository.Count(ProductGroupingFilter);

            if (count == 0)
            {
                ProductGrouping.AddError(nameof(ProductGroupingValidator), nameof(ProductGrouping.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
Beispiel #9
0
 public async Task <bool> Create(ProductGrouping ProductGrouping)
 {
     return(ProductGrouping.IsValidated);
 }