Ejemplo n.º 1
0
        public static bool ThemPhieuNhap(PNsach pnsach)
        {
            DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities();

            try
            {
                model.PNsach.Add(pnsach);
                model.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 public static bool SuaPhieuNhap(PNsach pnsach)
 {
     DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities();
     var _pnsach = (from p in model.PNsach
                    where p.MaPN.Trim().Equals(pnsach.MaPN.Trim())
                    select p).FirstOrDefault();
     if (_pnsach == null)
         return false;
     else
     {
         _pnsach.MaNXB = pnsach.MaNXB;
         _pnsach.Ngaynhap = pnsach.Ngaynhap;
         _pnsach.Nguoigiao = pnsach.Nguoigiao;
         _pnsach.TinhTrang = pnsach.TinhTrang;
         model.SaveChanges();
         return true;
     }
 }
Ejemplo n.º 3
0
        public static bool SuaPhieuNhap(PNsach pnsach)
        {
            DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities();
            var _pnsach = (from p in model.PNsach
                           where p.MaPN.Trim().Equals(pnsach.MaPN.Trim())
                           select p).FirstOrDefault();

            if (_pnsach == null)
            {
                return(false);
            }
            else
            {
                _pnsach.MaNXB     = pnsach.MaNXB;
                _pnsach.Ngaynhap  = pnsach.Ngaynhap;
                _pnsach.Nguoigiao = pnsach.Nguoigiao;
                _pnsach.TinhTrang = pnsach.TinhTrang;
                model.SaveChanges();
                return(true);
            }
        }
Ejemplo n.º 4
0
        public static bool XoaPhieuNhap(PNsach pnsach)
        {
            DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities();
            var _pnsach = (from p in model.PNsach
                           where p.MaPN.Trim().Equals(pnsach.MaPN)
                           select p).FirstOrDefault();
            var _ctpn = from p in model.CTPNsach
                        where p.MaPN.Trim().Equals(pnsach.MaPN)
                        select p;

            try
            {
                foreach (var row in _ctpn)
                {
                    model.CTPNsach.Remove(row);
                }
                model.PNsach.Remove(_pnsach);
                model.SaveChanges();
                return(true);
            }
            catch { return(false); }
        }
Ejemplo n.º 5
0
 public BUSNhapsach(PNsach phieunhap)
 {
     this.phieunhap = phieunhap;
 }
Ejemplo n.º 6
0
 public static bool XoaPhieuNhap(PNsach pnsach)
 {
     DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities();
     var _pnsach = (from p in model.PNsach
                    where p.MaPN.Trim().Equals(pnsach.MaPN)
                    select p).FirstOrDefault();
     var _ctpn = from p in model.CTPNsach
                  where p.MaPN.Trim().Equals(pnsach.MaPN)
                  select p;
     try
     {
         foreach(var row in _ctpn)
         {
             model.CTPNsach.Remove(row);
         }
         model.PNsach.Remove(_pnsach);
         model.SaveChanges();
         return true;
     }
     catch { return false; }
 }
Ejemplo n.º 7
0
 public static bool ThemPhieuNhap(PNsach pnsach)
 {
     DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities();
     try
     {
         model.PNsach.Add(pnsach);
         model.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }