public void meldOnGereed(BestellingItem bestellingItem)
        {
            try
            {
                Barman_DAL.Instance.meldBestellingOnKlaar(bestellingItem);
            }

            catch (Exceptions.NetworkProblemException)
            {
                throw new Exceptions.NetworkProblemException();
            }
        }
예제 #2
0
        public void InsertBestellingItem(BestellingItem be)
        {
            SqlParameter sqlq5  = new SqlParameter("@orderId", be.orderId);
            SqlParameter sqlq6  = new SqlParameter("@menuItemId", be.menuItemId);
            SqlParameter sqlq7  = new SqlParameter("@orderTime", be.orderTime);
            SqlParameter sqlq8  = new SqlParameter("@amount", be.amount);
            SqlParameter sqlq9  = new SqlParameter("@price", be.price);
            SqlParameter sqlq10 = new SqlParameter("@orderItemStatus", be.orderItemStatus);

            SqlParameter[] sqlParameters = new SqlParameter[] { sqlq5, sqlq6, sqlq7, sqlq8, sqlq9, sqlq10 };

            ExecuteEditQuery("CreateOrderitem", sqlParameters);
        }
예제 #3
0
 //de meest logische operaties
 public string[] bestellingArray(BestellingItem currentbestelling, Model.MenuItem currentmenuitem, Bestelling currentbestellingtafel)
 {
     //array maken die in UI in item gaat en vervolgens in de listviewitemlist
     string[] arr = new string[7];
     arr[0] = Convert.ToString(currentbestelling.BestelitemID);
     arr[1] = currentmenuitem.Naam;
     arr[2] = Convert.ToString(currentbestelling.Aantal);
     arr[3] = currentbestelling.Commentaar;
     arr[4] = currentbestelling.Status;
     arr[5] = Convert.ToString(currentbestelling.TijdOpgenomen);
     arr[6] = Convert.ToString(currentbestellingtafel.TafelId);
     return(arr);
 }
