public static bool WriteStringToDB(string Line) { string[] Objects = Line.Split(SEPARATOR); //Description; Ref; Marque; Famille; Sous - Famille; Prix H.T. string Description = Objects[0]; string Ref = Objects[1]; Brand Brand = new Brand(Objects[2]); Brand = BrandDAO.Add(Brand); Category Category = new Category(Objects[3]); Category = CategoryDAO.Add(Category); SubCategory SubCategory = new SubCategory(Objects[4], Category); SubCategory = SubCategoryDAO.Add(SubCategory); float Price = 0; Objects[5] = Objects[5].Replace(',', '.'); Price = float.Parse(Objects[5], CultureInfo.InvariantCulture.NumberFormat); Product Product = new Product(Description, Ref, Brand, SubCategory, Price, 0); if (ProductDAO.Add(Product) != null) { return(true); } else { return(false); } }
public void Add(Brand t) { brandDAO.Add(t); }