Beispiel #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                Employee oEmployee = new Employee();

                Boolean bResult = oEmployee.Login(txtName.Text, txtPassword.Text);

                if (bResult)
                {
                    MessageBox.Show("Your security level is: " + oEmployee.SecurityLevel);
                }
                else
                {
                    MessageBox.Show("Login Failed");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         // declare and instantiate a variable of type employee called oEmployee
         Employee oEmployee = new Employee();
         // call the Login method of the oEmployee object, passing in the values of the login
         // name and the password from the text boxes on the form. Capture the return value in a
         // Boolean variable called bResult
         Boolean bResult = oEmployee.Login(txtName.Text, txtPassword.Text);
         if (bResult == true)
         {
             MessageBox.Show("Your security level is " + oEmployee.SecurityLevel);
         }
         else
         {
             MessageBox.Show("Login Failed");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
 static void Main()
 {
     Employee oEmployee = new Employee();
     Employee pEmployee = new Employee();
     oEmployee.Login("Smith", "js");
     Console.WriteLine("your security level is: " + oEmployee.SecurityLevel);
     Console.WriteLine("number of employees: " + Employee.NumEmployees);
 }