public HoaDon() { MaHD = 0; NV = new NhanVien(); KH = new KhachHang(); NgayLap = DateTime.Now; ThanhToan = 0; TrangThai = 1; ChiTiet = new ChiTietHD(); }
public HoaDon(int mahd) { MaHD = mahd; if (mahd == 0) { NV = new NhanVien(); KH = new KhachHang(); NgayLap = DateTime.Now; ThanhToan = 0; TrangThai = 1; ChiTiet = new ChiTietHD(); return; } DataTable dt = HoaDonControl.layDuLieu(mahd); NV = new NhanVien(Convert.ToInt32(dt.Rows[0]["MaNV"].ToString())); KH = new KhachHang(Convert.ToInt32(dt.Rows[0]["MaKH"].ToString())); NgayLap = DateTime.Parse(dt.Rows[0]["NgayLap"].ToString()); ThanhToan = double.Parse(dt.Rows[0]["ThanhToan"].ToString()); TrangThai = Convert.ToInt32(dt.Rows[0]["TrangThai"].ToString()); ChiTiet = new ChiTietHD(mahd); }