Exemplo n.º 1
0
 private void Btn_SignIn_Click(object sender, EventArgs e)
 {
     dh     = new DataHandler();
     player = dh.GetPLayerLogin(txt_Username.Text);
     if (player == null)
     {
         MessageBox.Show("NOT FOUND");
     }
     else if (player != null)
     {
         if (txt_Username.Text != player.Username || txt_Password.Text != player.Password)
         {
             txt_Username.Clear();
             txt_Password.Clear();
             MessageBox.Show("Username and Passwords do not match!", "Error");
         }
         else if (txt_Username.Text == player.Username || txt_Password.Text == player.Password)
         {
             MessageBox.Show("Successful Sign In", "Successful");
             this.Hide();
             Player p = dh.GetPLayerLogin(txt_Username.Text);
             playerID = p.Id;
             PickAircraft mg = new PickAircraft(p.Id);
             mg.Show();
         }
     }
 }
Exemplo n.º 2
0
 private void Btn_SignUp_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime dt = dtp_Player.Value;
         if (CheckDates(dt) == true)
         {
             player = new Player(txt_Name.Text, txt_Username.Text, txt_Password.Text, dtp_Player.Value.ToString("yyyy-MM-dd"));
             MessageBox.Show("Player Added Successfully", "TIME TO GAME!!");
             dh.AddPlayer(player);
             this.Hide();
             Player       p  = dh.GetPLayerLogin(txt_Username.Text);
             PickAircraft sn = new PickAircraft(p.Id);
             sn.Show();
         }
         else if (CheckDates(dt) == false)
         {
             MessageBox.Show("You need to be at least 16 to Play MILITARY MADNESS", "OOPS...");
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
 }