public void LoadThongTinNguoiDung()
 {
     NguoiDungBO ndBO = new NguoiDungBO();
     ndBO = nguoidungBUS.TTNguoiDung(Session["taikhoan"].ToString());
     TaiKhoanLabel.Text = ndBO.TaiKhoan;
     EmailLabel.Text = ndBO.Email;
     SoDienThoaiLabel.Text = ndBO.DT;   
 }
Ejemplo n.º 2
0
 public NguoiDungBO SelectNguoiDung(string taikhoan)
 {
     //Lấy thông tin người dùng từ DB
     hoctuvungLINQDataContext db = new hoctuvungLINQDataContext();
     NguoiDungBO nguoidungBO= new NguoiDungBO();
     NguoiDung ndtemp = db.NguoiDungs.Single(p => p.taikhoan == taikhoan);
     //Gán thông tin vào đối tượng ngừơi dùng
     nguoidungBO.TaiKhoan = ndtemp.taikhoan;
     nguoidungBO.MatKhau = ndtemp.matkhau;
     nguoidungBO.Email = ndtemp.email;
     nguoidungBO.DT = ndtemp.dt;
     return nguoidungBO;
 }
Ejemplo n.º 3
0
        public void DangKy(NguoiDungBO nguoidungBO)
        {
            //Tạo mới một NguoiDung

            hoctuvungLINQDataContext db = new hoctuvungLINQDataContext();
            NguoiDung InsNguoiDung = new NguoiDung();
            //Thêm thụôc tính cần Insert
            InsNguoiDung.taikhoan = nguoidungBO.TaiKhoan;
            InsNguoiDung.matkhau = nguoidungBO.MatKhau;
            InsNguoiDung.email = nguoidungBO.Email;
            InsNguoiDung.dt = nguoidungBO.DT;
            InsNguoiDung.banned = false;
            InsNguoiDung.quyen = "User";   
            //thực hiện Insert
            db.NguoiDungs.InsertOnSubmit(InsNguoiDung);
            db.SubmitChanges();           
        }
Ejemplo n.º 4
0
 public bool DangKy(string taikhoan,string matkhau,string email,string dt)
 {
     try
     {
         NguoiDungBO ndBO= new NguoiDungBO();
         ndBO.TaiKhoan=taikhoan;
         ndBO.MatKhau=matkhau;
         ndBO.Email=email;
         ndBO.DT=dt;
         if (KTTrung(taikhoan) == true)
             nguoidungDAO.DangKy(ndBO);
         return true;
     }
     catch
     {
         return false;
     }
 }
Ejemplo n.º 5
0
 public void Change_NguoiDung_Info(NguoiDungBO nguoidungBO)
 {
     string taikhoan = nguoidungBO.TaiKhoan;
     string matkhau = nguoidungBO.MatKhau;
     string email = nguoidungBO.Email;
     string dt = nguoidungBO.DT;
     string quyen = nguoidungBO.Quyen;
     //Lấy thông tin ngừoi dùng
     hoctuvungLINQDataContext db = new hoctuvungLINQDataContext();
     NguoiDung ndtemp = db.NguoiDungs.Single(p => p.taikhoan == taikhoan);
     //Cập nhật lại thông tin ngừơi dùng
     if (matkhau != "") ndtemp.matkhau = matkhau;
     if (email != "") ndtemp.email = email;
     if (dt != "") ndtemp.dt = dt;
     if (quyen != "") ndtemp.quyen = quyen;
     db.SubmitChanges();
 }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
        public bool Doi_TT_NguoiDung(string taikhoan,string matkhau,string email,string dt,string quyen)
        {
            try {
                NguoiDungBO nguoidungBO= new NguoiDungBO();
                nguoidungBO.TaiKhoan=taikhoan;
                nguoidungBO.MatKhau=matkhau;
                nguoidungBO.Email=email;
                nguoidungBO.DT=dt;
                nguoidungBO.Quyen=quyen;
                //thực hiện cập nhật
                nguoidungDAO.Change_NguoiDung_Info(nguoidungBO);
                return true;
            }
            catch {
                return false;
            }

        }
Ejemplo n.º 9
0
 public void Add(NguoiDungBO nguoidungBO)
 {
     List.Add(nguoidungBO);
 }