partial void UpdateTuVung(TuVung instance);
 partial void DeleteTuVung(TuVung instance);
		private void detach_TuVungs(TuVung entity)
		{
			this.SendPropertyChanging();
			entity.TuDien = null;
		}
 partial void InsertTuVung(TuVung instance);
		private void attach_TuVungs(TuVung entity)
		{
			this.SendPropertyChanging();
			entity.TuDien = this;
		}
		private void detach_TuVungs(TuVung entity)
		{
			this.SendPropertyChanging();
			entity.NguoiDung = null;
		}
		private void attach_TuVungs(TuVung entity)
		{
			this.SendPropertyChanging();
			entity.NguoiDung = this;
		}
 public void InsertTuVung(TuVungBO tuvungBO)
 {
     hoctuvungLINQDataContext db = new hoctuvungLINQDataContext();
     TuVung tv = new TuVung();
     tv.TuVungID = Guid.NewGuid();
     tv.TuVung1 = tuvungBO.TuVung;
     tv.Hinhanh = tuvungBO.HinhAnh;
     tv.LoaiTuID = tuvungBO.LoaiTuID;
     tv.NghiaTu = tuvungBO.NghiaTu;
     tv.SoLanSai = tuvungBO.SoLanSai;
     tv.SoLanSuDung = tuvungBO.SoLanSuDung;
     tv.Vidu = tuvungBO.ViDu;
     Guid myguid = new Guid(tuvungBO.TuDienID);
     tv.TuDienID = myguid;
     tv.taikhoan = tuvungBO.TaiKhoan;
     tv.kiemduyet = true;
     db.TuVungs.InsertOnSubmit(tv);
     db.SubmitChanges();
 }
  public void InsertTuVung(TuVungBO tuvungBO, int to)
  {          
      hoctuvungLINQDataContext db= new hoctuvungLINQDataContext();
      TuVung tv = new TuVung();
      tv.TuVungID = Guid.NewGuid();
      tv.TuVung1 = tuvungBO.TuVung;
      tv.Hinhanh = tuvungBO.HinhAnh;
      tv.LoaiTuID = tuvungBO.LoaiTuID;
      tv.NghiaTu = tuvungBO.NghiaTu;
      tv.SoLanSai = tuvungBO.SoLanSai;
      tv.SoLanSuDung = tuvungBO.SoLanSuDung;            
      tv.Vidu = tuvungBO.ViDu;
      Guid myguid = new Guid(tuvungBO.TuDienID);
      tv.TuDienID = myguid;
      tv.taikhoan = tuvungBO.TaiKhoan;
      //Insert vào từ điển cá nhân   //Insert vào từ điển đựơc sử dụng chung
      if (to == 1 || to == 2)
      {
          db.TuVungs.InsertOnSubmit(tv);
      }         
 
      //Insert vào từ điển cộng đồng
      else if (to == 3)
      {
          tv.kiemduyet = false;
      }
      db.TuVungs.InsertOnSubmit(tv);
      db.SubmitChanges(); 
  }