Ejemplo n.º 1
0
        //lưu
        private void button2_Click(object sender, EventArgs e)
        {
            if (Them == true)
            {
                try
                {
                    // Thực hiện lệnh

                    BLQLAdmin.ThemNguoiDung(this.tk.Text, this.mk.Text, this.quyenhan, ref err);
                    // Load lại dữ liệu trên DataGridView
                    LoadData();
                    // Thông báo
                    MessageBox.Show("Đã thêm xong!");
                }
                catch (SqlException)
                {
                    MessageBox.Show("Không thêm được. Lỗi rồi!");
                }
            }
            if (Sua == true)
            {
                BLtaotaikhoanuser BLQLAdmin1 = new BLtaotaikhoanuser();
                BLQLAdmin1.CapNhatNguoiDung(this.tk.Text, this.mk.Text, ref err);
                //, this.quyenhan,

                // Load lại dữ liệu trên DataGridView
                LoadData();
                // Thông báo
                MessageBox.Show("Đã sửa xong!");
            }
        }
Ejemplo n.º 2
0
        //lưu
        private void luu_Click(object sender, EventArgs e)
        {
            if (Them)
            {
                if (kiemtratontai())
                {
                    MessageBox.Show("Tên tài khoản đã tồn tại !");
                }
                else
                {
                    try
                    {
                        // Thực hiện lệnh
                        BLtaotaikhoanuser dbTTKUser = new BLtaotaikhoanuser();

                        dbTTKUser.ThemNguoiDung(this.tentaikhoan.Text, this.matkhau.Text, this.quyenmacdinh.Text, ref err);
                        BLQLDG.ThemDocGia(this.textBox1.Text, this.tentaikhoan.Text, this.tsest, this.tsest, b, ref err);

                        // Thông báo
                        MessageBox.Show("Đã thêm xong!");
                    }
                    catch (SqlException)
                    {
                        MessageBox.Show("Không thêm được. Lỗi rồi!");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        //kiểm tra tài khoản có bị trùng ko
        private bool kiemtratontai()
        {
            BLtaotaikhoanuser kttk = new BLtaotaikhoanuser();
            bool   tatkt           = false;
            string tk = tentaikhoan.Text;

            if (kttk.KiemTraNguoiDung(tk) == true)
            {
                tatkt = true;
            }
            return(tatkt);
        }
Ejemplo n.º 4
0
        //sửa
        private void button1_Click(object sender, EventArgs e)
        {
            if (Sua == true)
            {
                BLtaotaikhoanuser BLQLAdmin1 = new BLtaotaikhoanuser();
                BLQLAdmin1.CapNhatNguoiDung(this.tk.Text, this.mk.Text, ref err);
                //, this.quyenhan,

                // Load lại dữ liệu trên DataGridView
                LoadData();
                // Thông báo
                MessageBox.Show("Đã sửa xong!");
            }
        }