Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string     id   = txtEmID.Text;
            string     pass = txtEmPass.Text;
            EmployeeDB edb  = new EmployeeDB();
            Employee   em   = edb.Login(id, pass);

            if (em == null)
            {
                MessageBox.Show("Wrong ID or Password");
            }
            else
            {
                if (em.EmpRole == false)
                {
                    frmChangeAccount change = new frmChangeAccount(em);
                    this.Hide();
                    change.ShowDialog();
                    this.Show();
                }
                else
                {
                    frmMaintainBook main = new frmMaintainBook();
                    this.Hide();
                    main.ShowDialog();
                    this.Show();
                }
            }
        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string   userName = txtUsername.Text;
            string   password = txtPassword.Text;
            CheckMD5 md5      = new CheckMD5();

            EmployeeDAO dao = new EmployeeDAO();
            EmployeeDTO dto = dao.CheckLogin(userName, md5.CreateMD5(password));

            if (dto != null && dto.EmpRole == false)
            {
                frmChangeAccount changeAccountForm = new frmChangeAccount(dto, this);
                this.Hide();
                changeAccountForm.Show();
                changeAccountForm.FormClosed += Main_Closed;
            }
            else if (dto != null && dto.EmpRole == true)
            {
                frmMaintainBooks booksForm = new frmMaintainBooks(this);
                this.Hide();
                booksForm.Show();
                booksForm.FormClosed += Main_Closed;
            }
            else if (dto == null)
            {
                MessageBox.Show("Invalid username or password!!!");
            }
        }
Example #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Employee emp      = new Employee();
            string   username = txtUsername.Text;

            if (username == string.Empty)
            {
                MessageBox.Show("Username is not be empty.");
                return;
            }
            string password = txtPassword.Text;

            if (password == string.Empty)
            {
                MessageBox.Show("Password is not be empty.");
                return;
            }
            emp = dao.checkLogin(username, password);
            if (emp == null)
            {
                MessageBox.Show("Wrong username or password!!!!");
            }
            else
            {
                if (emp.role == false)
                {
                    MessageBox.Show("Your Account Detail.");

                    frmChangeAccount frm = new frmChangeAccount(emp);
                    DialogResult     r   = frm.ShowDialog();
                    if (r == DialogResult.OK)
                    {
                        emp = frm.employee;
                        //dtProduct.Rows.Add(pro.ProductID, pro.ProductName, pro.UnitPrice, pro.ProductQuantity);
                    }
                }
                else
                {
                    MessageBox.Show("Login Successfull.");
                    frmMaintainBooks frm = new frmMaintainBooks();
                    //DialogResult r =
                    frm.ShowDialog();
                    //if (r == DialogResult.OK)
                    //{
                    //    //emp = frm.employee;
                    //    //dtProduct.Rows.Add(pro.ProductID, pro.ProductName, pro.UnitPrice, pro.ProductQuantity);
                    //}
                }
            }
        }