예제 #1
0
        public static bool DoiMatKhau(string userName, string pass)
        {
            DbCommand command = DataAccessCode.CreateCommand();
            string    sql     = "UPDATE NguoiDung SET MatKhau = '" + pass + "' WHERE TenDangNhap = '" + userName + "' ";

            System.Windows.Forms.MessageBox.Show(sql);
            if (DataAccessCode.ExecuteQuery(sql, command))
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        public static bool ThayDoiTaiKhoan(int maNhanVien, string taiKhoan, string matKhau)
        {
            DbCommand command = DataAccessCode.CreateCommand();
            string    sql     = string.Format("UPDATE NGUOIDUNG SET('N{0}','N{1}',N'{2}')", maNhanVien, taiKhoan, matKhau);

            if (DataAccessCode.ExecuteQuery(sql, command))
            {
                MessageBox.Show("Thay Đổi Một Tài Khoản Thành Công", "Thông Tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(true);
            }
            return(false);
        }
예제 #3
0
        public static bool ThemTaiKhoan(int maNhanVien, string taiKhoan, string matKhau)
        {
            DbCommand command = DataAccessCode.CreateCommand();
            string    sql     = string.Format("INSERT INTO NGUOIDUNG(MaNhanVien, TenDangNhap , MatKhau)" +
                                              "VALUES(N'{0}',N{1},N{2})", maNhanVien, taiKhoan, matKhau);

            if (DataAccessCode.ExecuteQuery(sql, command))
            {
                MessageBox.Show("Thêm Mới Một Tài Khoản Thành Công", "Thông Tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(true);
            }
            return(false);
        }
        public static bool SuaNhaHang(NhaHangDTO nhaHang)
        {
            DbCommand command = DataAccessCode.CreateCommand();
            string    sql     = string.Format("UPDATE NHAHANG SET TenNhaHang ={0},DiaChi = {1},DienThoai ={2}", nhaHang.TenNhaHang, nhaHang.DiaChi, nhaHang.DienThoai);

            if (DataAccessCode.ExecuteQuery(sql, command))
            {
                MessageBox.Show("Sửa Nhà Hàng Thành Công", "Thông Tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool ThemNhaHang(NhaHangDTO nhaHang)
        {
            DbCommand command = DataAccessCode.CreateCommand();

            if (KiemTraTruocKhiLuu(nhaHang))
            {
                string sql = string.Format("INSERT INTO NHAHANG (TenNhaHang, DiaChi, DienThoai)"
                                           + "VALUES(N'{0}',N'{1}',N'{2}')", nhaHang.TenNhaHang, nhaHang.DiaChi, nhaHang.DienThoai);
                if (DataAccessCode.ExecuteQuery(sql, command))
                {
                    MessageBox.Show("Thêm Nhà Hàng Thành Công", "Thông Tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }