示例#1
0
        public bool KeurWinkelAf(Winkel winkel)
        {
            this.ResetErrorMessage();

            bool succes = false;

            try
            {
                this.MySqlConnection.Open();

                string sql = $"DELETE FROM tblwinkel WHERE winkelnr = {winkel.winkelnr}";

                MySqlCommand command = new MySqlCommand(sql, this.MySqlConnection);

                if (command.ExecuteNonQuery() > 0)
                {
                    succes = true;
                }
            }
            catch (MySqlException ex)
            {
                this.ErrorMessage = ex.ToString();
                succes            = false;
            }

            this.MySqlConnection.Close();

            return(succes);
        }
示例#2
0
        public bool AddWinkel(Winkel winkel)
        {
            this.ResetErrorMessage();

            bool succes = false;

            try
            {
                this.MySqlConnection.Open();

                string sql = $"INSERT INTO tblwinkel(naam, beheerder, actief, goedgekeurd, adress) VALUES(@naam, @beheerder, @actief, @goedgekeurd, @adress);";

                MySqlCommand command = new MySqlCommand(sql, this.MySqlConnection);

                command.Parameters.AddWithValue("@naam", winkel.naam);
                command.Parameters.AddWithValue("@beheerder", winkel.beheerder);
                command.Parameters.AddWithValue("@actief", (winkel.actief) ? 1 : 0);
                command.Parameters.AddWithValue("@goedgekeurd", winkel.goedgekeurd);
                command.Parameters.AddWithValue("@adress", winkel.adress);

                if (command.ExecuteNonQuery() > 0)
                {
                    succes = true;
                }
            }
            catch (MySqlException ex)
            {
                this.ErrorMessage = ex.ToString();
                succes            = false;
            }

            this.MySqlConnection.Close();

            return(succes);
        }
示例#3
0
        public bool UpdateWinkel(Winkel winkel)
        {
            this.ResetErrorMessage();

            bool succes = false;

            try
            {
                this.MySqlConnection.Open();

                string sql = $"UPDATE tblwinkel SET beheerder = @beheerder WHERE winkelnr = {winkel.winkelnr}";

                MySqlCommand command = new MySqlCommand(sql, this.MySqlConnection);

                command.Parameters.AddWithValue("@beheerder", winkel.beheerder);

                var temp = command.ExecuteNonQuery();

                if (temp > 0)
                {
                    succes = true;
                }
            }
            catch (MySqlException ex)
            {
                this.ErrorMessage = ex.ToString();
                succes            = false;
            }

            this.MySqlConnection.Close();

            return(succes);
        }
示例#4
0
        static void Main(string[] args)
        {
            NawQueueArray nawQueueArray = new NawQueueArray(4);

            NAW naw1 = new NAW("ABC", "straat", "schijndel");
            NAW naw2 = new NAW("YIJD", "dropstraat", "den bosch");
            NAW naw3 = new NAW("DEF", "kerkstraat", "amsterdam");
            NAW naw4 = new NAW("DEF", "dorpstraat", "amsterdam");
            NAW naw5 = new NAW("ABC", "kerkstraat", "amsterdam");

            nawQueueArray.Enqueue(naw1);
            nawQueueArray.Enqueue(naw2);
            nawQueueArray.Enqueue(naw3);
            nawQueueArray.Enqueue(naw4);
            nawQueueArray.Dequeue();

            nawQueueArray.Enqueue(naw5);
            nawQueueArray.Enqueue(naw1);

            var winkel = new Winkel(3, 8, 10);

            winkel.Run();

            System.Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("I'm alive!");

            Winkel         w  = new Winkel();
            Sales          s  = new Sales();
            Stockbeheer    sb = new Stockbeheer();
            Groothandelaar g  = new Groothandelaar();

            w.BestellingEvent   += s.Add_bestelling;
            w.BestellingEvent   += sb.Add_bestelling;
            sb.StockbeheerEvent += g.Add_bestelling;

            w.VerkoopProduct(new Bestelling(ProductType.Dubbel, 45.69, 50, "Adres A"));
            w.VerkoopProduct(new Bestelling(ProductType.Kriek, 45.69, 25, "Adres A"));
            w.VerkoopProduct(new Bestelling(ProductType.Dubbel, 45.69, 19, "Adres B"));

            s.Rapport();
            sb.Toon_stocks();
            sb.Vull_alle_stocks_aan();
            sb.Toon_stocks();

            Console.WriteLine(g.Geef_laatste_bestelling().ToString());

            /*
             * w.Groothandelaar.stockbeheer.Toon_stocks();
             * w.Groothandelaar.stockbeheer.Vull_alle_stocks_aan();
             * w.Groothandelaar.stockbeheer.Toon_stocks();
             *
             * w.VerkoopProduct(new Bestelling(ProductType.Dubbel, 45.69, 99, "Adres C"));
             *
             * w.Groothandelaar.stockbeheer.Toon_stocks();*/
        }
