public static bool CapNhatKhiThemCT(CTphieuchiNXB ctphieuchi) { DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); var _phieuchi = (from p in model.PhieuchiNXB where p.Maphieuchi.Equals(ctphieuchi.Maphieuchi) select p).FirstOrDefault(); var _TTbansach = from p in model.TTbansachDL where p.Masach.Equals(ctphieuchi.Masach) select p; try { foreach (var row in _TTbansach) { row.TinhTrang = "Đã trả nợ"; } _phieuchi.Tongtien = _phieuchi.Tongtien + ctphieuchi.Tienchi; model.SaveChanges(); return(true); } catch { return(false); } }
public static bool ThemCTphieuchi(CTphieuchiNXB ctphieuchi) { DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); try { model.CTphieuchiNXB.Add(ctphieuchi); model.SaveChanges(); return(true); } catch { return(false); } }
public static bool CapNhatKhiThemCT(CTphieuchiNXB ctphieuchi) { DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); var _phieuchi = (from p in model.PhieuchiNXB where p.Maphieuchi.Equals(ctphieuchi.Maphieuchi) select p).FirstOrDefault(); var _TTbansach = from p in model.TTbansachDL where p.Masach.Equals(ctphieuchi.Masach) select p; try { foreach(var row in _TTbansach) { row.TinhTrang = "Đã trả nợ"; } _phieuchi.Tongtien = _phieuchi.Tongtien + ctphieuchi.Tienchi; model.SaveChanges(); return true; } catch { return false; } }
public static bool ThemCTphieuchi(CTphieuchiNXB ctphieuchi) { DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); try { model.CTphieuchiNXB.Add(ctphieuchi); model.SaveChanges(); return true; } catch { return false; } }