예제 #1
0
        public void themNguoiDung(NguoiDungDTO nd)
        {
            String strCommand = "Insert Into NguoiDung(TenDangNhap, MatKhau, HoTen, NgaySinh, Email, DienThoai, SoHinhVe)"
                                + " Values (?, ?, ?, ?, ?, ?, ?)";

            KetNoi.moKetNoi();
            OleDbConnection conn = KetNoi.connKetNoi;
            OleDbCommand    comm = new OleDbCommand(strCommand, conn);

            comm.Parameters.Add("@TDN", OleDbType.VarChar);
            comm.Parameters.Add("@MK", OleDbType.VarChar);
            comm.Parameters.Add("@HT", OleDbType.VarChar);
            comm.Parameters.Add("@NS", OleDbType.Date);
            comm.Parameters.Add("@Email", OleDbType.VarChar);
            comm.Parameters.Add("@DT", OleDbType.VarChar);
            comm.Parameters.Add("@SHV", OleDbType.Integer);
            comm.Parameters["@TDN"].Value   = nd.TenDangNhap;
            comm.Parameters["@MK"].Value    = nd.MatKhau;
            comm.Parameters["@HT"].Value    = nd.HoTen;
            comm.Parameters["@NS"].Value    = nd.NgaySinh;
            comm.Parameters["@Email"].Value = nd.Email;
            comm.Parameters["@DT"].Value    = nd.DienThoai;
            comm.Parameters["@SHV"].Value   = nd.SoHinhVe;
            comm.ExecuteNonQuery();
            KetNoi.dongKetNoi();
        }
예제 #2
0
        public bool kiemTraMatKhau(String strTDN, String strMK)
        {
            KetNoi.moKetNoi();
            String       strCommand = "Select MatKhau From NguoiDung Where TenDangNhap ='" + strTDN + "'";
            OleDbCommand comm       = new OleDbCommand(strCommand, KetNoi.connKetNoi);
            String       MK         = (String)comm.ExecuteScalar();

            KetNoi.dongKetNoi();
            return(MK.Equals(strMK));
        }
예제 #3
0
        public NguoiDungDTO layThongTinNguoiDung(String strTDN, String strMK)
        {
            NguoiDungDTO dto = new NguoiDungDTO();

            KetNoi.moKetNoi();
            String strCommand = "Select TenDangNhap, MatKhau, HoTen, NgaySinh, Email, DienThoai, SoHinhVe" +
                                " From NguoiDung Where TenDangNhap = '" + strTDN + "' And MatKhau = '" + strMK + "'";
            OleDbCommand    comm = new OleDbCommand(strCommand, KetNoi.connKetNoi);
            OleDbDataReader odr  = comm.ExecuteReader();

            while (odr.Read())
            {
                dto.TenDangNhap = odr.GetString(0);
                dto.MatKhau     = odr.GetString(1);
                dto.HoTen       = odr.GetString(2);
                dto.NgaySinh    = odr.GetDateTime(3);
                dto.Email       = odr.GetString(4);
                dto.DienThoai   = odr.GetString(5);
                dto.SoHinhVe    = odr.GetInt32(6);
            }
            KetNoi.dongKetNoi();
            return(dto);
        }