private void BBestellingToevoegen_Click(object sender, EventArgs e) { Reservering r = rvc.GetReserveringById(LReserveringNummerGerechten.Text); List <Gerecht> GekozenGerechten = new List <Gerecht>(); int Ronde = 0; bool RondeCheck = true; while (RondeCheck == true) { Ronde++; RondeCheck = bc.CheckRonde(Ronde, r.ReserveringID); } foreach (string item in LBHuidigeBestelling.Items) { Gerecht g = gc.GetGerechtById(Convert.ToInt32(item.Split(' ')[0])); GekozenGerechten.Add(g); } foreach (Gerecht g in GekozenGerechten) { bc.InsertBestelling(r.ReserveringID, g.GerechtID, Ronde, 1); } LoadBestellingen(r.ReserveringID); LBHuidigeBestelling.Items.Clear(); }
public List <Reservering> GetReserveringenById(int id) { List <Reservering> reserveringen = new List <Reservering>(); string sql = "select * from Reservering where AccountID = @id"; Dictionary <object, object> parameters = new Dictionary <object, object>(); parameters.Add("id", id); DataSet results = GetDataSetSql(sql, parameters); if (results != null && results.Tables[0].Rows.Count > 0) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Reservering r = DataSetParser.DataSetToReservering(results, x); reserveringen.Add(r); } } else { MessageBox.Show("Reserveringen Not Found in Database!"); } return(reserveringen); }
public Reservering GetReserveringById(string text) { string sql = "Select * From Reservering Where ReserveringID = @reserveringID"; Dictionary <object, object> parameters = new Dictionary <object, object>(); parameters.Add("reserveringID", text); Reservering r = new Reservering(); DataSet results = GetDataSetSql(sql, parameters); if (results != null && results.Tables[0].Rows.Count > 0) { r = DataSetParser.DataSetToReservering(results, 0); } else { return(null); } return(r); }
public Reservering GetReserveringByAccountAndRestaurantAndDate(int accountID, int restaurantID, string dtp) { string sql = "select * from Reservering Where AccountID = @AccountID and RestaurantID = @RestaurantID and Datum = @datum + ':00.000' "; Dictionary <object, object> parameters = new Dictionary <object, object>(); parameters.Add("RestaurantID", restaurantID); parameters.Add("AccountID", accountID); parameters.Add("datum", dtp); DataSet results = GetDataSetSql(sql, parameters); Reservering r = new Reservering(); if (results != null && results.Tables[0].Rows.Count == 1) { r = DataSetParser.DataSetToReservering(results, 0); } else { MessageBox.Show("Too many/few data found."); } return(r); }
internal Reservering GetReserveringByAccountAndRestaurantAndDate(int accountID, int restaurantID, string dt) { Reservering r = repo.GetReserveringByAccountAndRestaurantAndDate(accountID, restaurantID, dt); return(r); }