예제 #1
0
        public List <ThanhVien> getTaiKhoan()
        {
            string           truyvan = "SELECT * FROM ACCOUNT";
            List <ThanhVien> l       = new List <ThanhVien>();
            ThanhVien        a       = new ThanhVien();
            DataTable        dt      = GetData(truyvan);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                a.TenDangNhap = dt.Rows[i]["TenDangNhap"].ToString();
                a.MatKhau     = dt.Rows[i]["MatKhau"].ToString();
                a.MaDocGia    = dt.Rows[i]["MaDocGia"].ToString();
                a.Quyen       = Convert.ToInt32(dt.Rows[i]["Quyen"].ToString());
                l.Add(a);
            }
            return(l);
        }
예제 #2
0
        public bool signup(ThanhVien tv)
        {
            if (GetData("select* from ACCOUNT where TenDangNhap = '" + tv.TenDangNhap + "'").Rows.Count > 0)
            {
                return(false);
            }
            Random rdm = new Random();

            tv.MaDocGia = rdm.Next(0, 1000).ToString();
            while (GetData("select* from ACCOUNT where MaDocGia = '" + tv.TenDangNhap + "'").Rows.Count > 0)
            {
                tv.MaDocGia = rdm.Next(0, 1000).ToString();
            }
            string sql = string.Format("Insert Into ACCOUNT values('{0}','{1}','{2}','{3}')",
                                       tv.MaDocGia, tv.TenDangNhap, tv.MatKhau, 1);

            Excute(sql);
            sql = string.Format("Insert Into DOCGIA(MaDocGia, TenDangNhap) values('{0}', '{1}')", tv.MaDocGia, tv.TenDangNhap);
            Excute(sql);
            return(true);
        }
예제 #3
0
        public void ChangePassWord(ThanhVien _tv)
        {
            string sql = string.Format("update ACCOUNT set MatKhau = '{0}' where TenDangNhap = '{1}'", _tv.MatKhau, _tv.TenDangNhap);

            Excute(sql);
        }