예제 #1
0
        public List <BestelRegel> GetAllByStatus(int status, int afdeling)
        {
            dbConnection.Open();

            string sql = string.Format(
                "SELECT * FROM bestellingen " +
                "INNER JOIN bestelRegels ON bestellingen.bestelId = bestelRegels.bestelId " +
                "INNER JOIN producten ON producten.productId = bestelRegels.productId " +
                "WHERE bestelRegels.productStatus = {0} ", status);

            if (afdeling == 1)
            {
                sql = sql + " AND SubcategorieId<8 ";
            }
            else
            {
                sql = sql + " AND SubcategorieId>8 ";
            }
            sql = sql + " ORDER BY tafelId";
            SqlCommand    command = new SqlCommand(sql, dbConnection);
            SqlDataReader reader  = command.ExecuteReader();

            List <BestelRegel> alleBestellingen = new List <BestelRegel>();

            while (reader.Read())
            {
                BestelRegel bestelling = ReadBestelRegel(reader);
                alleBestellingen.Add(bestelling);
            }

            dbConnection.Close();

            return(alleBestellingen);
        }
예제 #2
0
        /// <summary>
        /// Event, roept InputForm_AddComment
        /// </summary>
        /// <param name="sender">Button waarop geklikt is</param>
        /// <param name="e"></param>
        private void BtnAddComment_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            Control[]   controls = tabControl.SelectedTab.Controls.Find(btn.Name, true);
            Product     p        = (Product)controls[0].Tag;
            BestelRegel br       = FindBestelRegel(p.Id);

            InputForm_AddComment(ref br);
        }
예제 #3
0
        /// <summary>
        /// Pop-up venster om een opmerking toe te voegen
        /// </summary>
        /// <param name="br">De BestelRegel waar een opmerking aan toegevoegd wordt</param>
        private void InputForm_AddComment(ref BestelRegel br)
        {
            Form    form      = new Form();
            Label   label     = new Label();
            TextBox comment   = new TextBox();
            Button  btnOk     = new Button();
            Button  btnCancel = new Button();

            form.Text = "Personeel toevoegen";

            label.Text = "Voeg een opmerking toe:";

            comment.Text      = br.Comment;
            comment.MaxLength = 255;

            btnOk.Text             = "Toevoegen";
            btnCancel.Text         = "Annuleren";
            btnOk.DialogResult     = DialogResult.OK;
            btnCancel.DialogResult = DialogResult.Cancel;

            label.SetBounds(9, 3, 372, 13);
            comment.SetBounds(12, 17, 372, 20);

            btnOk.SetBounds(182, 141, 100, 25);
            btnCancel.SetBounds(285, 141, 100, 25);

            label.AutoSize = true;

            comment.Anchor   = comment.Anchor | AnchorStyles.Right;
            btnOk.Anchor     = AnchorStyles.Bottom | AnchorStyles.Right;
            btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            form.ClientSize = new Size(396, 169);
            form.Controls.AddRange(new Control[] { label, comment, btnOk, btnCancel });
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.MinimizeBox     = false;
            form.MaximizeBox     = false;
            form.AcceptButton    = btnOk;
            form.CancelButton    = btnCancel;

            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                br.Comment = comment.Text;
            }
        }
예제 #4
0
        /// <summary>
        /// Wanneer een button wordt geclickt, wordt de bestelling gemarkeerd en de button verwijderd. Ook refresht het scherm.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void button_Click(object sender, EventArgs e)
        {
            string        connString    = ConfigurationManager.ConnectionStrings["MayaMayaConnection"].ConnectionString;
            SqlConnection dbConnection  = new SqlConnection(connString);
            BestellingDAO bestellingDAO = new BestellingDAO(dbConnection);

            Button      btn   = (Button)sender;
            BestelRegel regel = (BestelRegel)btn.Tag;

            bestellingDAO.MarkeerBestelRegel(regel.Id, regel.Status);
            listView1.Items.Clear();
            listView2.Items.Clear();
            foreach (Button b in button)
            {
                b.Dispose();
            }
            BarScherm_Huidig_load();
            BarScherm_Geschiedenis_load();
            ActiveForm.Refresh();
        }
예제 #5
0
        /// <summary>
        /// Verkrijg alle rekening regels van één bestelling
        /// </summary>
        /// <param name="bestelId"></param>
        /// <returns></returns>
        public List <BestelRegel> GetRekening(int bestelId)
        {
            string sql = string.Format(
                "SELECT * FROM bestellingen " +
                "INNER JOIN bestelRegels ON bestellingen.bestelId = bestelRegels.bestelId " +
                "INNER JOIN producten ON bestelRegels.productId = producten.productId WHERE bestelRegels.bestelId={0} AND bestelStatus=1", bestelId);

            SqlCommand    command = new SqlCommand(sql, dbConnection);
            SqlDataReader reader  = command.ExecuteReader();

            dbConnection.Open();

            List <BestelRegel> rekeningRegels = new List <BestelRegel>();

            while (reader.Read())
            {
                BestelRegel bestelRegel = ReadBestelRegel(reader);
                rekeningRegels.Add(bestelRegel);
            }
            dbConnection.Close();

            return(rekeningRegels);
        }