Esempio n. 1
0
 public bool CheckReturned(int MaPM)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         return(db.PhieuMuons.Find(MaPM).NgayTra != null);
     }
 }
Esempio n. 2
0
 public bool CheckMSSV(string MSSV)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         return(db.DocGias.Any(p => p.MSSV == MSSV));
     }
 }
Esempio n. 3
0
 public bool CheckUsername(string Username)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         return(db.NguoiDungs.Any(p => p.Username == Username));
     }
 }
Esempio n. 4
0
 public bool CheckEmail(string email)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         return(db.NguoiDungs.Any(p => p.Email == email));
     }
 }
Esempio n. 5
0
        public void SetGUI()
        {
            DHP_07Entities db = new DHP_07Entities();

            if (ID_NguoiDung != 0)
            {
                NguoiDung s = db.NguoiDungs.Find(ID_NguoiDung);
                txtUser.Text          = s.Username;
                txtPassword.Text      = s.Password;
                txtHoTen.Text         = s.HoTen;
                txtDienThoai.Text     = s.DienThoai;
                txtEmail.Text         = s.Email;
                dateTimePicker1.Value = s.NgaySinh.Value;
                if (s.GioiTinh == true)
                {
                    rbtnNam.Checked = true;
                }
                else
                {
                    rbtnNu.Checked = true;
                }
                cbbQuyenHan.SelectedIndex = s.ID_QuyenHan - 1;
                txtUser.Enabled           = false;
            }
        }
Esempio n. 6
0
 public bool CheckPhoneNumber(string num)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         return(db.NguoiDungs.Any(p => p.DienThoai == num));
     }
 }
Esempio n. 7
0
 public void DeletePM(int MaPM)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         db.PhieuMuons.Remove(db.PhieuMuons.Find(MaPM));
         db.SaveChanges();
     }
 }
Esempio n. 8
0
 public void AddPM(PhieuMuon s)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         db.PhieuMuons.Add(s);
         db.SaveChanges();
     }
 }
Esempio n. 9
0
        public DocGia GetDGByMSSV(string mssv)
        {
            DHP_07Entities db = new DHP_07Entities();
            var            l1 = db.DocGias
                                .Single(p => p.MSSV == mssv);

            return(l1);
        }
Esempio n. 10
0
 public void AddDG(DocGia d)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         db.DocGias.Add(d);
         db.SaveChanges();
     }
 }
Esempio n. 11
0
 public void AddNV(NguoiDung s)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         db.NguoiDungs.Add(s);
         db.SaveChanges();
     }
 }
Esempio n. 12
0
 public NguoiDung GetUserByUsername(string Username)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         NguoiDung data = db.NguoiDungs.Where(p => p.Username.Equals(Username)).FirstOrDefault();
         return(data);
     }
 }
Esempio n. 13
0
 public void DeleteTL(string MaTL)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         db.TaiLieux.Remove(db.TaiLieux.Find(MaTL));
         db.SaveChanges();
     }
 }
Esempio n. 14
0
 public void GiamSL(string MaTL, int Num)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         TaiLieu s = db.TaiLieux.Find(MaTL);
         s.SoLuong -= Num;
         db.SaveChanges();
     }
 }
Esempio n. 15
0
 public void AddTL(TaiLieu s)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         db.TaiLieux.Add(s);
         db.SaveChanges();
         Instance.AddCTL(s.MaTL, (int)s.SoLuong);
     }
 }
Esempio n. 16
0
        public List <DocGia> GetListDG(string MaSo, string Name)
        {
            DHP_07Entities db = new DHP_07Entities();
            var            l1 = db.DocGias
                                .Where(p => p.MSSV.Contains(MaSo) && p.HoTen.Contains(Name))
                                .Select(p => p).ToList();

            return(l1);
        }
Esempio n. 17
0
 public void DeleteNV(int ID_NguoiDung)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         NguoiDung s = db.NguoiDungs.Find(ID_NguoiDung);
         db.NguoiDungs.Remove(s);
         db.SaveChanges();
     }
 }
