public List <String> CheckTafel(Tafel tafel)
        {
            List <string> status = new List <String>();
            string        Status;

            // Open connectie
            dbConnection.Open();

            // Commando
            string query = String.Format(@"SELECT status FROM Tafel 
                INNER JOIN Bestelling on Tafel.tafelnummer = Bestelling.tafelnummer 
                WHERE Tafel.tafelnummer={0}", tafel.tafelNummer);

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

            // Lezen
            while (reader.Read())
            {
                Status = (string)reader["status"];
                status.Add(Status);
            }

            // Sluit connectie
            dbConnection.Close();

            return(status);
        }
        public bool GetStatus(Tafel tafel)
        {
            bool Bezetting = false;

            dbConnection.Close();

            dbConnection.Open();

            string        sql     = String.Format("SELECT * FROM Tafel WHERE tafelnummer={0}", tafel.tafelNummer);
            SqlCommand    command = new SqlCommand(sql, dbConnection);
            SqlDataReader reader  = command.ExecuteReader();

            if (reader.Read())
            {
                bool isbezet = (bool)reader["isBezet"];
                if (isbezet)
                {
                    Bezetting = true;
                }
            }

            dbConnection.Close();

            return(Bezetting);
        }
 public Tafelscherm(Tafel tafel, TafelDAO tafelDAO, ItemDAO itemDAO, BestellingDAO bestellingDAO, Personeelslid personeelslid)
 {
     InitializeComponent();
     this.tafel         = tafel;
     this.tafelDAO      = tafelDAO;
     this.itemDAO       = itemDAO;
     this.bestellingDAO = bestellingDAO;
     this.personeelslid = personeelslid;
 }
Exemple #4
0
 public Bestelscherm(ItemDAO itemDAO, BestellingDAO bestellingDAO, Tafel tafel, Personeelslid personeelslid)
 {
     this.bestellingDAO = bestellingDAO;
     this.itemDAO       = itemDAO;
     Bestelling_id      = 0;
     this.tafel         = tafel;
     this.personeelslid = personeelslid;
     bestelling         = new Bestelling(Bestelling_id, DateTime.Now, tafel, personeelslid, "wacht");
     InitializeComponent();
 }
Exemple #5
0
 public Bestelling(int bestelnummer, DateTime datumTijdVanbestellen,
                   Tafel tafelVanBestelling, Personeelslid personeelslidVanBestelling,
                   string statusVanBestelling)
 {
     Bestelnummer               = bestelnummer;
     DatumTijdVanBestellen      = datumTijdVanbestellen;
     TafelVanBestelling         = tafelVanBestelling;
     PersoneelslidVanBestelling = personeelslidVanBestelling;
     //RekeningVanBestelling = rekeningVanBestelling;
     //Rekeningnummer = rekeningnummer;
     StatusVanBestelling = statusVanBestelling;
 }
        private List <Bestelling> GetAllBestellingenList(SqlDataReader reader)
        {
            List <Bestelling> bestellingen = new List <Bestelling>();

            while (reader.Read())
            {
                int      bestelnummer = (int)reader["bestelnummer"];
                DateTime datumTijd    = (DateTime)reader["datum_en_tijd_van_bestellen"];
                string   status       = (string)reader["status"];

                // Personeelslid object

                string naam = (string)reader["naam"];
                string typePersoneelsLid = (string)reader["type_personeelslid"];
                int    personeelsnummer  = (int)reader["personeelsnummer"];;
                int    pincode           = (int)reader["pincode"];

                Personeelslid personeelslid = new Personeelslid(naam, typePersoneelsLid,
                                                                personeelsnummer, pincode);

                // Rekening object (alleen nog nummer)
                //int rekeningnummer = (int)reader["rekening"];

                // Tafel object
                int  tafelnummer       = (int)reader["tafelnummer"];
                int  aantalZitplaatsen = (int)reader["aantal_zitplaatsen"];
                bool isBezet           = (bool)reader["isBezet"];

                Tafel tafel = new Tafel(tafelnummer, aantalZitplaatsen, isBezet);

                // Bestelling object en toevoegen aan list

                Bestelling bestelling = new Bestelling(bestelnummer, datumTijd,
                                                       tafel, personeelslid, status);

                bestellingen.Add(bestelling);
            }

            return(bestellingen);
        }
        public void UpdateTafel(Tafel tafel)
        {
            int verandering;

            if (GetStatus(tafel))
            {
                verandering = 0;
            }
            else
            {
                verandering = 1;
            }

            dbConnection.Open();

            string     sql     = String.Format("UPDATE Tafel SET isBezet={0} WHERE tafelnummer={1}", verandering, tafel.tafelNummer);
            SqlCommand command = new SqlCommand(sql, dbConnection);

            command.ExecuteNonQuery();

            dbConnection.Close();
        }
        public List <Tafel> GetAll()
        {
            dbConnection.Close();
            List <Tafel> tafelLijst = new List <Tafel>();
            Tafel        tafel      = null;

            dbConnection.Open();

            string        sql     = "SELECT * FROM Tafel";
            SqlCommand    command = new SqlCommand(sql, dbConnection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                int  tafelnummer       = (int)reader["tafelnummer"];
                int  aantalzitplaatsen = (int)reader["aantal_zitplaatsen"];
                bool isbezet           = (bool)reader["isBezet"];

                tafel = new Tafel(tafelnummer, aantalzitplaatsen, isbezet);
                tafelLijst.Add(tafel);
            }
            dbConnection.Close();
            return(tafelLijst);
        }
Exemple #9
0
 public Bestelling1(Tafel tafel)
 {
     InitializeComponent();
     this.tafel = tafel;
 }
Exemple #10
0
 public Tafelscherm(Tafel tafel, TafelDAO tafeldao)
 {
     InitializeComponent();
     this.tafel    = tafel;
     this.tafelDAO = tafeldao;
 }