public static int add(Sach sach)
 {
     try
     {
         using (EntitiesDataContext db = new EntitiesDataContext())
         {
             var s = new SACH();
             s.tensach = sach.TenSach;
             s.masolinhvuc = sach.LinhVucSach.MaSoLinhVuc;
             s.masonxb = sach.NXB.MaSoNXB;
             s.tacgia = sach.TenTacGia;
             s.soluong = sach.Soluong;
             s.giaban = sach.GiaBan;
             s.gianhap = sach.GiaNhap;
             s.hinhanh = sach.HinhAnh;
             s.mota = sach.MoTa;
             db.SACHes.InsertOnSubmit(s);
             db.SubmitChanges();
             return s.masosach;
         }
     }
     catch(Exception ex)
     {
         Console.WriteLine(ex.Message);
         return 0;
     }
 }
Beispiel #2
0
 public Sach(SACH sach)
 {
     MaSoSach = sach.masosach;
     MaSoNXB = sach.masonxb;
     MaSoLinhVuc = sach.masolinhvuc;
     TenSach = sach.tensach;
     TenTacGia = sach.tacgia;
     Soluong = sach.soluong;
     GiaNhap = sach.gianhap;
     GiaBan = sach.giaban;
     HinhAnh = sach.hinhanh;
     TrangThai = sach.trangthai;
     MoTa = sach.mota;
 }
 partial void InsertSACH(SACH instance);
		private void detach_SACHes(SACH entity)
		{
			this.SendPropertyChanging();
			entity.NXB = null;
		}
		private void attach_SACHes(SACH entity)
		{
			this.SendPropertyChanging();
			entity.NXB = this;
		}
 public CongNoDaiLy(CONGNODAILY congno, DAILY daily, SACH sach)
     : this(congno,daily)
 {
     Sach = new Sach(sach);
 }
 public CongNoDaiLy(CONGNODAILY congno, SACH sach)
     : this(congno)
 {
     Sach = new Sach(sach);
 }
 public CongNoNXB(CONGNONXB congno, NXB nxb, SACH sach)
     : this(congno,nxb)
 {
     Sach = new Sach(sach);
 }
 public ChiTietPhieuXuat(CHITIETPHIEUXUAT chitiet, SACH sach)
     : this(chitiet)
 {
     Sach = new Sach(sach);
 }
 public ChiTietHoaDonDaiLy(CHITIETHOADONDAILY chitiet, SACH sach)
     : this(chitiet)
 {
     Sach = new Sach(sach);
 }
 public ChiTietHoaDonNXB(CHITIETHOADONNXB chitiet, SACH sach)
     : this(chitiet)
 {
     Sach = new Sach(sach);
 }
Beispiel #12
0
 public Sach(SACH sach, NXB nxb, LINHVUC linhvuc)
     : this(sach, nxb)
 {
     LinhVucSach = new LinhVuc(linhvuc);
 }
Beispiel #13
0
 public Sach(SACH sach, LINHVUC linhvuc)
     : this(sach)
 {
     LinhVucSach = new LinhVuc(linhvuc);
 }
Beispiel #14
0
 public Sach(SACH sach,NXB nxb)
     : this(sach)
 {
     NXB = new NhaXuatBan(nxb);
 }
 partial void UpdateSACH(SACH instance);
 public ChiTietPhieuNhap(CHITIETPHIEUNHAP chitiet, SACH sach)
     : this(chitiet)
 {
     Sach = new Sach(sach);
 }
 partial void DeleteSACH(SACH instance);
 public TheKho(THEKHO thekho,SACH sach)
     : this(thekho)
 {
     Sach = new Sach(sach);
 }