public void Upload(List <ExtraIngredient> extraIngredienten)
        {
            log.Info("- - - - -");
            log.Info("Running : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            log.Info("- - - - -");

            //Drop table and create new one
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "DROP TABLE IF EXISTS dbo.ExtraIngredienten";
                command.ExecuteNonQuery();
                command.CommandText = "CREATE TABLE dbo.ExtraIngredienten (Ingredient varchar(200), ExtraPrice varchar(200))";
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }


            foreach (ExtraIngredient extraIngredient in extraIngredienten)
            {
                ExecuteQuery(extraIngredient.Name.ToString(), extraIngredient.ExtraPrice.ToString());
            }
        }
        private void ExecuteQuery(
            string Name,
            string Diameter,
            string Description,
            string Fee,
            string Available)
        {
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            String query = "INSERT INTO dbo.PizzaBodems (Naam,Diameter,Omschrijving,Toeslag,Beschikbaar) VALUES (@Naam,@Diameter,@Omschrijving,@Toeslag,@Beschikbaar)";

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = query;

                command.Parameters.AddWithValue("@Naam ", Name);
                command.Parameters.AddWithValue("@Diameter ", Diameter);
                command.Parameters.AddWithValue("@Omschrijving ", Description);
                command.Parameters.AddWithValue("@Toeslag ", Fee);
                command.Parameters.AddWithValue("@Beschikbaar ", Available);

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
        private void ExecuteQuery(string ingredient, string price)
        {
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            String query = "INSERT INTO dbo.ExtraIngredienten (Ingredient,ExtraPrice) VALUES (@Ingredient,@ExtraPrice)";

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = query;
                command.Parameters.AddWithValue("@Ingredient ", ingredient);
                command.Parameters.AddWithValue("@ExtraPrice ", price);
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
コード例 #4
0
        public void Upload(List <Order> orders)
        {
            log.Info("- - - - -");
            log.Info("Running : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            log.Info("- - - - -");

            //Drop table and create new one
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "DROP TABLE IF EXISTS dbo.MarioOrderData";
                command.ExecuteNonQuery();
                command.CommandText = "CREATE TABLE dbo.MarioOrderData (Orderid int IDENTITY, Winkelnaam varchar(200),Klantnaam varchar(200),Telefoon varchar(200),Email varchar(200),Adres varchar(200),Woonplaats varchar(200),Besteldatum varchar(200),AfleverType varchar(200),AfleverDatum varchar(200),AfleverMoment varchar(200),Product varchar(200),PizzaBodem varchar(200),PizzaSaus varchar(200),Prijs varchar(200),Bezorgkosten varchar(200),Aantal varchar(200),ExtraIngredienten varchar(200),PrijsExtraIngredient varchar(200),Regelprijs varchar(200),Totaalprijs varchar(200),GebruikteCoupon varchar(200),CouponKorting varchar(200),TeBetalen varchar(200))";
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }

            foreach (Order order in orders)
            {
                ExecuteQuery(order.StoreName.ToString(),
                             order.CustomerName.ToString(),
                             order.PhoneNumber.ToString(),
                             order.Email.ToString(),
                             order.Address.ToString(),
                             order.City.ToString(),
                             order.OrderDate.ToString(),
                             order.DeliveryType.ToString(),
                             order.DeliveryDate.ToString(),
                             order.DeliveryTime.ToString(),
                             order.Product.ToString(),
                             order.PizzaCrust.ToString(),
                             order.PizzaSauce.ToString(),
                             order.Price.ToString(),
                             order.DeliveryCost.ToString(),
                             order.Amount.ToString(),
                             order.ExtraIngredients.ToString(),
                             order.ExtraIngredientPrice.ToString(),
                             order.LinePrice.ToString(),
                             order.TotalPrice.ToString(),
                             order.UsedVoucher.ToString(),
                             order.VoucherDiscount.ToString(),
                             order.TotalPriceAfterDiscount.ToString());
            }
        }
コード例 #5
0
        private void ExecuteQuery(
            string Category,
            string Subcategory,
            string Name,
            string Description,
            string Price,
            string DeliveryFee,
            string Spicy,
            string Vegetarian,
            string Availability,
            string Amount,
            string IngredientName,
            string StandardSauce)
        {
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            String query = "INSERT INTO dbo.PizzaIngredienten (Categorie,Subcategorie,Productnaam,Productomschrijving,Prijs,Bezorgtoeslag,Spicy,Vegetarisch,Beschikbaar,AantaalkeerIngredient,Ingredientnaam,PizzasausStandaard) VALUES (@Categorie,@Subcategorie,@Productnaam,@Productomschrijving,@Prijs,@Bezorgtoeslag,@Spicy,@Vegetarisch,@Beschikbaar,@AantaalkeerIngredient,@Ingredientnaam,@PizzasausStandaard)";

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = query;

                command.Parameters.AddWithValue("@Categorie ", Category);
                command.Parameters.AddWithValue("@Subcategorie ", Subcategory);
                command.Parameters.AddWithValue("@Productnaam ", Name);
                command.Parameters.AddWithValue("@Productomschrijving ", Description);
                command.Parameters.AddWithValue("@Prijs ", Price);
                command.Parameters.AddWithValue("@Bezorgtoeslag ", DeliveryFee);
                command.Parameters.AddWithValue("@Spicy ", Spicy);
                command.Parameters.AddWithValue("@Vegetarisch ", Vegetarian);
                command.Parameters.AddWithValue("@Beschikbaar ", Availability);
                command.Parameters.AddWithValue("@AantaalkeerIngredient ", Amount);
                command.Parameters.AddWithValue("@Ingredientnaam ", IngredientName);
                command.Parameters.AddWithValue("@PizzasausStandaard ", StandardSauce);

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
コード例 #6
0
        public void Upload(List <PizzaIngredient> pizzaIngredienten)
        {
            log.Info("- - - - -");
            log.Info("Running : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            log.Info("- - - - -");

            //Drop table and create new one
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "DROP TABLE IF EXISTS dbo.PizzaIngredienten";
                command.ExecuteNonQuery();
                command.CommandText = "CREATE TABLE dbo.PizzaIngredienten (Categorie varchar(200),Subcategorie varchar(200),Productnaam varchar(200),Productomschrijving varchar(500),Prijs varchar(200),Bezorgtoeslag varchar(200),Spicy varchar(200),Vegetarisch varchar(200),Beschikbaar varchar(200),AantaalkeerIngredient varchar(200),Ingredientnaam varchar(200),PizzasausStandaard varchar(200))";
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }

            foreach (PizzaIngredient pizzaIngredient in pizzaIngredienten)
            {
                ExecuteQuery(pizzaIngredient.Category.ToString(),
                             pizzaIngredient.Subcategory.ToString(),
                             pizzaIngredient.Name.ToString(),
                             pizzaIngredient.Description.ToString(),
                             pizzaIngredient.Price.ToString(),
                             pizzaIngredient.DeliveryFee.ToString(),
                             pizzaIngredient.Spicy.ToString(),
                             pizzaIngredient.Vegetarian.ToString(),
                             pizzaIngredient.Availability.ToString(),
                             pizzaIngredient.Amount.ToString(),
                             pizzaIngredient.IngredientName.ToString(),
                             pizzaIngredient.StandardSauce.ToString());
            }
        }
コード例 #7
0
        private void ExecuteQuery(
            string Name,
            string Streetname,
            string Number,
            string City,
            string Countrycode,
            string Zipcode,
            string Telephonenumber)
        {
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            String query = "INSERT INTO dbo.Winkels (Naam,Straat,Nummer,Plaats,LandCode,Postcode,Telefoon) VALUES (@Naam,@Straat,@Nummer,@Plaats,@LandCode,@Postcode,@Telefoon)";

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = query;

                command.Parameters.AddWithValue("@Naam ", Name);
                command.Parameters.AddWithValue("@Straat ", Streetname);
                command.Parameters.AddWithValue("@Nummer ", Number);
                command.Parameters.AddWithValue("@Plaats ", City);
                command.Parameters.AddWithValue("@LandCode ", Countrycode);
                command.Parameters.AddWithValue("@Postcode ", Zipcode);
                command.Parameters.AddWithValue("@Telefoon ", Telephonenumber);

                command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                logwarn.Warn(e.Message);
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
コード例 #8
0
        public void Upload(List <Winkel> winkels)
        {
            log.Info("- - - - -");
            log.Info("Running : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            log.Info("- - - - -");

            //Drop table and create new one
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "DROP TABLE IF EXISTS dbo.Winkels";
                command.ExecuteNonQuery();
                command.CommandText = "CREATE TABLE dbo.Winkels (Naam varchar(200),Straat varchar(200),Nummer varchar(200),Plaats varchar(200),LandCode varchar(200),Postcode varchar(200),Telefoon varchar(200))";
                command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                logwarn.Warn(e.Message);
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }

            foreach (Winkel winkel in winkels)
            {
                ExecuteQuery(winkel.Name.ToString(),
                             winkel.Streetname.ToString(),
                             winkel.Number.ToString(),
                             winkel.City.ToString(),
                             winkel.Countrycode.ToString(),
                             winkel.Zipcode.ToString(),
                             winkel.Telephonenumber.ToString());
            }
        }
        private void ExecuteQuery(
            string Category,
            string Subcategory,
            string Name,
            string Description,
            string Price,
            string Spicy,
            string Vegetarian)
        {
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            String query = "INSERT INTO dbo.OverigeProducten (Categorie,Subcategorie,Productnaam,Productomschrijving,Prijs,Spicy,Vegetarisch) VALUES (@Categorie,@Subcategorie,@Productnaam,@Productomschrijving,@Prijs,@Spicy,@Vegetarisch)";

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = query;

                command.Parameters.AddWithValue("@Categorie ", Category);
                command.Parameters.AddWithValue("@Subcategorie ", Subcategory);
                command.Parameters.AddWithValue("@Productnaam ", Name);
                command.Parameters.AddWithValue("@Productomschrijving ", Description);
                command.Parameters.AddWithValue("@Prijs ", Price);
                command.Parameters.AddWithValue("@Spicy ", Spicy);
                command.Parameters.AddWithValue("@Vegetarisch ", Vegetarian);

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
        public void Upload(List <OverigProduct> overigeProducten)
        {
            log.Info("- - - - -");
            log.Info("Running : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            log.Info("- - - - -");

            //Drop table and create new one
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "DROP TABLE IF EXISTS dbo.OverigeProducten";
                command.ExecuteNonQuery();
                command.CommandText = "CREATE TABLE dbo.OverigeProducten (Categorie varchar(200),Subcategorie varchar(200),Productnaam varchar(200),Productomschrijving varchar(200),Prijs varchar(200),Spicy varchar(200),Vegetarisch varchar(200))";
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }

            foreach (OverigProduct overigProduct in overigeProducten)
            {
                ExecuteQuery(overigProduct.Category.ToString(),
                             overigProduct.Subcategory.ToString(),
                             overigProduct.Name.ToString(),
                             overigProduct.Description.ToString(),
                             overigProduct.Price.ToString(),
                             overigProduct.Spicy.ToString(),
                             overigProduct.Vegetarian.ToString());
            }
        }
        public void Upload(List <PizzaBodem> pizzaBodems)
        {
            log.Info("- - - - -");
            log.Info("Running : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            log.Info("- - - - -");

            //Drop table and create new one
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "DROP TABLE IF EXISTS dbo.PizzaBodems";
                command.ExecuteNonQuery();
                command.CommandText = "CREATE TABLE dbo.PizzaBodems (Naam varchar(200),Diameter varchar(200),Omschrijving varchar(200),Toeslag varchar(200),Beschikbaar varchar(200))";
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }

            foreach (PizzaBodem pizzaBodem in pizzaBodems)
            {
                ExecuteQuery(pizzaBodem.Name.ToString(),
                             pizzaBodem.Diameter.ToString(),
                             pizzaBodem.Description.ToString(),
                             pizzaBodem.Fee.ToString(),
                             pizzaBodem.Available.ToString());
            }
        }
コード例 #12
0
        private void ExecuteQuery(
            string StoreName,
            string CustomerName,
            string PhoneNumber,
            string Email,
            string Address,
            string City,
            string OrderDate,
            string DeliveryType,
            string DeliveryDate,
            string DeliveryTime,
            string Product,
            string PizzaCrust,
            string PizzaSauce,
            string Price,
            string DeliveryCost,
            string Amount,
            string ExtraIngredients,
            string ExtraIngredientPrice,
            string LinePrice,
            string TotalPrice,
            string UsedVoucher,
            string VoucherDiscount,
            string TotalPriceAfterDiscount)
        {
            SqlConnection conn = SqlConnectionMaker.ReturnConnection();

            String query = "INSERT INTO dbo.MarioOrderData (Winkelnaam,Klantnaam,Telefoon,Email,Adres,Woonplaats,Besteldatum,AfleverType,AfleverDatum,AfleverMoment,Product,PizzaBodem,PizzaSaus,Prijs,Bezorgkosten,Aantal,ExtraIngredienten,PrijsExtraIngredient,Regelprijs,Totaalprijs,GebruikteCoupon,CouponKorting,TeBetalen) VALUES (@Winkelnaam,@Klantnaam,@Telefoon,@Email,@Adres,@Woonplaats,@Besteldatum,@AfleverType,@AfleverDatum,@AfleverMoment,@Product,@PizzaBodem,@PizzaSaus,@Prijs,@Bezorgkosten,@Aantal,@ExtraIngredienten,@PrijsExtraIngredient,@Regelprijs,@Totaalprijs,@GebruikteCoupon,@CouponKorting,@TeBetalen)";

            log.Info(Product + PizzaCrust);
            try
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = query;

                command.Parameters.AddWithValue("@Winkelnaam ", StoreName);
                command.Parameters.AddWithValue("@Klantnaam ", CustomerName);
                command.Parameters.AddWithValue("@Telefoon ", PhoneNumber);
                command.Parameters.AddWithValue("@Email ", Email);
                command.Parameters.AddWithValue("@Adres ", Address);
                command.Parameters.AddWithValue("@Woonplaats ", City);
                command.Parameters.AddWithValue("@Besteldatum ", OrderDate);
                command.Parameters.AddWithValue("@AfleverType ", DeliveryType);
                command.Parameters.AddWithValue("@AfleverDatum ", DeliveryDate);
                command.Parameters.AddWithValue("@AfleverMoment ", DeliveryTime);
                command.Parameters.AddWithValue("@Product ", Product);
                command.Parameters.AddWithValue("@PizzaBodem ", PizzaCrust);
                command.Parameters.AddWithValue("@PizzaSaus ", PizzaSauce);
                command.Parameters.AddWithValue("@Prijs ", Price);
                command.Parameters.AddWithValue("@Bezorgkosten ", DeliveryCost);
                command.Parameters.AddWithValue("@Aantal ", Amount);
                command.Parameters.AddWithValue("@ExtraIngredienten ", ExtraIngredients);
                command.Parameters.AddWithValue("@PrijsExtraIngredient ", ExtraIngredientPrice);
                command.Parameters.AddWithValue("@Regelprijs ", LinePrice);
                command.Parameters.AddWithValue("@Totaalprijs ", TotalPrice);
                command.Parameters.AddWithValue("@GebruikteCoupon ", UsedVoucher);
                command.Parameters.AddWithValue("@CouponKorting ", VoucherDiscount);
                command.Parameters.AddWithValue("@TeBetalen ", TotalPriceAfterDiscount);

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }