public AddUserAccount1(AdminPanel adminPanel) { InitializeComponent(); this.SizeToContent = SizeToContent.Height; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; this._adminPanel = adminPanel; }
public void LoginUser() { int id; if (int.TryParse(txtId.Text.ToString(), out id)) { user = repozitory.Login(id, txtPassword.Password.ToString()); if ((user == null)) { MessageBox.Show("Invalid ID or Password"); } else if ((user.UserAccount.AccountNumber == 19) && (user.Password == "admin")) { MessageBox.Show("Welcome " + user.Name); this.DialogResult = false; this.Close(); AdminPanel adminPanel = new AdminPanel(); adminPanel.ShowDialog(); } else if ((user != null)) { MessageBox.Show("Welcome " + user.Name); _mainWindow.btnDeposit.IsEnabled = true; _mainWindow.btnWithDraw.IsEnabled = true; _mainWindow.txtAmount.IsEnabled = true; _mainWindow.txtbName.Text = user.Name; _mainWindow.txtbId.Text = user.ID.ToString(); _mainWindow.txtBalance.Text = user.UserAccount.Balance.ToString("c2"); _mainWindow.btnLogin.IsEnabled = false; _mainWindow.btnLogin.Visibility = Visibility.Hidden; _mainWindow.btnLogOut.IsEnabled = true; _mainWindow.btnLogOut.Visibility = Visibility.Visible; this.DialogResult = true; this.Close(); } else { return; } } else { MessageBox.Show("ID can only be a number"); } }