示例#1
0
        public async Task <bool> ValidateOldPwd(long userid, string pwd)
        {
            try
            {
                string           strSql = "select count(0) from users where usersid=@u and password=@p";
                MySqlParameter[] para   =
                {
                    new MySqlParameter("@u", MySqlDbType.Int64),
                    new MySqlParameter("@p", MySqlDbType.VarChar, 45)
                };
                para[0].Value = userid;
                para[1].Value = pwd;
                object obj = await DbHelperMySQL.GetSingleAsync(DBConnection.UsersSystem, strSql, para);

                if (obj == null)
                {
                    return(false);
                }
                if (Convert.ToInt32(obj) > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
示例#2
0
        public async Task <bool> CheckMobileIsExist(string mobile)
        {
            try
            {
                string           strSql = "select count(0) from users where LoginName_Mobile=@u";
                MySqlParameter[] para   =
                {
                    new MySqlParameter("@u", MySqlDbType.VarChar, 15)
                };
                para[0].Value = mobile;
                object obj = await DbHelperMySQL.GetSingleAsync(DBConnection.UsersSystem, strSql, para);

                if (obj == null)
                {
                    return(false);
                }
                if (Convert.ToInt32(obj) > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
示例#3
0
        public async Task <long> Login(string user, string pwd)
        {
            try
            {
                string           strSql = "SELECT usersid FROM users where loginname_mobile=@u and password=@p";
                MySqlParameter[] para   =
                {
                    new MySqlParameter("@u", MySqlDbType.VarChar, 30),
                    new MySqlParameter("@p", MySqlDbType.VarChar, 50)
                };
                para[0].Value = user;
                para[1].Value = pwd;
                object obj = await DbHelperMySQL.GetSingleAsync(DBConnection.UsersSystem, strSql, para);

                if (obj == null)
                {
                    return(0);
                }
                return(Convert.ToInt64(obj));
            }
            catch (Exception err)
            {
                throw err;
            }
        }