private void backToTickets(object sender, System.Windows.Input.MouseButtonEventArgs e) { TicketData ticket = new TicketData(); ticket.Show(); this.Close(); }
private void BackToTicket_Click(object sender, RoutedEventArgs e) { TicketData ticketData = new TicketData(); ticketData.Show(); this.Close(); }
private void ButtonBuy_Click(object sender, RoutedEventArgs e) { MySqlConnection connection = new MySqlConnection("datasource=127.0.0.1;port=3306;username=root;password=;database=fitnessdb"); connection.Open(); MySqlCommand comm = new MySqlCommand("select azonosito from users where azonosito like " + MainWindow.azonosito, connection); MySqlDataReader reader = comm.ExecuteReader(); reader.Read(); string azonosito = reader["azonosito"].ToString(); connection.Close(); connection.Open(); MySqlCommand comm2 = connection.CreateCommand(); comm2.CommandText = "INSERT INTO tickets(valid_from, valid_until, nr_of_entries, nr_of_entries_day, hour_from, hour_until, weekend, azonosito) " + "VALUES(@valid_from, @valid_until,@nr_of_entries,@nr_of_entries_day,@hour_from,@hour_until,@weekend,@azonosito )"; comm2.Parameters.AddWithValue("@valid_from", validFromBuy.Text); comm2.Parameters.AddWithValue("@valid_until", validUntilBuy.Text); comm2.Parameters.AddWithValue("@nr_of_entries", nrOfEntriesBuy.Text); comm2.Parameters.AddWithValue("@nr_of_entries_day", nrOfEntriesDayBuy.Text); comm2.Parameters.AddWithValue("@hour_from", hourFromBuy.Text); comm2.Parameters.AddWithValue("@hour_until", hourUntilBuy.Text); comm2.Parameters.AddWithValue("@weekend", weekendBuy.IsChecked); comm2.Parameters.AddWithValue("@azonosito", azonosito); comm2.ExecuteNonQuery(); connection.Close(); TicketData ticket = new TicketData(); ticket.Show(); this.Close(); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(txtBarCode.Text)) { currentUser = new User(); azonosito = txtBarCode.Text; string connectionString = "datasource=127.0.0.1;port=3306;username=root;password=;database=fitnessdb"; MySqlConnection mySqlConnection = new MySqlConnection(connectionString); MySqlCommand command = new MySqlCommand("select * from users where azonosito like " + azonosito, mySqlConnection); try { mySqlConnection.Open(); MySqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { if (Convert.ToBoolean(reader["active"])) { currentUser.firstName = reader["FirstName"].ToString(); currentUser.lastName = reader["LastName"].ToString(); currentUser.email = reader["Email"].ToString(); currentUser.phoneNumber = reader["PhoneNumber"].ToString(); currentUser.birthday = reader["birthday"].ToString(); currentUser.admin = (int)reader["admin"]; currentUser.barcode = reader["azonosito"].ToString(); currentUser.active = Convert.ToBoolean(reader["active"]); mySqlConnection.Close(); // Check if admin or not if (currentUser.admin == 1) { AdminData adminData = new AdminData(); adminData.Show(); this.Close(); } else { TicketData ticketData = new TicketData(); ticketData.Show(); this.Close(); } } else { MessageBox.Show("Felhasználó törölve, ha kérdése van keresse fe la rendszergazdát!", "Fiok törölve", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { MessageBox.Show("Nem talaltuk azonositodat az adatbázisban!", "Belépési hiba"); } } catch (Exception i) { MessageBox.Show("Nem talaltuk azonositodat az adatbázisban!" + i.Message, "Belépési hiba"); } } else { MessageBox.Show("Kerjük ird be az azonosítodat!", "Üres mezők!"); } }