public List <NguoiDung1> AllNguoiDung()
        {
            string sql = "select * from NguoiDung";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <NguoiDung1> ds = new List <NguoiDung1>();

            foreach (DataRow dr in dt.Rows)
            {
                NguoiDung1 nd = new NguoiDung1();
                nd.MaNguoiDung = dr[0].ToString();
                nd.HoTen       = dr[1].ToString();
                nd.TaiKhoan    = dr[2].ToString();
                nd.MatKhau     = dr[3].ToString();
                nd.DiaChi      = dr[4].ToString();
                nd.Email       = dr[5].ToString();
                nd.GioiTinh    = dr[6].ToString();
                nd.NgaySinh    = dr[7].ToString();
                nd.NgayDangKy  = dr[8].ToString();
                nd.VaiTro      = int.Parse(dr[9].ToString());
                ds.Add(nd);
            }
            this.DanhSachNguoiDung = ds;
            return(ds);
        }
Exemplo n.º 2
0
        public List <Tin> LayMaTin(string MaTin)
        {
            string sql = "select * from Tin where MaTin='" + MaTin + "'";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <Tin> ds = new List <Tin>();

            foreach (DataRow dr in dt.Rows)
            {
                Tin t = new Tin();
                t.MaTin     = dr[0].ToString();
                t.TieuDe    = dr[1].ToString();
                t.TomTat    = dr[2].ToString();
                t.NgayDang  = dr[3].ToString();
                t.NoiDung   = dr[4].ToString();
                t.HinhAnh   = dr[5].ToString();
                t.SoLanXem  = dr[6].ToString();
                t.TrangThai = dr[7].ToString();
                t.MaLoaiTin = dr[8].ToString();
                ds.Add(t);
            }
            this.DanhSachTin = ds;
            return(ds);
        }
        public int DangNhap(string taiKhoan, string matKhau)
        {
            string sql = "select * from NguoiDung Where TaiKhoan='" + taiKhoan + "' And MatKhau='" + matKhau + "'";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();

            if (dt.Rows.Count > 0)
            {
                return(int.Parse(dt.Rows[0][9].ToString()));
            }
            return(-1);
        }
        public List <TheLoai> AllTheLoai()
        {
            string sql = "select * from TheLoai";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <TheLoai> ds = new List <TheLoai>();

            foreach (DataRow dr in dt.Rows)
            {
                TheLoai tl = new TheLoai();
                tl.MaTheLoai  = dr[0].ToString();
                tl.TenTheLoai = dr[1].ToString();
                ds.Add(tl);
            }
            this.DanhSachTheLoai = ds;
            return(ds);
        }
        public List <LoaiTin> AllLoaiTin()
        {
            string sql = "select * from LoaiTin";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <LoaiTin> ds = new List <LoaiTin>();

            foreach (DataRow dr in dt.Rows)
            {
                LoaiTin lt = new LoaiTin();
                lt.MaLoaiTin  = dr[0].ToString();
                lt.MaTheLoai  = dr[1].ToString();
                lt.TenLoaiTin = dr[2].ToString();
                ds.Add(lt);
            }
            this.DanhSachLoaiTin = ds;
            return(ds);
        }
Exemplo n.º 6
0
        public List <QuangCao> AllQuangCao()
        {
            string sql = "select * from QuangCao";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <QuangCao> ds = new List <QuangCao>();

            foreach (DataRow dr in dt.Rows)
            {
                QuangCao qc = new QuangCao();
                qc.MaQC    = dr[0].ToString();
                qc.MaQC    = dr[1].ToString();
                qc.HinhAnh = dr[2].ToString();
                ds.Add(qc);
            }
            this.DanhSachLoaiTin = ds;
            return(ds);
        }
Exemplo n.º 7
0
        public List <BinhLuan> LaySoBinhLuanTheoTin(string MaTin)
        {
            string sql = "select * from BinhLuan where MaTin=" + MaTin + "";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <BinhLuan> ds = new List <BinhLuan>();

            foreach (DataRow dr in dt.Rows)
            {
                BinhLuan bl = new BinhLuan();
                bl.MaBinhLuan  = dr[0].ToString();
                bl.NoiDung     = dr[1].ToString();
                bl.Ngay        = dr[2].ToString();
                bl.MaTin       = dr[3].ToString();
                bl.MaNguoiDung = dr[4].ToString();
                ds.Add(bl);
            }
            this.DanhSachBinhLuan = ds;
            return(ds);
        }