Esempio n. 1
0
        public Boolean repair(UserDangKi user, string sql)
        {
            SqlConnection conn = getConnection();

            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("User", user.Username);
                cmd.Parameters.AddWithValue("Pass", user.Password);
                cmd.Parameters.AddWithValue("Quyen", user.Quyen);
                cmd.Parameters.AddWithValue("Ten", user.HoVaTen);
                cmd.Parameters.AddWithValue("Ns", user.NgaySinh.ToString());
                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                conn.Close();
            }
            return(true);
        }
Esempio n. 2
0
        public Boolean Sua(string UserName, string Password, string HoVaTen, string NgaySinh, string Quyen)
        {
            DataProvider dp  = new DataProvider();
            UserDangKi   udk = new UserDangKi(UserName, Password, HoVaTen, DateTime.Parse(NgaySinh), Quyen);
            string       sql = "UPDATE tbuser SET Pass = @pass, Quyen = @Quyen,Ten = @ten,Ngaysinh = @ns WHERE Username = @user";

            return(dp.repair(udk, sql));
        }
Esempio n. 3
0
        public Boolean dangKi(string UserName, string Password, string HoVaTen, string NgaySinh, string Quyen)
        {
            DataProvider dp  = new DataProvider();
            UserDangKi   udk = new UserDangKi(UserName, Password, HoVaTen, DateTime.Parse(NgaySinh), Quyen);
            string       sql = "INSERT INTO tbuser VALUES(@User,@Pass,@Quyen,@Ten,@Ns)";

            return(dp.insertUser(udk, sql));
        }