示例#6
0
        public ActionResult GetWinkelBijDatum(DateTime date)
        {
            try
            {
                Winkel winkel = Repo.GetWinkelPerDatum(date);
                return(Json(winkel));
            }
            catch (Exception e)
            {
                string msg = "An error occured";
                if (e is IndexOutOfRangeException)
                {
                    msg = "De opgegeven datum is te lang, format [yyyy-mm-dd]";
                }

                else if (e is NotSupportedException)
                {
                    msg = "De opgegeven datum wordt niet herkent als datum [yyyy-mm-dd]";
                }

                else if (e is FormatException)
                {
                    msg = "De opgegeven datum bestaat niet";
                }

                return(StatusCode(StatusCodes.Status500InternalServerError, msg));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Winkel winkel = db.Winkels.Find(id);

            db.Winkels.Remove(winkel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Straat,Postcode,Plaats,Plaatje")] Winkel winkel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(winkel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(winkel));
 }
示例#9
0
 Schanze(Länge länge,
         Länge höhe,
         Winkel absprungwinkel,
         Länge radius, double scale)
 {
     _länge         = länge;
     _höhe          = höhe;
     Absprungwinkel = absprungwinkel;
     _radius        = radius;
     Scale          = scale;
 }
示例#10
0
        public static Schanze Create(Länge höhe, Winkel absprungwinkel)
        {
            var radius = höhe.Meter / (1 - Math.Cos(absprungwinkel.Rad));
            var länge  = radius * Math.Sin(absprungwinkel.Rad);

            return(new Schanze(
                       länge: Länge.FromMeter(länge),
                       höhe: höhe,
                       absprungwinkel: absprungwinkel,
                       radius: Länge.FromMeter(radius),
                       scale: 1
                       ));
        }
示例#11
0
        public void Test1()
        {
            var winkel     = Winkel.FromDeg(19);
            var höhe       = Länge.FromCentimeter(16);
            var berechnung = Schanze.Create(höhe, winkel);

            Assert.That(berechnung, Is.Not.Null);
            Assert.That(berechnung.Höhe.Meter, Is.EqualTo(höhe.Meter));
            Assert.That(berechnung.Absprungwinkel.Rad, Is.EqualTo(winkel.Rad));
            Assert.That(berechnung.Absprungwinkel.Deg, Is.EqualTo(winkel.Deg));
            Assert.That(berechnung.Länge.Meter, Is.EqualTo(0.956).Within(0.001));
            Assert.That(berechnung.Radius.Meter, Is.EqualTo(2.936).Within(0.001));
        }
        public void DBConnectionAddWinkelTest()
        {
            Winkel winkel = new Winkel("dries.leyers", "test");

            winkel.naam = "dries.pannenkoek";

            DBConnection dBConnection = new DBConnection();

            bool succes = dBConnection.AddWinkel(winkel);

            Assert.True(succes);
            dBConnection.DeleteRowsFromsmProject();
        }
示例#13
0
        public List <Winkel> GetMyWinkels(string gebruikersNaam)
        {
            this.ResetErrorMessage();

            List <Winkel>  winkels  = new List <Winkel>();
            Winkel         winkel   = new Winkel();
            List <Artikel> artikels = GetAllArtikels();

            try
            {
                this.MySqlConnection.Open();
                string sql = $"SELECT winkelnr, naam, beheerder, actief, goedgekeurd, adress FROM tblwinkel WHERE beheerder = @beheerder;";

                MySqlCommand command = new MySqlCommand(sql, this.MySqlConnection);

                command.Parameters.AddWithValue("beheerder", gebruikersNaam);

                MySqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    winkel.winkelnr    = reader.GetInt32(0);
                    winkel.naam        = reader.GetString(1);
                    winkel.beheerder   = reader.GetString(2);
                    winkel.actief      = (reader.GetInt32(3) == 1) ? true : false;
                    winkel.goedgekeurd = (reader.GetInt32(4) == 1) ? true : false;
                    winkel.adress      = reader.GetString(5);

                    for (int i = 0; i < artikels.Count; i++)
                    {
                        if (artikels[i].winkelnr == winkel.winkelnr)
                        {
                            winkel.artikels.Add(artikels[i]);
                        }
                    }

                    winkels.Add(winkel);
                    winkel = new Winkel();
                }

                reader.Close();
            }
            catch (MySqlException ex)
            {
                this.ErrorMessage = ex.ToString();
            }

            this.MySqlConnection.Close();

            return(winkels);
        }
        // GET: Admin/FilialenCRUD/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Winkel winkel = db.Winkels.Find(id);

            if (winkel == null)
            {
                return(HttpNotFound());
            }
            return(View(winkel));
        }