예제 #4
0
 public bool InsertBestellingItem(BestellingItem be)
 {
     try
     {
         _bestellingDAO.InsertBestellingItem(be);
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
예제 #5
0
        public List <BestellingItem> GetAll()
        {
            //open connectie
            SqlConnection         connection         = dbConnection.MaakConnectieDB("reader");
            List <BestellingItem> bestellingItemList = new List <BestellingItem>();

            connection.Open();
            StringBuilder sb = new StringBuilder();

            //string en execute
            sb.Append("select BestelItem.bestelitem_id,BestelItem.bestelling_id,BestelItem.menuitem_id,BestelItem.opmerkingen,BestelItem.aantal,BestelItem.status,BestelItem.tijd_opgenomen,MenuItem.naam,MenuItem.categorie_id,Bestelling.tafel_id from BestelItem inner join MenuItem on BestelItem.menuitem_id = MenuItem.menuitem_id inner join Bestelling on BestelItem.bestelling_id=Bestelling.bestelling_id;");

            string sql = sb.ToString();

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

            while (reader.Read())
            {
                //read uit database
                int      bestellingitemID = reader.GetInt32(0);
                int      bestellingID     = reader.GetInt32(1);
                int      menuitemID       = reader.GetInt32(2);
                string   opmerkingen      = reader.GetString(3);
                int      aantal           = reader.GetInt32(4);
                string   status           = reader.GetString(5);
                DateTime tijdOpgenomen    = reader.GetDateTime(6);
                string   naam             = reader.GetString(7);

                //vul object(volledig!)
                BestellingItem bestellingitem = new BestellingItem();

                bestellingitem.BestelitemID  = bestellingitemID;
                bestellingitem.MenuItemID    = menuitemID;
                bestellingitem.BestellingID  = bestellingID;
                bestellingitem.Commentaar    = opmerkingen;
                bestellingitem.Aantal        = aantal;
                bestellingitem.Status        = status;
                bestellingitem.TijdOpgenomen = tijdOpgenomen;
                bestellingitem.Naam          = naam;

                bestellingItemList.Add(bestellingitem);
            }
            //close connection en geef list terug
            connection.Close();
            reader.Close();
            return(bestellingItemList);
        }
예제 #6
0
        public List <BestellingItem> GetAll()
        {
            SqlConnection         connection         = dbConnection.MaakConnectieDB("reader");
            List <BestellingItem> bestellingItemList = new List <BestellingItem>();

            connection.Open();
            StringBuilder sb = new StringBuilder();

            sb.Append("Select * From BestelItem");

            String sql = sb.ToString();

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

            while (reader.Read())
            {
                int      bestellingID  = reader.GetInt32(0);
                int      menuitemID    = reader.GetInt32(1);
                string   opmerkingen   = reader.GetString(3);
                int      aantal        = reader.GetInt32(4);
                string   status        = reader.GetString(5);
                DateTime tijdOpgenomen = reader.GetDateTime(6);



                BestellingItem bestellingitem = new BestellingItem();

                bestellingitem.bestelitemID = bestellingID;
                //bestellingitem.menuitem = menuitemID;
                bestellingitem.commentaar    = opmerkingen;
                bestellingitem.aantal        = aantal;
                bestellingitem.status        = status;
                bestellingitem.tijdOpgenomen = tijdOpgenomen;


                bestellingItemList.Add(bestellingitem);
            }

            connection.Close();
            reader.Close();
            return(bestellingItemList);
        }
예제 #7
0
        private List <BestellingItem> GetAllOrdersFromTable(DataTable dataTable)
        {
            List <BestellingItem> ordersTables = new List <BestellingItem>();

            foreach (DataRow item in dataTable.Rows)
            {
                BestellingItem orderTable = new BestellingItem
                {
                    menuItemId   = (int)item["menuItemId"],
                    amount       = (int)item["amount"],
                    itemName     = (string)item["itemName"],
                    price        = (decimal)item["price"],
                    orderTableId = (int)item["orderTableId"],
                    orderId      = (int)item["orderId"]
                };

                ordersTables.Add(orderTable);
            }
            return(ordersTables);
        }
예제 #8
0
        private List <BestellingItem> ReadTables2(DataTable dataTable)
        {
            List <BestellingItem> bestellingitem = new List <BestellingItem>();

            foreach (DataRow dr in dataTable.Rows)
            {
                BestellingItem bi = new BestellingItem()
                {
                    orderId      = (int)dr["orderId"],
                    orderTableId = (int)dr["orderTableId"],
                    //menuItemId = (int)dr["menuItemId"],
                    //orderItemId = (int)dr["orderItemId"],
                    itemName        = (string)dr["itemName"],
                    orderItemStatus = (bool)dr["orderItemStatus"],
                    amount          = (int)dr["amount"],
                    // orderTime = (DateTime)dr["orderTime"],
                };
                bestellingitem.Add(bi);
            }
            return(bestellingitem);
        }
예제 #9
0
        //Code Alex
        public void PlaatsBestellingItem(BestellingItem besteldeItem)
        {
            SqlConnection connection = dbConnection.MaakConnectieDB("Writer");

            connection.Open();

            SqlCommand command = new SqlCommand("INSERT INTO BestelItem (bestelling_id, menuitem_id, opmerkingen, aantal, status, tijd_opgenomen) VALUES (@bestellingID, @menuitemID, @commentaar, @aantal ,@status, @tijdopgenomen)", connection);

            SqlParameter IdParam1 = new SqlParameter("@bestellingiD", SqlDbType.Int);
            SqlParameter IdParam2 = new SqlParameter("@menuitemID", SqlDbType.Int);
            SqlParameter IdParam3 = new SqlParameter("@commentaar", SqlDbType.NVarChar, -1);
            SqlParameter IdParam4 = new SqlParameter("@aantal", SqlDbType.Int);
            SqlParameter IdParam5 = new SqlParameter("@status", SqlDbType.NVarChar, 50);
            SqlParameter IdParam6 = new SqlParameter("@tijdopgenomen", SqlDbType.DateTime);

            command.Parameters.Add(IdParam1);
            IdParam1.Value = besteldeItem.BestellingID;

            command.Parameters.Add(IdParam2);
            IdParam2.Value = besteldeItem.MenuItemID;

            command.Parameters.Add(IdParam3);
            IdParam3.Value = besteldeItem.Commentaar;

            command.Parameters.Add(IdParam4);
            IdParam4.Value = besteldeItem.Aantal;

            command.Parameters.Add(IdParam5);
            IdParam5.Value = besteldeItem.Status;

            command.Parameters.Add(IdParam6);
            IdParam6.Value = besteldeItem.TijdOpgenomen;

            command.Prepare();

            command.ExecuteNonQuery();

            connection.Close();
        }
예제 #10
0
        public void meldBestellingOnKlaar(BestellingItem bestellingItem)
        {
            SqlConnection verbinding = null;
            SqlDataReader reader     = null;

            verbinding = SQLConnection.OpenConnectieDB();

            StringBuilder sb = new StringBuilder();

            sb.Append("UPDATE dbo.BestellingItem ");
            sb.Append("SET status = 1 ");
            sb.Append("WHERE rekeningId = @rekeningId AND itemId = @itemId AND status = 2 ");

            SqlCommand command = new SqlCommand
            {
                Connection  = verbinding,
                CommandText = sb.ToString()
            };

            SqlParameter rekeningIdParam = new SqlParameter("@rekeningId", System.Data.SqlDbType.Int);

            command.Parameters.Add(rekeningIdParam);
            //rekeningIdParam.Value = bestellingItem.groepId;

            DAL.Bestelling_DAL dal = new Bestelling_DAL();
            rekeningIdParam.Value = dal.Get_rekeningId(bestellingItem.tafelId);

            SqlParameter ItemIdParam = new SqlParameter("@itemId", System.Data.SqlDbType.Int);

            command.Parameters.Add(ItemIdParam);
            ItemIdParam.Value = bestellingItem.itemId;

            command.Prepare();

            reader = command.ExecuteReader();

            verbinding.Close();
        }
예제 #11
0
        public List <Model.BestellingItem> BestellingDoneOphalen()
        {
            Barman_DAL bestellingen = null;

            SqlConnection verbinding = null;
            SqlDataReader reader     = null;

            //als er in deze fase een error optreed heeft dit altijd met de internetverbinding te maken
            try
            {
                verbinding = SQLConnection.OpenConnectieDB();

                StringBuilder sb = new StringBuilder();

                sb.Append("SELECT BI.aantal, MI.naam, BI.besteltijd, GK.tafelId, W.voornaam, BI.status, BI.itemId ");
                sb.Append("FROM dbo.BestellingItem AS BI ");
                sb.Append("JOIN  MenuItem AS MI ON BI.itemId = MI.itemId ");
                sb.Append("JOIN GroepKlanten AS GK ON BI.rekeningId = GK.rekeningId ");
                sb.Append("JOIN Werknemer AS W ON GK.werknemerId = W.werknemerId ");
                sb.Append("WHERE (BI.status = 2) AND (MI.categorieId = 1 OR MI.categorieId = 2) ");
                sb.Append("ORDER BY BI.besteltijd ");

                SqlCommand command = new SqlCommand
                {
                    Connection  = verbinding,
                    CommandText = sb.ToString()
                };

                reader = command.ExecuteReader();
            }

            catch
            {
                throw new Exceptions.NetworkProblemException();
            }

            List <Model.BestellingItem> bestellingen_lijst = new List <Model.BestellingItem>();

            try
            {
                //geen werknemer gevonden? doorgaan na de catch


                while (reader.Read())
                {
                    BestellingItem bestellingenitem = new BestellingItem();
                    bestellingenitem.itemId = Convert.ToInt32(reader["itemId"]);
                    bestellingenitem.SetAantal(Convert.ToInt32(reader["aantal"]));
                    bestellingenitem.SetNaam(Convert.ToString(reader["naam"]));
                    bestellingenitem.SetBesteltijd(Convert.ToDateTime(reader["besteltijd"]));
                    bestellingenitem.SetTafelId(Convert.ToInt32(reader["tafelid"]));
                    bestellingenitem.SetWerknemerId(Convert.ToString(reader["voornaam"]));
                    bestellingenitem.SetStatus(Convert.ToInt32(reader["status"]));

                    bestellingen_lijst.Add(bestellingenitem);
                }
            }
            //indien er wel een match gevonden is maar de conversie een error oplevert
            catch
            {
                bestellingen = null;
                throw new Exceptions.DatabaseErrorException();
            }

            verbinding.Close();

            //return de bestelling lijst
            return(bestellingen_lijst);
        }