private void createEventButton_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString); connection.Open(); string sql = "INSERT INTO Events(EventName, Username, EventCreated) VALUES('" + newEventTextBox.Text + "', '" + username + "', '" + createEventDateTimePicker.Text + "')"; SqlCommand command = new SqlCommand(sql, connection); int result = command.ExecuteNonQuery(); if (result > 0) { //newEventTextBox = createTextBox.Text; MessageBox.Show(newEventTextBox.Text + " Event has created successfully!"); HomeWindow homeWindow = new HomeWindow(); this.Hide(); homeWindow.Show(); } else { MessageBox.Show("Error"); } connection.Close(); //MessageBox.Show(createEventDateTimePicker.Text); }
private void backNewEventButton_Click(object sender, EventArgs e) { HomeWindow homePage = new HomeWindow(); this.Hide(); homePage.Show(); }
private void backExixtingEventButton_Click(object sender, EventArgs e) { HomeWindow homeWindow = new HomeWindow(); this.Hide(); homeWindow.Show(); }
public ExistingEvent(HomeWindow homeWindow) { InitializeComponent(); this.homeWindow = homeWindow; username = homeWindow.username; fillComboBox(); //MessageBox.Show("Existing " + username); }
private void logInButton_Click(object sender, EventArgs e) { if (usernameTextBox.Text == "") { MessageBox.Show("User Name can not be empty"); } else if (passwordTextBox.Text == "") { MessageBox.Show("Password can not be empty"); } else { if (passwordTextBox.Text != passwordTextBox.Text && usernameTextBox.Text != usernameTextBox.Text) { MessageBox.Show("Wrong Information !!!"); } else { // Code for next step SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString); connection.Open(); string sql = "SELECT * FROM Users WHERE Username = '******'and password = '******'"; SqlCommand command = new SqlCommand(sql, connection); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { usernameTextBox.Text = reader["Username"].ToString(); passwordTextBox.Text = reader["Password"].ToString(); //MessageBox.Show("Welcome " + usernameTextBox.Text); HomeWindow homePage = new HomeWindow(this); this.Hide(); homePage.Show(); } else { MessageBox.Show("Wrong Information !!!"); usernameTextBox.Text = passwordTextBox.Text = ""; } connection.Close(); } } }
public NewEvent(HomeWindow homeWindow) { InitializeComponent(); this.username = homeWindow.username; //MessageBox.Show("Hi " +username); }