示例#15
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Winkel = await _context.Winkels
                     .Include(w => w.WinkelKeten).SingleOrDefaultAsync(m => m.Id == id);

            if (Winkel == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#16
0
        static void Main(string[] args)
        {
            Winkel         w  = new Winkel();
            Sales          s  = new Sales();
            Stockbeheer    st = new Stockbeheer();
            GrootHandelaar g  = new GrootHandelaar();

            st.ToonStock();
            w.WinkelVerkoop   += s.OnWinkelVerkoop;
            st.StockWijziging += g.OnStockWijziging;
            w.WinkelVerkoop   += st.OnWinkelVerkoop;

            w.VerkoopProduct(new Bestelling(ProductType.Dubbel, 50, 25, "Moerbeekstraat 25 - Geraadsbergen"));
            w.VerkoopProduct(new Bestelling(ProductType.Pils, 50, 25, "Moerbeekstraat 25 - Geraadsbergen"));
            w.VerkoopProduct(new Bestelling(ProductType.Kriek, 100, 50, "Stationsstraat 10 - Zottegem"));
            w.VerkoopProduct(new Bestelling(ProductType.Pils, 10, 95, "Moerbeekstraat 25 - Geraadsbergen"));
        }
示例#17
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Winkel = await _context.Winkels.FindAsync(id);

            if (Winkel != null)
            {
                _context.Winkels.Remove(Winkel);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#18
0
        private void OnBerechnenClick(object sender, RoutedEventArgs e)
        {
            try {
                var winkel          = Winkel.FromDeg(double.Parse(AbsprungWinkelTextBox.Text));
                var geschwindigkeit = Geschwindigkeit.FromKilometerProStunde(double.Parse(AbsprungGeschwindigkeitTextBox.Text));
                var schanzenHöhe    = Länge.FromCentimeter(double.Parse(AbsprungHöheTextBox.Text));

                var schanze  = Schanze.Create(schanzenHöhe, winkel);
                var flugbahn = Flugbahn.Create(schanze, geschwindigkeit);
                var setting  = SettingViewModel.Create(schanze, flugbahn);

                _viewModel.Settings.Add(setting);
                _viewModel.SelectedSetting = setting;
            } catch (Exception) {
                // TODO Fehler visualisieren
            }
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Winkel = await _context.Winkels
                     .Include(w => w.WinkelKeten).SingleOrDefaultAsync(m => m.Id == id);

            if (Winkel == null)
            {
                return(NotFound());
            }
            ViewData["WinkelKetenId"] = new SelectList(_context.WinkelKetens, "Id", "KetenName");
            return(Page());
        }
示例#20
0
        public static Flugbahn Create(
            Schanze schanze,
            Geschwindigkeit absprungGeschwindigkeit)
        {
            var weite = Wurfparabel.Weite(
                v0: absprungGeschwindigkeit.MeterProSekunde,
                y0: schanze.Höhe.Meter,
                alpha: schanze.Absprungwinkel.Rad);

            var scheitelpunktX = Wurfparabel.ScheitelpunktX(
                v0: absprungGeschwindigkeit.MeterProSekunde,
                y0: schanze.Höhe.Meter,
                alpha: schanze.Absprungwinkel.Rad
                );

            var höhe = Wurfparabel.ScheitelpunktY(
                v0: absprungGeschwindigkeit.MeterProSekunde,
                y0: schanze.Höhe.Meter,
                alpha: schanze.Absprungwinkel.Rad);

            var aufprallWinkel = Wurfparabel.AufprallWinkel(
                v0: absprungGeschwindigkeit.MeterProSekunde,
                y0: schanze.Höhe.Meter,
                alpha: schanze.Absprungwinkel.Rad
                );

            var aufprallGeschwindigkeit = Wurfparabel.AufprallGeschwindigkeit(
                v0: absprungGeschwindigkeit.MeterProSekunde,
                y0: schanze.Höhe.Meter,
                alpha: schanze.Absprungwinkel.Rad
                );

            return(new Flugbahn(
                       absprungHöhe: schanze.Höhe,
                       absprungWinkel: schanze.Absprungwinkel,
                       absprungGeschwindigkeit: absprungGeschwindigkeit,
                       sprungWeite: Länge.FromMeter(weite),
                       scheitelpunktX: Länge.FromMeter(scheitelpunktX),
                       scheitelpunktY: Länge.FromMeter(höhe),
                       aufprallWinkel: Winkel.FromRad(aufprallWinkel),
                       aufprallGeschwindigkeit: Geschwindigkeit.FromMeterProSekunde(aufprallGeschwindigkeit),
                       scale: 1));
        }
示例#21
0
        public Winkel GetWinkel(int winkelNr)
        {
            this.ResetErrorMessage();

            Winkel winkel = new Winkel();

            try
            {
                this.MySqlConnection.Open();

                string sql = $"SELECT winkelnr, naam, beheerder, actief, goedgekeurd, adress FROM tblwinkel WHERE winkelnr = @winkelnr;";

                MySqlCommand command = new MySqlCommand(sql, this.MySqlConnection);
                command.Parameters.AddWithValue("@winkelnr", winkelNr);

                MySqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    winkel.winkelnr    = reader.GetInt32(0);
                    winkel.naam        = reader.GetString(1);
                    winkel.beheerder   = reader.GetString(2);
                    winkel.actief      = reader.GetBoolean(3);
                    winkel.goedgekeurd = reader.GetBoolean(4);
                    winkel.adress      = reader.GetString(5);
                }

                //Reader sluiten
                reader.Close();
            }
            catch (MySqlException ex)
            {
                //Bij een error word de ToString van die error op ErrorMessage gezet zodat dit gebruikt kan worden, voornamelijk tijdens het developen
                this.ErrorMessage = ex.ToString();
            }

            //Connectie sluiten
            this.MySqlConnection.Close();

            //Return object
            return(winkel);
        }
        public ActionResult Create([Bind(Include = "Id,Winkelnaam,Straat,Postcode,Plaats")] Winkel winkel, HttpPostedFileBase plaatje)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //Method 1 Get file details from current request
                    //Uncomment following code if you wants to use method 1
                    //if (Request.Files.Count > 0)
                    // {
                    //     var Inputfile = Request.Files[0];

                    //     if (Inputfile != null && Inputfile.ContentLength > 0)
                    //     {
                    //         var filename = Path.GetFileName(Inputfile.FileName);
                    //       var path = Path.Combine(Server.MapPath("~/uploadedfile/"), filename);
                    //        Inputfile.SaveAs(path);
                    //    }
                    // }

                    //Method 2 Get file details from HttpPostedFileBase class

                    if (plaatje != null)
                    {
                        string path = Path.Combine(Server.MapPath("~/Content/Images/Filialen"), Path.GetFileName(plaatje.FileName));
                        winkel.Plaatje = plaatje.FileName;
                        plaatje.SaveAs(path);
                    }
                    ViewBag.FileStatus = "File uploaded successfully.";
                }
                catch (Exception)
                {
                    ViewBag.FileStatus = "Error while file uploading.";
                }

                db.Winkels.Add(winkel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(winkel));
        }
