private void btn_login_Click(object sender, RoutedEventArgs e) { Authentication.Authentication auth = new Authentication.Authentication(); GamePlay.GameRounds rounds = new GamePlay.GameRounds(); auth.UserName = txt_Username.Text.Trim(); auth.Password = txt_Pswd.Password.ToString().Trim(); string flag = auth.validate_login(); if (flag == string.Empty) { rounds.NextRound(2, auth.UserName); Screens.Game game = new Screens.Game(auth.UserName); game.Show(); } else { var res = MessageBox.Show(flag, "Error Information", MessageBoxButton.OK, MessageBoxImage.Error); auth.error_flag = string.Empty; if (res.ToString() == "OK") { txt_Username.Text = string.Empty; txt_Pswd.Password = string.Empty; this.Show(); } } }
private void btn_Click(object sender, RoutedEventArgs e) { DataTable dt = new DataTable(); DBLib lib = new DBLib(); dt = lib.SelectQuery("select * from Tbl_Users where status='1' and UserName='******'"); if (dt.Rows.Count > 0) { GamePlay.GameRounds round = new GamePlay.GameRounds(); round.NextRound(_roundno, txt_username.Text.ToString()); Screens.Game game = new Screens.Game(txt_username.Text); this.Close(); game.Show(); } else { MessageBox.Show("Invalid User", "Error", MessageBoxButton.OK, MessageBoxImage.Error); txt_username.Text = string.Empty; } }