Ejemplo n.º 1
0
        public int UpAccount(BEL_TaiKhoan tk)
        {
            string sql = "UPDATE [dbo].[TaiKhoan] " +
                         "SET MaNV = @manv, LanDangNhapCuoi = @lancuoi , MaQuyen = @maquyen , TrangThai = @trangthai WHERE MaNV = @manv ";
            int result = DataProvider.Instance.ExecuteNonQuery(sql, new object[] { tk.Manv, tk.LanCuoiDangNhap, tk.Maquyen, tk.Trangthai, tk.Manv });

            return(result);
        }
Ejemplo n.º 2
0
        public int AddAccount(BEL_TaiKhoan tk, string mk)
        {
            string sql = "INSERT INTO [dbo].[TaiKhoan] " +
                         "VALUES( @username , @manv , @password , @landangnhapcuoi , @maquyen , @trangthai )";
            int result = DataProvider.Instance.ExecuteNonQuery(sql, new object[] { tk.Username, tk.Manv, mk, tk.LanCuoiDangNhap, tk.Maquyen, tk.Trangthai });

            return(result);
        }
Ejemplo n.º 3
0
        public BEL_TaiKhoan LoadTK(string Username, string Password)
        {
            Password = MaHoa(Password);
            BEL_TaiKhoan tk   = null;
            DataTable    data = DAL_TaiKhoan.Instance.LoadTK(Username, Password);

            foreach (DataRow row in data.Rows)
            {
                tk = new BEL_TaiKhoan(row);
            }
            return(tk);
        }
Ejemplo n.º 4
0
        public List <BEL_TaiKhoan> LoadListTK()
        {
            List <BEL_TaiKhoan> list = new List <BEL_TaiKhoan>();
            DataTable           data = DAL_TaiKhoan.Instance.LoadListTK();

            foreach (DataRow row in data.Rows)
            {
                BEL_TaiKhoan item = new BEL_TaiKhoan(row);
                list.Add(item);
            }
            return(list);
        }
Ejemplo n.º 5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string Username = txtUserName.Text;
            string Password = txtPassWord.Text;

            if (Login(Username, Password))
            {
                BEL_TaiKhoan tk = BAL_TaiKhoan.Instance.LoadTK(Username, Password);
                fAdmin       Ad = new fAdmin(tk);
                this.Hide();
                Ad.ShowDialog();
                this.Show();
            }
            else
            {
                MessageBox.Show("Sai tên tài khoản hoặc mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 6
0
        private void btnTKSua_Click(object sender, EventArgs e)
        {
            int manv = int.Parse(cbbTKMaNV.Text);

            if (txtTKUsername.Text != "" && cbbMaQuyen.Text != "" && cbbTKMaNV.Text != "")
            {
                BEL_TaiKhoan tk = new BEL_TaiKhoan(1, txtTKUsername.Text, manv, DateTime.Now, cbbMaQuyen.Text, "Yes");
                if (BAL_TaiKhoan.Instance.UpAccount(tk))
                {
                    MessageBox.Show("Sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadAccount();
                }
                else
                {
                    MessageBox.Show("Sửa thất bại hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Hãy điền đầy đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 7
0
 public fAdmin(BEL_TaiKhoan tk)
 {
     InitializeComponent();
     this.TK = tk;
 }
Ejemplo n.º 8
0
        public bool UpAccount(BEL_TaiKhoan tk)
        {
            int result = DAL_TaiKhoan.Instance.UpAccount(tk);

            return(result > 0);
        }
Ejemplo n.º 9
0
        public bool AddAccount(BEL_TaiKhoan tk)
        {
            int result = DAL_TaiKhoan.Instance.AddAccount(tk, MaHoa("123"));

            return(result > 0);
        }