示例#23
0
 Flugbahn(Länge absprungHöhe,
          Winkel absprungWinkel,
          Geschwindigkeit absprungGeschwindigkeit,
          Länge sprungWeite,
          Länge scheitelpunktX,
          Länge scheitelpunktY,
          Winkel aufprallWinkel,
          Geschwindigkeit aufprallGeschwindigkeit,
          double scale)
 {
     _absprungHöhe           = absprungHöhe;
     AbsprungWinkel          = absprungWinkel;
     AbsprungGeschwindigkeit = absprungGeschwindigkeit;
     _sprungWeite            = sprungWeite;
     _scheitelpunktY         = scheitelpunktY;
     _scheitelpunktX         = scheitelpunktX;
     Scale                   = scale;
     AufprallWinkel          = aufprallWinkel;
     AufprallGeschwindigkeit = aufprallGeschwindigkeit;
 }
示例#24
0
        public SceneViewModel()
        {
            _settings = new ObservableCollection <SettingViewModel>();
            _settings.CollectionChanged += OnSettingCollectionChanged;

            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                var winkel          = Winkel.FromDeg(22);
                var geschwindigkeit = Geschwindigkeit.FromKilometerProStunde(20);
                var schanzenHöhe    = Länge.FromCentimeter(16);

                var schanze  = Berechnung.Schanze.Create(schanzenHöhe, winkel);
                var flugbahn = Berechnung.Flugbahn.Create(schanze, geschwindigkeit);

                var model = new SettingViewModel(schanze, flugbahn)
                {
                    RenderMetrics = true
                };
                Settings.Add(model);
            }
        }
