public async Task <int> Count(CustomerSalesOrderContentFilter CustomerSalesOrderContentFilter)
        {
            try
            {
                int result = await UOW.CustomerSalesOrderContentRepository.Count(CustomerSalesOrderContentFilter);

                return(result);
            }
            catch (Exception ex)
            {
                await Logging.CreateSystemLog(ex, nameof(CustomerSalesOrderContentService));
            }
            return(0);
        }
        public async Task <List <CustomerSalesOrderContent> > List(CustomerSalesOrderContentFilter CustomerSalesOrderContentFilter)
        {
            try
            {
                List <CustomerSalesOrderContent> CustomerSalesOrderContents = await UOW.CustomerSalesOrderContentRepository.List(CustomerSalesOrderContentFilter);

                return(CustomerSalesOrderContents);
            }
            catch (Exception ex)
            {
                await Logging.CreateSystemLog(ex, nameof(CustomerSalesOrderContentService));
            }
            return(null);
        }
        public async Task <bool> ValidateId(CustomerSalesOrderContent CustomerSalesOrderContent)
        {
            CustomerSalesOrderContentFilter CustomerSalesOrderContentFilter = new CustomerSalesOrderContentFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = CustomerSalesOrderContent.Id
                },
                Selects = CustomerSalesOrderContentSelect.Id
            };

            int count = await UOW.CustomerSalesOrderContentRepository.Count(CustomerSalesOrderContentFilter);

            if (count == 0)
            {
                CustomerSalesOrderContent.AddError(nameof(CustomerSalesOrderContentValidator), nameof(CustomerSalesOrderContent.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
 public async Task <CustomerSalesOrderContentFilter> ToFilter(CustomerSalesOrderContentFilter filter)
 {
     if (filter.OrFilter == null)
     {
         filter.OrFilter = new List <CustomerSalesOrderContentFilter>();
     }
     if (CurrentContext.Filters == null || CurrentContext.Filters.Count == 0)
     {
         return(filter);
     }
     foreach (var currentFilter in CurrentContext.Filters)
     {
         CustomerSalesOrderContentFilter subFilter = new CustomerSalesOrderContentFilter();
         filter.OrFilter.Add(subFilter);
         List <FilterPermissionDefinition> FilterPermissionDefinitions = currentFilter.Value;
         foreach (FilterPermissionDefinition FilterPermissionDefinition in FilterPermissionDefinitions)
         {
             if (FilterPermissionDefinition.Name == nameof(subFilter.Id))
             {
                 subFilter.Id = FilterBuilder.Merge(subFilter.Id, FilterPermissionDefinition.IdFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.CustomerSalesOrderId))
             {
                 subFilter.CustomerSalesOrderId = FilterBuilder.Merge(subFilter.CustomerSalesOrderId, FilterPermissionDefinition.IdFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.ItemId))
             {
                 subFilter.ItemId = FilterBuilder.Merge(subFilter.ItemId, FilterPermissionDefinition.IdFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.UnitOfMeasureId))
             {
                 subFilter.UnitOfMeasureId = FilterBuilder.Merge(subFilter.UnitOfMeasureId, FilterPermissionDefinition.IdFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.Quantity))
             {
                 subFilter.Quantity = FilterBuilder.Merge(subFilter.Quantity, FilterPermissionDefinition.LongFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.RequestedQuantity))
             {
                 subFilter.RequestedQuantity = FilterBuilder.Merge(subFilter.RequestedQuantity, FilterPermissionDefinition.LongFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.PrimaryUnitOfMeasureId))
             {
                 subFilter.PrimaryUnitOfMeasureId = FilterBuilder.Merge(subFilter.PrimaryUnitOfMeasureId, FilterPermissionDefinition.IdFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.SalePrice))
             {
                 subFilter.SalePrice = FilterBuilder.Merge(subFilter.SalePrice, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.PrimaryPrice))
             {
                 subFilter.PrimaryPrice = FilterBuilder.Merge(subFilter.PrimaryPrice, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.DiscountPercentage))
             {
                 subFilter.DiscountPercentage = FilterBuilder.Merge(subFilter.DiscountPercentage, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.DiscountAmount))
             {
                 subFilter.DiscountAmount = FilterBuilder.Merge(subFilter.DiscountAmount, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.GeneralDiscountPercentage))
             {
                 subFilter.GeneralDiscountPercentage = FilterBuilder.Merge(subFilter.GeneralDiscountPercentage, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.GeneralDiscountAmount))
             {
                 subFilter.GeneralDiscountAmount = FilterBuilder.Merge(subFilter.GeneralDiscountAmount, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.TaxPercentage))
             {
                 subFilter.TaxPercentage = FilterBuilder.Merge(subFilter.TaxPercentage, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.TaxAmount))
             {
                 subFilter.TaxAmount = FilterBuilder.Merge(subFilter.TaxAmount, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.TaxPercentageOther))
             {
                 subFilter.TaxPercentageOther = FilterBuilder.Merge(subFilter.TaxPercentageOther, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.TaxAmountOther))
             {
                 subFilter.TaxAmountOther = FilterBuilder.Merge(subFilter.TaxAmountOther, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.Amount))
             {
                 subFilter.Amount = FilterBuilder.Merge(subFilter.Amount, FilterPermissionDefinition.DecimalFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.Factor))
             {
                 subFilter.Factor = FilterBuilder.Merge(subFilter.Factor, FilterPermissionDefinition.LongFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(subFilter.EditedPriceStatusId))
             {
                 subFilter.EditedPriceStatusId = FilterBuilder.Merge(subFilter.EditedPriceStatusId, FilterPermissionDefinition.IdFilter);
             }
             if (FilterPermissionDefinition.Name == nameof(CurrentContext.UserId) && FilterPermissionDefinition.IdFilter != null)
             {
                 if (FilterPermissionDefinition.IdFilter.Equal.HasValue && FilterPermissionDefinition.IdFilter.Equal.Value == CurrentUserEnum.IS.Id)
                 {
                 }
                 if (FilterPermissionDefinition.IdFilter.Equal.HasValue && FilterPermissionDefinition.IdFilter.Equal.Value == CurrentUserEnum.ISNT.Id)
                 {
                 }
             }
         }
     }
     return(filter);
 }