public ChiTietPhieuXuat(CHITIETPHIEUXUAT chitiet)
 {
     MaSoPhieuXuat = chitiet.masophieuxuat;
     MaSoSach = chitiet.masosach;
     SoLuong = chitiet.soluong;
     DonGia = chitiet.dongia;
     TrangThai = chitiet.trangthai;
 }
 partial void DeleteCHITIETPHIEUXUAT(CHITIETPHIEUXUAT instance);
 partial void UpdateCHITIETPHIEUXUAT(CHITIETPHIEUXUAT instance);
 partial void InsertCHITIETPHIEUXUAT(CHITIETPHIEUXUAT instance);
		private void detach_CHITIETPHIEUXUATs(CHITIETPHIEUXUAT entity)
		{
			this.SendPropertyChanging();
			entity.SACH = null;
		}
		private void attach_CHITIETPHIEUXUATs(CHITIETPHIEUXUAT entity)
		{
			this.SendPropertyChanging();
			entity.PHIEUXUAT = this;
		}
 public ChiTietPhieuXuat(CHITIETPHIEUXUAT chitiet, SACH sach)
     : this(chitiet)
 {
     Sach = new Sach(sach);
 }
 public static bool add(ChiTietPhieuXuat chitiet, int masophieuxuat)
 {
     try
     {
         using (EntitiesDataContext db = new EntitiesDataContext())
         {
             CHITIETPHIEUXUAT ct;
             ct = (from c in db.CHITIETPHIEUXUATs
                   where c.masophieuxuat.Equals(masophieuxuat)
                   && c.masosach.Equals(chitiet.MaSoSach)
                   select c).SingleOrDefault();
             if (ct != null) return false;
             ct = new CHITIETPHIEUXUAT
             {
                 masophieuxuat = masophieuxuat,
                 masosach = chitiet.MaSoSach,
                 soluong = chitiet.SoLuong,
                 dongia = chitiet.DonGia,
                 trangthai = chitiet.TrangThai == null ? 0 : 1
             };
             db.CHITIETPHIEUXUATs.InsertOnSubmit(ct);
             db.SubmitChanges();
             return true;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return false;
     }
 }