private void InitProducten() { dao = new ProductDAO(Connection()); Product product = dao.GetProductById(productID); if (categorie == 1) { lbl_Categorie.Text = "Lunch"; for (int i = 1; i < 4; i++) { GetSubcategory(i); } } else if (categorie == 2) { lbl_Categorie.Text = "Diner"; for (int i = 4; i < 8; i++) { GetSubcategory(i); } } else if (categorie == 3) { lbl_Categorie.Text = "Drank"; for (int i = 8; i < 13; i++) { GetSubcategory(i); } } list_Subcategorie.DropDownStyle = ComboBoxStyle.DropDownList; list_Subcategorie.SelectedIndex = 0; txt_Naam.Text = product.Naam; txt_Aantal.Value = product.AantalVoorraad; txt_Prijs.Text = product.Prijs.ToString(); GetSubcategory(product.SubCategorieId); }
/// <summary> /// Oude bestellingen laden en buttons aanmaken /// </summary> private void BarScherm_Geschiedenis_load() { string connString = ConfigurationManager.ConnectionStrings["MayaMayaConnection"].ConnectionString; SqlConnection dbConnection = new SqlConnection(connString); BestellingDAO bestellingDAO = new BestellingDAO(dbConnection); ProductDAO p = new ProductDAO(dbConnection); listView2.View = View.Details; int status = 2; int afdeling = 3; List <BestelRegel> bestelregel = bestellingDAO.GetAllByStatus(status, afdeling); int top = 25; int left = 380; foreach (var Bestelregel in bestelregel) { ListViewItem lvi = new ListViewItem(Bestelregel.TafelId.ToString()); Product prod = p.GetProductById(Bestelregel.ProductId); lvi.SubItems.Add(prod.Naam); lvi.SubItems.Add(Bestelregel.Comment.ToString()); lvi.SubItems.Add(Bestelregel.Aantal.ToString()); listView2.Items.AddRange(new ListViewItem[] { lvi }); Button btn = new Button(); btn.Left = left; btn.Top = top; btn.Size = new Size(55, 15); btn.Text = "Verwijder"; btn.Tag = Bestelregel; btn.Font = new Font("Arial", 5); btn.Click += button_Click; tabPage2.Controls.Add(btn); button.Add(btn); top += btn.Height + 2; } }
/// <summary> /// Tovert 't BestelScherm in beeld /// </summary> /// <param name="tafelId">De tafel waarvoor besteld wordt</param> public BestelScherm(int tafelId) { InitializeComponent(); DateTime t1 = DateTime.Now; DateTime t2 = Convert.ToDateTime("18:00:00"); if (DateTime.Compare(t1, t2) >= 0) { tabControl.SelectedTab = tabPageDiner; } this.productDAO = DataHelper.ProductDao; this.bestellingDAO = DataHelper.BestellingDao; //this.personeelId = personeelId; personeelId = PersoneelDAO.personeelId; this.tafelId = tafelId; InitBestelId(); Debug.WriteLine(bestelId); DrawButtons(); }