Esempio n. 18
0
 public void EditEmailNV(NguoiDung s, int ID_NguoiDung, string email)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         NguoiDung s1 = db.NguoiDungs.Find(ID_NguoiDung);
         s1.Email = email;
         db.SaveChanges();
     }
 }
Esempio n. 19
0
 public void EditSDTNV(NguoiDung s, int ID_NguoiDung, string sdt)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         NguoiDung s1 = db.NguoiDungs.Find(ID_NguoiDung);
         s1.DienThoai = sdt;
         db.SaveChanges();
     }
 }
Esempio n. 20
0
 public void EditHoTenNV(NguoiDung s, int ID_NguoiDung, string ten)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         NguoiDung s1 = db.NguoiDungs.Find(ID_NguoiDung);
         s1.HoTen = ten;
         db.SaveChanges();
     }
 }
Esempio n. 21
0
 public void EditNgaySinhNV(NguoiDung s, int ID_NguoiDung, DateTime ngay)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         NguoiDung s1 = db.NguoiDungs.Find(ID_NguoiDung);
         s1.NgaySinh = ngay;
         db.SaveChanges();
     }
 }
Esempio n. 22
0
        public TaiLieu GetTLByMaTL(string MaTL)
        {
            DHP_07Entities db = new DHP_07Entities();

            if (MaTL == null)
            {
                return(null);
            }
            return(db.TaiLieux.Where(p => p.MaTL.Equals(MaTL)).FirstOrDefault());
        }
Esempio n. 23
0
 public void ChangePass(NguoiDung nd, string Pass)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         var l1 = db.NguoiDungs
                  .Single(p => p.ID == nd.ID);
         l1.Password = Pass;
         db.SaveChanges();
     }
 }
Esempio n. 24
0
 public void DelDG(DocGia d)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         var l1 = db.DocGias
                  .Single(p => p.MSSV == d.MSSV);
         db.DocGias.Remove(l1);
         db.SaveChanges();
     }
 }
Esempio n. 25
0
        public PhieuMuon GetPMByMaPM(int MaPM)
        {
            DHP_07Entities db = new DHP_07Entities();

            if (MaPM == 0)
            {
                return(null);
            }
            return(db.PhieuMuons.Where(p => p.MaPhieuMuon.Equals(MaPM)).FirstOrDefault());
        }
Esempio n. 26
0
        private void SetCBB()
        {
            DHP_07Entities db = new DHP_07Entities();

            foreach (Lop i in db.Lops)
            {
                cbbMaLop.Items.Add(new CBBItem {
                    Value = i.MaLop, Text = i.TenLop
                });
            }
        }
Esempio n. 27
0
 public void DeleteCTL(string MaTL, int Num)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         for (int i = 0; i < Num; ++i)
         {
             db.CuonTaiLieux.Remove(db.CuonTaiLieux.Where(p => p.MaTL == MaTL).FirstOrDefault());
         }
         db.SaveChanges();
     }
 }
Esempio n. 28
0
        public void SetCBB()
        {
            DHP_07Entities db = new DHP_07Entities();

            foreach (QuyenHan i in db.QuyenHans)
            {
                cbbQuyenHan.Items.Add(new CBBItem {
                    Value = i.ID_QuyenHan, Text = i.TenQuyenHan
                });
            }
        }
Esempio n. 29
0
        public List <DocGia_DTO> GetListDGSelect(string MaSo, string Name)
        {
            DHP_07Entities db = new DHP_07Entities();
            var            l1 = db.DocGias
                                .Where(p => p.MSSV.Contains(MaSo) && p.HoTen.Contains(Name))
                                .Select(p => new DocGia_DTO {
                MSSV = p.MSSV, HoTen = p.HoTen, NgaySinh = p.NgaySinh, GioiTinh = p.GioiTinh, TenLop = p.Lop.TenLop, NgayDK = p.NgayDK
            }).ToList();

            return(l1);
        }
Esempio n. 30
0
 public void TraSLTL(List <TaiLieu_DTO> data)
 {
     using (DHP_07Entities db = new DHP_07Entities())
     {
         foreach (TaiLieu_DTO i in data)
         {
             TaiLieu s = db.TaiLieux.Find(i.MaTL);
             s.SoLuong++;
         }
         db.SaveChanges();
     }
 }