Exemplo n.º 1
0
 public static int add(HoaDonDaiLy hoadon)
 {
     try
     {
         using (EntitiesDataContext db = new EntitiesDataContext())
         {
             var hd = new HOADONDAILY
             {
                 masodaily = hoadon.MaSoDaiLy,
                 ngaylap   = hoadon.NgayLap,
                 tongtien  = hoadon.ChiTiet.Sum(ct => ct.SoLuong * ct.DonGia),
                 trangthai = 0
             };
             db.HOADONDAILies.InsertOnSubmit(hd);
             db.SubmitChanges();
             foreach (ChiTietHoaDonDaiLy ct in hoadon.ChiTiet)
             {
                 ChiTiet.add(ct, hd.masohoadon);
             }
             return(hd.masohoadon);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(0);
     }
 }
Exemplo n.º 2
0
 public HoaDonDaiLy(HOADONDAILY hoadon)
 {
     MaSoHoaDon = hoadon.masohoadon;
     MaSoDaiLy  = hoadon.masodaily;
     NgayLap    = hoadon.ngaylap;
     TongTien   = hoadon.tongtien;
     TrangThai  = hoadon.trangthai;
 }
Exemplo n.º 3
0
 public HoaDonDaiLy(HOADONDAILY hoadon, DAILY daily)
     : this(hoadon)
 {
     DaiLy = new DaiLy(daily);
 }