Esempio n. 1
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            WinHomeAdmin winadmin = new WinHomeAdmin();

            winadmin.Show();
            //Todo: Make this wire up to the home page, and change DBConnector.CheckLogIn so that it also returns whether or not the user is an admin.
            if (txtStaffID.Text != string.Empty && connector.CheckLogIn(txtStaffID.Text) >= 0)
            {
                Testing test = new Testing();
                test.Show();
                this.Close();
            }
            else if (connector.CheckLogIn(txtStaffID.Text) <= 0)
            {
                MessageBox.Show("Unable to connect to Database. Contact your administrator.");
            }
            else
            {
                MessageBox.Show("Please enter a valid Staff ID!");
            }
        }
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (txtStaffID.Text == string.Empty)
         {
             MessageBox.Show("Please enter a valid Staff ID!");
         }
         else if (Connector.CheckLogIn(txtStaffID.Text) >= 0)
         {
             if (Connector.CheckAdminStatus(txtStaffID.Text))
             {
                 Main adminWindow = new Main(true, Convert.ToInt32(txtStaffID.Text), Connector);
                 adminWindow.Show();
                 this.Close();
             }
             else
             {
                 Main homeWindow = new Main(false, Convert.ToInt32(txtStaffID.Text), Connector);
                 homeWindow.Show();
                 this.Close();
             }
         }
         else if (Connector.CheckLogIn(txtStaffID.Text) <= 0)
         {
             MessageBox.Show("Unable to connect to Database. Contact your administrator.");
         }
         else
         {
         }
     } catch (NullReferenceException ex)
     {
         Console.WriteLine(ex.Message);
         MessageBox.Show("Have you entered server information?");
     }
 }