コード例 #1
0
        public NguoiDungCollection SelectAllNguoiDung(string tennguoiudung)
        {
            NguoiDungCollection nguoidungcoll = new NguoiDungCollection();
            hoctuvungLINQDataContext db= new hoctuvungLINQDataContext();
             IEnumerable<NguoiDung> nguoidungList;
            if (tennguoiudung != "")
            {
                nguoidungList = from p in db.NguoiDungs
                                where p.quyen.Trim() != "Admin"
                                && p.taikhoan.Contains(tennguoiudung)
                                select p;
            }
            else
            {
                nguoidungList = from p in db.NguoiDungs
                                where p.quyen.Trim() != "Admin"

                                select p;
            }
            foreach(NguoiDung nd in nguoidungList)
            {
                NguoiDungBO ndBO = new NguoiDungBO();
                ndBO.TaiKhoan = nd.taikhoan;
                ndBO.Banned = (bool)nd.banned;
                nguoidungcoll.Add(ndBO);
            }
            return nguoidungcoll;
        }
コード例 #2
0
 public NguoiDungCollection SelectNguoiDung_TuDien(string tudienID)
 {
     NguoiDungCollection ndColl = new NguoiDungCollection();
     hoctuvungLINQDataContext db = new hoctuvungLINQDataContext();
     IEnumerable<Nhom_TuDien> nguoidunglist = from p in db.Nhom_TuDiens
                                            where p.TuDienID.ToString() == tudienID
                                            select p;
     //Addrange
     foreach (Nhom_TuDien nd in nguoidunglist)
     {
         NguoiDungBO ndBO= new NguoiDungBO();
         ndBO.TaiKhoan=nd.taikhoan;
         ndColl.Add(ndBO);
     }
     return ndColl;
 }