コード例 #1
0
 public void Delete(PhieuHdChiTiet obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.PhieuHdChiTiets.Attach(obj);
         db.PhieuHdChiTiets.Remove(obj);
         db.SaveChanges();
     }
 }
コード例 #2
0
 public PhieuHdChiTiet Insert(PhieuHdChiTiet obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.PhieuHdChiTiets.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
コード例 #3
0
 public void Update(PhieuHdChiTiet obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.PhieuHdChiTiets.Attach(obj);
         db.Entry(obj).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
コード例 #4
0
 public SpLoai Insert(SpLoai obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.SpLoais.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
コード例 #5
0
 public void Update(SpLoai obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.SpLoais.Attach(obj);
         db.Entry(obj).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
コード例 #6
0
 public Ncc Insert(Ncc obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.Nccs.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
コード例 #7
0
 public void Delete(SpLoai obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.SpLoais.Attach(obj);
         db.SpLoais.Remove(obj);
         db.SaveChanges();
     }
 }
コード例 #8
0
 public GioHang Insert(GioHang obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.GioHangs.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
コード例 #9
0
 public Kh Insert(Kh obj)
 {
     using (var db = new QLBH_WinDBContext())
     {
         db.Khs.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
コード例 #10
0
        public bool Edit(int mancc, string tenncc)
        {
            var edit = new Ncc();

            using (var db = new QLBH_WinDBContext())
            {
                edit        = db.Nccs.Where(p => p.MaNcc.Equals(mancc)).SingleOrDefault();
                edit.TenNcc = tenncc;

                db.Nccs.Attach(edit);
                db.Entry(edit).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(false);
        }
コード例 #11
0
        public bool Them(string tenncc)
        {
            var them = new Ncc();

            using (var db = new QLBH_WinDBContext())
            {
                try
                {
                    them.TenNcc = tenncc;
                    db.Nccs.Add(them);
                    db.SaveChanges();
                }
                catch
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #12
0
        public bool Delete(int mancc)
        {
            var del  = new Ncc();
            var data = new DataGridView();

            using (var db = new QLBH_WinDBContext())
            {
                try
                {
                    del = db.Nccs.Where(p => p.MaNcc.Equals(mancc)).SingleOrDefault();
                    db.Nccs.Attach(del);
                    db.Nccs.Remove(del);
                    db.SaveChanges();
                }
                catch
                {
                    return(true);
                }
            }

            return(false);
        }