Пример #1
0
        /// <summary>
        /// Het afrekenscherm
        /// </summary>
        public Afrekenen(int tafelId)
        {
            InitializeComponent();

            this.tafelId = tafelId;

            this.bestellingDao = DataHelper.BestellingDao;
            this.productDao    = DataHelper.ProductDao;

            bestelId = bestellingDao.GetBestelIdFromTafel(tafelId);

            List <BestelRegel> rekeningRegels = bestellingDao.GetRekening(bestelId);

            label1.Text = "Tafel " + tafelId;

            decimal totaalPrijs = 0;
            decimal totaalBtw   = 0;

            foreach (BestelRegel rekeningRegel in rekeningRegels)
            {
                Product product = productDao.GetProductById(rekeningRegel.ProductId);

                int     aantal     = rekeningRegel.Aantal;
                decimal prijs      = product.Prijs;
                decimal regelPrijs = aantal * prijs;

                listBox1.Items.Add(product.Naam);
                listBox2.Items.Add(aantal.ToString());
                listBox3.Items.Add(regelPrijs.ToString());

                totaalPrijs += regelPrijs;
                decimal btw = Math.Ceiling(product.BerekenBTW * 100) / 100;
                totaalBtw += (btw * aantal);
            }

            // ----- Form changes ----- //
            totaalTxt.Text = "Totaal: " + totaalPrijs;
            btwTxt.Text    = "BTW: " + totaalBtw.ToString("0.00");

            listBox1.Height = listBox1.PreferredHeight;
            listBox2.Height = listBox2.PreferredHeight;
            listBox3.Height = listBox3.PreferredHeight;

            //set panel height Listbox + BTW and Totaal labels(50px)
            panel1.Height = listBox1.Height + 50;

            //set max panel Height
            if (panel1.Height > 330)
            {
                panel1.Height = 330;
                //set other padding for labels because of the vertical scrollbar
                totaalTxt.Padding = new Padding(0, 0, 8, 0);
                btwTxt.Padding    = new Padding(0, 9, 8, 0); //9top for space between listbox and label
            }
        }
Пример #2
0
        /// <summary>
        /// Huidige bestellingen laden en buttons aanmaken
        /// </summary>
        private void BarScherm_Huidig_load()
        {
            string        connString    = ConfigurationManager.ConnectionStrings["MayaMayaConnection"].ConnectionString;
            SqlConnection dbConnection  = new SqlConnection(connString);
            BestellingDAO bestellingDAO = new BestellingDAO(dbConnection);
            ProductDAO    p             = new ProductDAO(dbConnection);

            listView1.View = View.Details;

            int status   = 1;
            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());
                listView1.Items.AddRange(new ListViewItem[] { lvi });

                //create buttons
                Button btn = new Button();
                btn.Left   = left;
                btn.Top    = top;
                btn.Size   = new Size(55, 15);
                btn.Text   = "Klaar";
                btn.Tag    = Bestelregel;
                btn.Font   = new Font("Arial", 5);
                btn.Click += button_Click;
                tabPage1.Controls.Add(btn);
                button.Add(btn);
                top += btn.Height + 2;
            }
        }
Пример #3
0
        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);
        }