Exemplo n.º 1
0
 private void lsvHoaDon_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lsvHoaDon.SelectedItems.Count > 0)
     {
         txtMaHoaDon.Text             = lsvHoaDon.SelectedItems[0].SubItems[0].Text;
         cbbTenNhanVien.SelectedIndex = cbbTenNhanVien.FindString(lsvHoaDon.SelectedItems[0].SubItems[1].Text);
         txtMaNV.Text = cbbTenNhanVien.SelectedValue.ToString();
         cbbTenKhachHang.SelectedIndex = cbbTenKhachHang.FindString(lsvHoaDon.SelectedItems[0].SubItems[2].Text);
         txtMaKH.Text      = cbbTenKhachHang.SelectedValue.ToString();
         txtDiaChi.Text    = db.LayGiaTriCuaBang("select diachi from KHACHHANG where makh = '" + txtMaKH.Text + "'");
         txtDienThoai.Text = db.LayGiaTriCuaBang("select sodienthoai from KHACHHANG where makh = '" + txtMaKH.Text + "'");
         dtpNgayBan.Value  = DateTime.Parse(lsvHoaDon.SelectedItems[0].SubItems[3].Text);
     }
 }
 private void cbbTenSanPham_TextChanged(object sender, EventArgs e)
 {
     txtMaSanPham.Text = db.LayGiaTriCuaBang("select masanpham from sanpham where masanpham = '" + cbbTenSanPham.SelectedValue + "'");
     txtDonGia.Text    = db.LayGiaTriCuaBang("select giaban from sanpham where masanpham = '" + cbbTenSanPham.SelectedValue + "'");
 }