public bool UpDatekhachhang(eKhachHang kh)
        {
            try
            {
                Tbl_KhachHang update = DB.Tbl_KhachHangs.Single(tmp => tmp.maKH == kh.Makh);

                update.maKH        = kh.Makh;
                update.tenKH       = kh.Tenkh;
                update.diachi      = kh.Diachi;
                update.email       = kh.Email;
                update.gioitinh    = kh.Gioitinh;
                update.nghenghiep  = kh.Nghenghiep;
                update.soCMND      = kh.Socmnd;
                update.sodienthoai = kh.Sodienthoai;
                update.trangthai   = kh.Trangthai;
                update.ngaycapCMND = kh.Ngaycapcmnd;
                update.ngaysinh    = kh.Ngaysinh;

                DB.SubmitChanges();

                return(true);
            }

            catch { return(false); }
        }
        public int AddKH(eKhachHang kh)
        {
            var makhachhang = DB.Tbl_KhachHangs.Where(x => x.maKH == kh.Makh).FirstOrDefault();

            if (makhachhang != null)
            {
                return(0);
            }
            Tbl_KhachHang khTmp = new Tbl_KhachHang();

            khTmp.maKH        = kh.Makh;
            khTmp.tenKH       = kh.Tenkh;
            khTmp.diachi      = kh.Diachi;
            khTmp.soCMND      = kh.Socmnd;
            khTmp.sodienthoai = kh.Sodienthoai;
            khTmp.gioitinh    = kh.Gioitinh;
            khTmp.ngaycapCMND = kh.Ngaycapcmnd;
            khTmp.nghenghiep  = kh.Nghenghiep;
            khTmp.ngaysinh    = kh.Ngaysinh;
            khTmp.trangthai   = kh.Trangthai;
            khTmp.email       = kh.Email;

            DB.Tbl_KhachHangs.InsertOnSubmit(khTmp);
            DB.SubmitChanges();
            return(1);
        }
        public bool AddKH(Entities.KhachHang.KhachHang kh)
        {
            try
            {
                Tbl_KhachHang newKHRecord = DB.Tbl_KhachHangs.Where(x => x.maKH == kh.Makh).FirstOrDefault();
                if (newKHRecord != null)
                {
                    return(0);///trường hợp trùng
                }
                newKHRecord             = new Tbl_KhachHang();
                newKHRecord.maKH        = kh.Makh;
                newKHRecord.tenKH       = kh.Tenkh;
                newKHRecord.diachi      = kh.Diachi;
                newKHRecord.soCMND      = kh.Socmnd;
                newKHRecord.sodienthoai = kh.Sodienthoai;
                newKHRecord.gioitinh    = kh.Gioitinh;
                newKHRecord.ngaycapCMND = kh.Ngaycapcmnd;
                newKHRecord.nghenghiep  = kh.Nghenghiep;
                newKHRecord.ngaysinh    = kh.Ngaysinh;
                newKHRecord.trangthai   = kh.Trangthai;
                newKHRecord.email       = kh.Email;
                DB.SubmitChanges();

                return(true);
            }
            catch { return(false); }
        }
        /*public bool Delete(string deleteID)
         * {
         *  try
         *  {
         *      Tbl_KhachHang deleteRecord = DB.Tbl_KhachHangs.Single(record => record.maKH == deleteID);
         *
         *      DB.Tbl_KhachHangs.DeleteOnSubmit(deleteRecord);
         *      DB.SubmitChanges();
         *
         *      return true;
         *  }
         *  catch { return false; }
         * }*/

        public bool Update(Entities.KhachHang.KhachHang updateKH)
        {
            try
            {
                Tbl_KhachHang updateRecord = DB.Tbl_KhachHangs.Single(record => record.maKH == updateKH.Makh);

                updateRecord.maKH        = updateKH.Makh;
                updateRecord.tenKH       = updateKH.Tenkh;
                updateRecord.diachi      = updateKH.Diachi;
                updateRecord.email       = updateKH.Email;
                updateRecord.gioitinh    = updateKH.Gioitinh;
                updateRecord.ngaycapCMND = updateKH.Ngaycapcmnd;
                updateRecord.ngaysinh    = updateKH.Ngaysinh;
                updateRecord.nghenghiep  = updateKH.Nghenghiep;
                updateRecord.soCMND      = updateKH.Socmnd;
                updateRecord.sodienthoai = updateKH.Sodienthoai;
                updateRecord.trangthai   = updateKH.Trangthai;

                DB.SubmitChanges();

                return(true);
            }
            catch { return(false); }
        }