Esempio n. 1
0
 public bool DeleteCTHopDong(string soHopDong, string maSP)
 {
     try
     {
         ChiTietHopDong cthd = context.ChiTietHopDong.Single(s => s.SoHopDong.Equals(soHopDong) && s.MaSP.Equals(maSP));
         context.ChiTietHopDong.Remove(cthd);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 2
0
 public bool UpdateCTHopDong(string soHopDong, string maSP, int soLuong, decimal?donGia)
 {
     try
     {
         ChiTietHopDong cthd = context.ChiTietHopDong.Single(s => s.SoHopDong.Equals(soHopDong) && s.MaSP.Equals(maSP));
         cthd.SoLuong = soLuong;
         cthd.DonGia  = donGia;
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 3
0
 public bool InsertCTHopDong(ref string err, string soHopDong, string maSP, int soLuong, decimal?donGia)
 {
     try
     {
         ChiTietHopDong cthd = new ChiTietHopDong
         {
             SoHopDong = soHopDong,
             MaSP      = maSP,
             SoLuong   = soLuong,
             DonGia    = donGia,
         };
         context.ChiTietHopDong.Add(cthd);
         context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         err = e.Message;
         return(false);
     }
 }