/// <summary> /// This function defines the actions taken after the user pressed the 'connect' button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void b_connect_Click(object sender, RoutedEventArgs e) { DataTable dt = controller.connect(tb_mail.Text, tb_password.Text); if (dt == null) { MessageBox.Show("שם המשתמש ו/או הסיסמא אינם תקינים, נסה שנית או הרשם למערכת"); } else { UserWindow userWin = new UserWindow(tb_mail.Text, controller); Visibility = Visibility.Hidden; userWin.Closed += UserWin_Closed; userWin.Show(); } }
/// <summary> /// This function defines the actions taken after the user pressed the 'connect' button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void b_connect_Click(object sender, RoutedEventArgs e) { string connectionString = PartnerMatcher.Properties.Settings.Default.DBconnection; int counter = 0; OleDbConnection connection = new OleDbConnection(connectionString); try { connection.Open(); OleDbCommand command = new OleDbCommand("select * from Users where mail ='" + tb_mail.Text + "'" + " and password ='******'"); command.Connection = connection; OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { counter++; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } if (counter == 0) { MessageBox.Show("שם המשתמש ו/או הסיסמא אינם תקינים, נסה שנית או הרשם למערכת"); } else { flag = true; UserWindow uw = new UserWindow(tb_mail.Text); uw.Show(); this.Close(); } }