Ejemplo n.º 1
0
        public List<Product> AddNewProduct(Product newProduct)
        {
            Product product;
            List<Product> products = new List<Product>();

            try
            {
                var myCommand = new SqlCommand(
                 "INSERT INTO Procucts VALUES", myConnection);

                // "SELECT * FROM Procucts", myConnection);
                while (myReader.Read())
                {
                    product = new Product();
                    products.Add(product);
                }
            }

            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            return products;
        }
Ejemplo n.º 2
0
 public Produkt_model(Product p)
 {
     Name = p.Name;
     Description = p.Description;
     Price = p.Price;
     Type = p.Type;
     ImagePath = p.ImagePath;
     Quantity = p.Quantity;
     AvailableWhenSold = p.AvailableWhenSold;
     ArtNumber = p.ArtNumber;
 }
Ejemplo n.º 3
0
 public void SaveToDB()
 {
     Product p = new Product() { Name = this.Name };
     Class1 c1 = new Class1();
     //c1.saveNewProduct(p);
 }
Ejemplo n.º 4
0
 public void saveProduct()
 {
     Product p =new Product() {Name = this.Name};
 }
Ejemplo n.º 5
0
        public List<Product> getProductInfo()
        {
            List<Product> products = new List<Product>();
            DatabaseConnection();
            try
            {
                var myCommand = new SqlCommand("SELECT * FROM Products", myConnection);
                myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    Product product = new Product();
                    product.Type = myReader["Type"].ToString();
                    product.Name = myReader["Name"].ToString();
                    product.Price = Convert.ToDouble(myReader["Price"]);
                    product.Description = myReader["Description"].ToString();
                    product.ArtNumber = myReader["ArtNumber"].ToString();
                    product.Quantity = Convert.ToInt32(myReader["Quantity"].ToString());
                    product.ImagePath = myReader["ImagePath"].ToString();
                    product.AvailableWhenSold = (bool)myReader["AvailableWhenSold"];

                    products.Add(product);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            CloseDatabaseConnection();

            return products;
        }