Exemplo n.º 1
0
        public List<Brand> GetBrands(string categoryUrl, bool includeChildrenCategories = false)
        {
            CategoryDL categoryDL = new CategoryDL();
            Category category = categoryDL.GetCategoryByUrl(categoryUrl);

            BrandDL brandDL = new BrandDL();
            return brandDL.GetBrands(category.CategoryID, includeChildrenCategories);
        }
Exemplo n.º 2
0
        public List<Brand> GetBrands(string categoryUrl)
        {
            CategoryDL categoryDL = new CategoryDL();
            Category category = categoryDL.GetCategoryByUrl(categoryUrl);

            BrandDL brandDL = new BrandDL();
            return category != null ? brandDL.GetBrands(category.CategoryID) : null;
        }
Exemplo n.º 3
0
 public int SaveBrand(Brand brand)
 {
     BrandDL brandDL=new BrandDL();
     if (brand.BrandID > 0)
     {
         return brandDL.UpdateBrand(brand);
     }
     else
         return brandDL.SaveBrand(brand);
 }
Exemplo n.º 4
0
        public List<Brand> GetBrands(bool allSelection)
        {
            BrandDL brandDL = new BrandDL();
            List<Brand> brands = brandDL.GetBrands();

            if (allSelection && brands != null)
                brands.Insert(0, new Brand(-1, "Sve"));

            return brands;
        }
Exemplo n.º 5
0
 public Brand GetBrandByName(string name)
 {
     BrandDL brandDL = new BrandDL();
     return brandDL.GetBrandByName(name);
 }
Exemplo n.º 6
0
 public int DeleteBrand(int brandID)
 {
     BrandDL brandDL = new BrandDL();
     return brandDL.DeleteBrand(brandID);
 }
Exemplo n.º 7
0
        public bool SaveProduct(string code, bool isActive, bool isApproved, int categoryID, int kimtecCategoryID)
        {
            //int newProducts = 0;
            //int updatedProducts = 0;

            DataTable kimtecProduct = new KimtecDL().GetProductBySupplierCode(code);
            Category category = new CategoryDL().GetCategory(categoryID);

            Product product = new Product();
            product.IsApproved = isApproved;
            product.IsActive = isActive;
            product.SupplierID = 1004;
            product.SupplierCode = code;
            product.VatID = 4;
            product.Categories = new List<Category>();
            product.Categories.Add(category);
            product.Specification = string.Empty;
            product.IsInStock = true;
            bool isNew = false;
            bool isLocked = false;
            product.Code = code;

            product.ProductID = new ProductDL().GetProductIDBySupplierCode(code);
            if (product.ProductID <= 0)
                isNew = true;
            isLocked = new ProductDL().IsLocked(product.ProductID);

            Brand brand = new BrandDL().GetBrandByName(kimtecProduct.Rows[0]["brand"].ToString());
            if(brand == null)
            {
                brand = new Brand();
                brand.Name = kimtecProduct.Rows[0]["brand"].ToString();
                brand.BrandID = new BrandDL().SaveBrand(brand);
            }
            if (product.Brand == null)
                product.Brand = new Brand();
            product.Brand = brand;

            product.Name = kimtecProduct.Rows[0]["name"].ToString();
            product.Price = calculatePrice(double.Parse(kimtecProduct.Rows[0]["partnerPrice"].ToString()), category.PricePercent);
            product.WebPrice = calculatePrice(double.Parse(kimtecProduct.Rows[0]["partnerPrice"].ToString()), category.WebPricePercent);
            product.Ean = kimtecProduct.Rows[0]["barcodeValue"].ToString();
            product.SupplierPrice = double.Parse(kimtecProduct.Rows[0]["partnerPrice"].ToString());
            product.Images = new List<string>();
            product.Images.Add(saveProductImage(kimtecProduct.Rows[0]["imageUrl"].ToString()));
            product.Attributes = GetProductAttributes(code, kimtecCategoryID);
            product.Description = kimtecProduct.Rows[0]["marketingDescription"].ToString();

            if (!isLocked)
                if (new ProductBL().SaveProduct(product) > 0)
                    return true;

            return false;

            //return new int[] { newProducts, updatedProducts };
        }