Exemplo n.º 1
0
 public IEnumerable <ProductTypeView> FindByName(string name)
 {
     return(_unitOfWork.ProductTypeRepository
            .GetAll()
            .Where(type => type.Name.Contains(name))
            .Select(obj => ProductTypeMapper.ToViewEntity(obj)));
 }
Exemplo n.º 2
0
 public EditArticleTypeWindow(ProductType productType)
 {
     InitializeComponent();
     this.productTypeMapper         = new ProductTypeMapper(Utils.GetSqlSession());
     this.productType               = productType;
     this.productTypes              = this.productTypeMapper.Select(out _);
     parentTypeComboBox.ItemsSource = this.productTypes;
     this.setProductType(this.productType);
     deleteButton.IsEnabled = productType != null?true: false;
 }
Exemplo n.º 3
0
 public EditProductWindow(Product product)
 {
     InitializeComponent();
     this.productMapper              = new ProductMapper(Utils.GetSqlSession());
     this.productTypeMapper          = new ProductTypeMapper(Utils.GetSqlSession());
     this.productTypes               = this.productTypeMapper.Select(out _);
     productTypeComboBox.ItemsSource = this.productTypes;
     this.product = product;
     setProduct(product);
     deleteButton.IsEnabled = product != null ? true : false;
 }
Exemplo n.º 4
0
        public static List <ProductType> getProductTypesTree()
        {
            List <ProductType> ptL = new ProductTypeMapper(GetSqlSession()).Select(out _);


            foreach (ProductType pt in ptL)
            {
                pt.subTypes = ptL.Where(child => child.id_parent_product_type == pt.id)
                              .ToList();
            }
            return(ptL.Where(child => child.id_parent_product_type == null).ToList());;
        }
Exemplo n.º 5
0
 public ProductTypeView GetProductTypeByID(int productTypeId)
 {
     return(ProductTypeMapper.ToViewEntity(_unitOfWork.ProductTypeRepository.GetById(productTypeId)));
 }
Exemplo n.º 6
0
 public IEnumerable <ProductTypeView> GetAllProductTypes()
 {
     return(_unitOfWork.ProductTypeRepository
            .GetAll()
            .Select(obj => ProductTypeMapper.ToViewEntity(obj)));
 }
        public async Task <ProductType> GetByIdAsync(Guid id)
        {
            var productType = await _dbContext.ProductTypes.FindAsync(id);

            return(productType.IsNull() ? null : ProductTypeMapper.MapFrom(productType));
        }