public static void AddType(TicketType FormTicketType) { Database.ModifyData("INSERT INTO tbl_ticketType (TicketName,Price,Available) VALUES(@name,@price,@avail)", Database.AddParameter("@name", FormTicketType.Name), Database.AddParameter("@price", FormTicketType.Price), Database.AddParameter("@avail", FormTicketType.AvailableTickets) ); }
public static string DeleteFunctie(TicketType SelectedType) { DbDataReader reader = Database.GetData("SELECT * FROM tbl_ticket,tbl_ticketType WHERE tbl_ticketType.ID=tbl_ticket.TicketType AND tbl_ticketType.TicketName=@name", Database.AddParameter("@name", SelectedType.Name)); if (reader.HasRows) { return "Gelieve eerste alle reserveringen met dit tickettype te verwijderen"; } else { Database.ModifyData("DELETE FROM tbl_ticketType WHERE ID=@id", Database.AddParameter("@id", Convert.ToInt32(SelectedType.ID))); } return null; }
public static string EditType(TicketType FormTicketType) { if (Convert.ToInt32(GetUsedTickets(FormTicketType.ID.ToString())) <= FormTicketType.AvailableTickets) { Database.ModifyData("UPDATE tbl_ticketType SET TicketName=@name,Price=@price,Available=@avail WHERE ID=@id", Database.AddParameter("@name",FormTicketType.Name), Database.AddParameter("@price",FormTicketType.Price), Database.AddParameter("@avail",FormTicketType.AvailableTickets), Database.AddParameter("@id",FormTicketType.ID) ); } else { return "Er zijn niet genoeg tickets vrij"; } return null; }