示例#1
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;

            if (username == "" || password == "") // username or password is empty
            {
                MessageBox.Show("Username and password are required!");
                return;
            }
            else   // have entered username and password
            {
                StudentAccount theAccount = new StudentDAL().studentLogin(username, password);
                if (theAccount != null) // correct username and password
                {
                    // create this student
                    Student theStudent = new StudentDAL().getTheStudent(theAccount.studentID);
                    this.Hide();
                    ManagementForm managerWindow = new ManagementForm(theAccount, theStudent);
                    managerWindow.Show();
                }
                else // wrong username or password
                {
                    errorMessage.ForeColor = Color.Yellow;
                    errorMessage.Text      = "Wrong username or password";
                }
            }
        }
示例#2
0
 public employeeUC(Employee connectedEmployee, Employee employee, ManagementForm managementForm)
 {
     InitializeComponent();
     this.employee          = employee;
     this.managementForm    = managementForm;
     this.connectedEmployee = connectedEmployee;
 }
示例#3
0
        // Login
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection conn = ConnectSQL.getDBConnection();
                conn.Open();

                String     str = "select * from Account where mid = '" + cmbMID.Text + "' and password = '******'";
                SqlCommand cmd = new SqlCommand(str, conn);

                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataSet        ds  = new DataSet();
                sda.Fill(ds);

                conn.Close();

                int count = ds.Tables[0].Rows.Count;

                // if count == 1 is success

                if (count == 1)
                {
                    // Login success
                    typeLogin = ds.Tables[0].Rows[0]["type"].ToString();
                    idLogin   = ds.Tables[0].Rows[0]["mid"].ToString();
                    if (typeLogin == "True")
                    {
                        ManagementForm managementForm = new ManagementForm();
                        managementForm.Show();
                        this.Hide();
                    }
                    else
                    {
                        ManagementForm managementForm = new ManagementForm();
                        managementForm.Show();
                        this.Hide();
                    }
                }
                else
                {
                    // Login failed
                    MessageBox.Show("failed");
                }

                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("error: " + ex);
            }
        }
示例#4
0
        private void usersManagement_Click(object sender, EventArgs e)
        {
            Visible = false;
            var managementForm = new ManagementForm(_userLogin);

            managementForm.Focus();
            using (managementForm)
            {
                managementForm.ShowDialog(this);
                _userLogin = managementForm.AdminLogin;
            }
            Focus();
            Visible = true;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            ManagementForm m = new ManagementForm();

            m.Show();
        }