Beispiel #1
0
 private void bLogin_Click(object sender, EventArgs e)
 {
     Login login = new Login();
     Role role;
     if (login.ShowDialog() == DialogResult.OK)
     {
         switch (login.Role)
         {
             case "m":
                 role = new ManagerRole();
                 break;
             case "e":
                 role = new EmployeeRole();
                 break;
             case "c":
                 role = new CustomerRole();
                 break;
             default:
                 role = Role.Instance;
                 break;
         }
     }
     else
     {
         role = Role.Instance;
     }
     #if DEBUG
     var type = role.GetType();
     if(type == typeof(ManagerRole))
     {
         MessageBox.Show("Manager");
     }
     else if(type == typeof(EmployeeRole))
     {
         MessageBox.Show("Employee");
     }
     else if(type == typeof(CustomerRole))
     {
         MessageBox.Show("Customer");
     }
     else
     {
         MessageBox.Show("Guest");
     }
     #endif
 }
Beispiel #2
0
        private void tsmiLogin_Click(object sender, EventArgs e)
        {
            Login login = new Login();
            if(login.ShowDialog() == DialogResult.Cancel)
            {
                MessageBox.Show("Currently NO Customer Access!");
                Application.Exit();
            }
            #if DEBUG
            var type = Role.Instance.GetType();
            if (type == typeof(ManagerRole))
            {
                MessageBox.Show("Manager");
            }
            else if (type == typeof(EmployeeRole))
            {
                MessageBox.Show("Employee");
            }
            else if (type == typeof(CustomerRole))
            {
                MessageBox.Show("Customer");

            }
            else
            {
                MessageBox.Show("Guest");
            }
            #endif
            changeView();
        }