示例#25
0
        public bool VeranderGoedgekeurdWinkel(Winkel winkel)
        {
            this.ResetErrorMessage();

            bool succes = false;

            try
            {
                this.MySqlConnection.Open();

                string sql = $"UPDATE tblwinkel SET goedgekeurd = @goedgekeurd WHERE winkelnr = {winkel.winkelnr}";

                MySqlCommand command = new MySqlCommand(sql, this.MySqlConnection);

                if (winkel.goedgekeurd)
                {
                    command.Parameters.AddWithValue("@goedgekeurd", 1);
                }
                else
                {
                    command.Parameters.AddWithValue("@goedgekeurd", 0);
                }

                if (command.ExecuteNonQuery() > 0)
                {
                    succes = true;
                }
            }
            catch (MySqlException ex)
            {
                this.ErrorMessage = ex.ToString();
                succes            = false;
            }

            this.MySqlConnection.Close();

            return(succes);
        }
示例#26
0
        public void Seed(ModelBuilder modelBuilder)
        {
            // Default roles
            modelBuilder.Entity <IdentityRole>().HasData(new IdentityRole {
                Name = "User"
            });
            modelBuilder.Entity <IdentityRole>().HasData(new IdentityRole {
                Name = "Admin"
            });

            Winkel appie = new Winkel("Albert Heijn Bezorgservice")
            {
                WinkelId = 1
            };
            Winkel snackbar = new Winkel("snackbar")
            {
                WinkelId = 2
            };

            modelBuilder.Entity <Winkel>().HasData(appie, snackbar);

            Product kaas = new Product("Kaas", 120, appie.WinkelId)
            {
                ProductId = -1
            };
            Product bier = new Product("Bier", 220, appie.WinkelId)
            {
                ProductId = -2
            };
            Product kroket = new Product("Kroket", 180, snackbar.WinkelId)
            {
                ProductId = -3
            };

            modelBuilder.Entity <Product>().HasData(kaas, bier, kroket);

            StandaardWinkelPerBezorgdag maandag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Monday, BestelDeadlineDag = DayOfWeek.Friday, BestelDeadlineTijd = TimeSpan.FromHours(11), WinkelId = appie.WinkelId
            };
            StandaardWinkelPerBezorgdag dinsdag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Tuesday
            };
            StandaardWinkelPerBezorgdag woensdag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Wednesday, BestelDeadlineDag = DayOfWeek.Monday, BestelDeadlineTijd = TimeSpan.FromHours(11), WinkelId = appie.WinkelId
            };
            StandaardWinkelPerBezorgdag donderdag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Thursday
            };
            StandaardWinkelPerBezorgdag vrijdag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Friday, BestelDeadlineDag = DayOfWeek.Friday, BestelDeadlineTijd = TimeSpan.FromHours(11), WinkelId = snackbar.WinkelId
            };
            StandaardWinkelPerBezorgdag zaterdag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Saturday
            };
            StandaardWinkelPerBezorgdag zondag = new StandaardWinkelPerBezorgdag()
            {
                Dag = DayOfWeek.Sunday
            };

            modelBuilder.Entity <StandaardWinkelPerBezorgdag>().HasData(maandag, dinsdag, woensdag, donderdag, vrijdag, zaterdag, zondag);
        }
示例#27
0
 public void AddWinkel(Winkel winkel)
 {
     Context.Winkels.Add(winkel);
     Context.SaveChanges();
 }
示例#28
0
        public IQueryable <Product> GetProducten(DateTime date)
        {
            Winkel winkel = GetWinkelPerDatum(date);

            return(GetProducten(winkel));
        }
示例#29
0
 public IQueryable <Product> GetProducten(Winkel winkel)
 {
     return(Context.Producten.Include(x => x.Categorie).Where(x => x.Winkel == winkel).AsQueryable());
 }
示例#30
0
 public IQueryable <StandaardWinkelPerBezorgdag> GetStandaardBezorgdagenPerWinkel(Winkel eenWinkel)
 {
     return(Context.StandaardWinkelsPerBezorgdagen.Where(wd => wd.Winkel == eenWinkel).AsQueryable());
 }