/// <summary>
 /// Deprecated Method for adding a new object to the ChiTietHoaDons EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToChiTietHoaDons(ChiTietHoaDon chiTietHoaDon)
 {
     base.AddObject("ChiTietHoaDons", chiTietHoaDon);
 }
 /// <summary>
 /// Create a new ChiTietHoaDon object.
 /// </summary>
 /// <param name="maChiTietHoaDon">Initial value of the MaChiTietHoaDon property.</param>
 public static ChiTietHoaDon CreateChiTietHoaDon(global::System.Int32 maChiTietHoaDon)
 {
     ChiTietHoaDon chiTietHoaDon = new ChiTietHoaDon();
     chiTietHoaDon.MaChiTietHoaDon = maChiTietHoaDon;
     return chiTietHoaDon;
 }
        public void TaoHoaDon(HoaDon hoaDon)
        {
            float tongTien = 0;

            foreach (var item in CacGoiHang)
            {
                var chiTietHoaDon = new ChiTietHoaDon()
                {
                    BiXoa = false,
                    GiaTienHienTai = item.SanPhamDuocChon.Gia,
                    MaSanPham = item.SanPhamDuocChon.MaSanPham,
                };
                hoaDon.ChiTietHoaDons.Add(chiTietHoaDon);
                tongTien += float.Parse(item.SanPhamDuocChon.Gia.ToString()) * item.SoLuong;
            }

            hoaDon.TongTien = tongTien;

            LamTrongGioHang();
        }