Example #1
0
        private void LoadListNV()
        {
            AccountSevice  account = new AccountSevice();
            List <Account> list    = account.getALLNV();

            dtgNV.DataSource = list;
        }
Example #2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            String txtUsername = tbTaiKhoan.Text;
            String txtPass     = tbMatKhau.Text;

            if (txtUsername == "")
            {
                MessageBox.Show("Vui lòng nhập tên tài khoản");
            }
            else if (txtPass == "")
            {
                MessageBox.Show("Vui lòng nhập mật khẩu");
            }
            else
            {
                AccountSevice account = new AccountSevice();
                Account       ac      = account.login(txtUsername, txtPass);
                if (ac != null)
                {
                    NV = ac;
                    if (ac.role == 0)
                    {
                        Main main = new Main();
                        this.Hide();
                        main.ShowDialog();
                        this.Show();
                    }
                    else if (ac.role == 1)
                    {
                        MainThuNgan mainThuNgan = new MainThuNgan();
                        this.Hide();
                        mainThuNgan.ShowDialog();
                        this.Show();
                    }
                    else if (ac.role == 2)
                    {
                        MainNV mainNV = new MainNV();
                        this.Hide();
                        mainNV.ShowDialog();
                        this.Show();
                    }
                    else
                    {
                        MainDauBep mainDauBep = new MainDauBep();
                        this.Hide();
                        mainDauBep.ShowDialog();
                        this.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Sai tài khoản hoặc mật khẩu");
                }
            }
        }
Example #3
0
        private void btnThemNhanVien_Click(object sender, EventArgs e)
        {
            AccountSevice accountSevice = new AccountSevice();
            String        txtUser       = tbUsername.Text;
            String        pass          = tbPass.Text;
            String        role          = tbRole.Text;
            String        txtName       = tbNameNV.Text;
            String        phone         = tbSDT.Text;
            String        address       = tbDiaChi.Text;
            String        email         = tbEmail.Text;
            bool          gioitinh;
            int           type;

            if (rbFemale.Checked)
            {
                gioitinh = false;
            }
            else
            {
                gioitinh = true;
            }

            DateTime birthday = dtNgaySinh.Value;

            if (txtUser == "" || pass == "" || txtName == "" || phone == "" || address == "" || email == "")
            {
                MessageBox.Show("Vui lòng nhập đầy đủ");
            }
            else
            {
                if (role == "TN")
                {
                    type = 1;
                    Account account = new Account {
                        username = txtUser, pass = pass, role = type, name = txtName, phone = phone, address = address, email = email, gioitinh = gioitinh, ngaysinh = birthday
                    };
                    accountSevice.addNV(account);
                    LoadListNV();
                }
                else if (role == "PV")
                {
                    type = 2;

                    Account account = new Account {
                        username = txtUser, pass = pass, role = type, name = txtName, phone = phone, address = address, email = email, gioitinh = gioitinh, ngaysinh = birthday
                    };
                    accountSevice.addNV(account);
                    LoadListNV();
                }
                else if (role == "DB")
                {
                    type = 3;
                    Account account = new Account {
                        username = txtUser, pass = pass, role = type, name = txtName, phone = phone, address = address, email = email, gioitinh = gioitinh, ngaysinh = birthday
                    };
                    accountSevice.addNV(account);
                    LoadListNV();
                }
                else
                {
                    MessageBox.Show("Sai vị trí");
                }
            }
        }
Example #4
0
        private void LoadListNVBySearch(String find)
        {
            AccountSevice accountSevice = new AccountSevice();

            dtgNV.DataSource = accountSevice.GetAccountsBySearch(find);
        }