Example #1
0
 public bool Delete(int Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         ProductInCatalogEntity _ProductInCatalogEntity = new ProductInCatalogEntity(Id);
         if (adapter.FetchEntity(_ProductInCatalogEntity))
         {
             adapter.DeleteEntity(_ProductInCatalogEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Example #2
0
    EntityCollection<ProductInCatalogEntity> getGetListCat(ProductsEntity product)
    {
        EntityCollection<ProductInCatalogEntity> items = new EntityCollection<ProductInCatalogEntity>();

        int[] cats = ucCatalogs.getListCatId();
        for (int i = 0; i < cats.Length; i++)
        {
            ProductInCatalogEntity item = new ProductInCatalogEntity();
            item.ProductId = product.Id;
            item.CatId = cats[i];
            item.OrderIndex = i;

            items.Add(item);
        }

        return items;
    }
Example #3
0
        public bool Update(int Id, int CatId, Guid ProductId, int OrderIndex)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                ProductInCatalogEntity _ProductInCatalogEntity = new ProductInCatalogEntity(Id);
                if (adapter.FetchEntity(_ProductInCatalogEntity))
                {

                    _ProductInCatalogEntity.CatId = CatId;
                    _ProductInCatalogEntity.ProductId = ProductId;
                    _ProductInCatalogEntity.OrderIndex = OrderIndex;
                    adapter.SaveEntity(_ProductInCatalogEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Example #4
0
 public bool Update(ProductInCatalogEntity _ProductInCatalogEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_ProductInCatalogEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Example #5
0
        public bool Update(ProductInCatalogEntity _ProductInCatalogEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(ProductInCatalogFields.Id == _ProductInCatalogEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_ProductInCatalogEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Example #6
0
 public ProductInCatalogEntity SelectOne(int Id)
 {
     ProductInCatalogEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         ProductInCatalogEntity _ProductInCatalogEntity = new ProductInCatalogEntity(Id);
         if (adapter.FetchEntity(_ProductInCatalogEntity))
         {
             toReturn = _ProductInCatalogEntity;
         }
     }
     return toReturn;
 }
Example #7
0
        public ProductInCatalogEntity Insert(int CatId, Guid ProductId, int OrderIndex)
        {
            ProductInCatalogEntity _ProductInCatalogEntity = new ProductInCatalogEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _ProductInCatalogEntity.CatId = CatId;
                _ProductInCatalogEntity.ProductId = ProductId;
                _ProductInCatalogEntity.OrderIndex = OrderIndex;
                adapter.SaveEntity(_ProductInCatalogEntity, true);
            }
            return _ProductInCatalogEntity;
        }
Example #8
0
 public ProductInCatalogEntity Insert(ProductInCatalogEntity _ProductInCatalogEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_ProductInCatalogEntity, true);
     }
     return _ProductInCatalogEntity;
 }