예제 #1
0
        private void btnSearchHD_Click(object sender, RoutedEventArgs e)
        {
            HoaDonBan hdb = new HoaDonBan();

            if (string.IsNullOrEmpty(txtIDHD.Text))
            {
                MessageBox.Show("Dữ liệu chưa đầy đủ!");
                return;
            }
            else
            {
                if (hdb.KTHoaDon(txtIDHD.Text) == false)
                {
                    MessageBox.Show("Sai mã hóa đơn hoặc chưa lập hóa đơn rồi -_-");
                    return;
                }
                else
                {
                    CTHDB cthdb = new CTHDB();
                    MessageBox.Show("Đã tìm thấy", "Tộc phèo caffein vui vẻ nói: ", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    dataGrid.DataContext = cthdb.LayViewCTHDB(txtIDHD.Text);
                    txtTongTien.Text     = hdb.LayTongTien(txtIDHD.Text).ToString();
                    var hdb1 = hdb.LayHDB(txtIDHD.Text);
                    txtIDKH.Text = hdb1.makh;
                    var kh  = new KhachHang();
                    var kh1 = kh.LayKH(hdb1.makh, "", "");
                    txtTenKH.Text  = kh1.tenkh;
                    txtCMNDKH.Text = kh1.cmnd;
                    txtIDNV.Text   = hdb1.manv;
                }
            }
        }
예제 #2
0
 private void txtIDKH_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (txtIDKH.Text != "")
     {
         KhachHang kh  = new KhachHang();
         var       kh1 = kh.LayKH(txtIDKH.Text);
         if (kh1 != null)
         {
             txtIDKH.Text     = kh1.makh;
             txtTenKH.Text    = kh1.tenkh;
             txtCMNDKH.Text   = kh1.cmnd;
             txtDiaChi.Text   = kh1.diachi;
             txtGioiTinh.Text = kh1.gioitinh;
             txtNgSinh.Text   = kh1.ngaysinh.Value.Date.ToString("dd/MM/yyyy");
             txtSDT.Text      = kh1.sdt;
         }
     }
 }
예제 #3
0
        private void btnCheckKH_Click(object sender, RoutedEventArgs e)
        {
            KhachHang kh  = new KhachHang();
            var       kh1 = kh.LayKH(txtIDKH.Text, txtCMNDKH.Text, "");

            if (kh1 != null)
            {
                txtTenKH.Text  = kh1.tenkh;
                txtCMNDKH.Text = kh1.cmnd;
                txtIDKH.Text   = kh1.makh;
            }
            else
            {
                MessageBox.Show("Không có khách hàng này!!! Có thể đăng ký hoặc chọn mã KH000 dành cho khách hàng không đăng ký");
                txtIDKH.Text   = "KH000";
                txtCMNDKH.Text = "000";
                txtTenKH.Text  = "Anonymous";
            }
        }