public bool CheckReturned(int MaPM) { using (DHP_07Entities db = new DHP_07Entities()) { return(db.PhieuMuons.Find(MaPM).NgayTra != null); } }
public bool CheckMSSV(string MSSV) { using (DHP_07Entities db = new DHP_07Entities()) { return(db.DocGias.Any(p => p.MSSV == MSSV)); } }
public bool CheckUsername(string Username) { using (DHP_07Entities db = new DHP_07Entities()) { return(db.NguoiDungs.Any(p => p.Username == Username)); } }
public bool CheckEmail(string email) { using (DHP_07Entities db = new DHP_07Entities()) { return(db.NguoiDungs.Any(p => p.Email == email)); } }
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; } }
public bool CheckPhoneNumber(string num) { using (DHP_07Entities db = new DHP_07Entities()) { return(db.NguoiDungs.Any(p => p.DienThoai == num)); } }
public void DeletePM(int MaPM) { using (DHP_07Entities db = new DHP_07Entities()) { db.PhieuMuons.Remove(db.PhieuMuons.Find(MaPM)); db.SaveChanges(); } }
public void AddPM(PhieuMuon s) { using (DHP_07Entities db = new DHP_07Entities()) { db.PhieuMuons.Add(s); db.SaveChanges(); } }
public DocGia GetDGByMSSV(string mssv) { DHP_07Entities db = new DHP_07Entities(); var l1 = db.DocGias .Single(p => p.MSSV == mssv); return(l1); }
public void AddDG(DocGia d) { using (DHP_07Entities db = new DHP_07Entities()) { db.DocGias.Add(d); db.SaveChanges(); } }
public void AddNV(NguoiDung s) { using (DHP_07Entities db = new DHP_07Entities()) { db.NguoiDungs.Add(s); db.SaveChanges(); } }
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); } }
public void DeleteTL(string MaTL) { using (DHP_07Entities db = new DHP_07Entities()) { db.TaiLieux.Remove(db.TaiLieux.Find(MaTL)); db.SaveChanges(); } }
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(); } }
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); } }
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); }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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()); }
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(); } }
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(); } }
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()); }
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 }); } }
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(); } }
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 }); } }
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); }
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(); } }