Exemplo n.º 1
0
 private void btnLogin_Click(object sender, RoutedEventArgs e)
 {
     try {
         string username = txtUserName.Text;
         User user = UserBLL.GetUserByUName(username);
         if (user != null && user.Password.Equals(txtPassword.Text))
         {
             if (!user.Role)
             {
                 CurUser = user;
                 StaffForm sf = new StaffForm(user);
                 sf.Show();
                 this.Close();
                 //      Application.Current.
             }
             else if (user.Role)
             {
                 CurUser = user;
                 AdminForm af = new AdminForm(user);
                 af.Show();
                 this.Close();
             }
         }
         else
         {
             lblMessage.Visibility = Visibility.Visible;
             lblMessage.IsEnabled = true;
             lblMessage.Content = "Username/Password is wrong";
         } }
     catch(Exception g)
     {
         System.Windows.Forms.MessageBox.Show(g.Message);
     }
 }
Exemplo n.º 2
0
 private void ShowAdminForm()
 {
     AdminForm af = new AdminForm(CurUser);
     af.Show();
 }