public AgentUserInfo[] GetAllAgentUsers()
        {
            MySqlConnection myconn = null;
            MySqlCommand    mycmd  = null;

            try
            {
                myconn = MyDBHelper.Instance.CreateConnection();
                string sqlTextA = "select * from agentuserinfo; ";
                mycmd             = myconn.CreateCommand();
                mycmd.CommandText = sqlTextA;
                myconn.Open();
                MySqlDataAdapter adapter     = new MySqlDataAdapter(mycmd);
                DataTable        tableAgents = new DataTable();
                adapter.Fill(tableAgents);
                if (tableAgents.Rows.Count == 0)
                {
                    return(null);
                }

                DataTable tablePlayers = new DataTable();
                string    sqlTextB     = "select a.*, c.UserName as ReferrerUserName, b.* , g.Gravel, g.FirstGetGravelTime from playersimpleinfo a left join playersimpleinfo c on a.ReferrerUserID = c.id left join playerfortuneinfo b on a.id = b.userId left join playergravelinfo g on a.id = g.UserID  where a.GroupType = @GroupType";
                mycmd = new MySqlCommand(sqlTextB, myconn);
                mycmd.Parameters.AddWithValue("@GroupType", (int)PlayerGroupType.AgentPlayer);
                adapter = new MySqlDataAdapter(mycmd);
                adapter.Fill(tablePlayers);
                var players = MetaDBAdapter <PlayerInfo> .GetPlayerInfoFromDataTable(tablePlayers);

                if (players == null)
                {
                    return(null);
                }

                var lists = MetaDBAdapter <AgentUserInfo> .GetAgentUserInfoFromDataTable(tableAgents, players);

                tablePlayers.Clear();
                tablePlayers.Dispose();
                adapter.Dispose();

                return(lists);
            }
            finally
            {
                if (mycmd != null)
                {
                    mycmd.Dispose();
                }
                if (myconn != null)
                {
                    myconn.Close();
                    myconn.Dispose();
                }
            }
        }
        //public void AddDeletedPlayer(List<PlayerInfo> players)
        //{
        //    MySqlConnection myconn = null;
        //    MySqlCommand mycmd = null;
        //    try
        //    {
        //        myconn = MyDBHelper.Instance.CreateConnection();
        //        myconn.Open();
        //        mycmd = myconn.CreateCommand();

        //        StringBuilder builder = new StringBuilder();
        //        builder.Append("insert into deletedplayerinfo values ");

        //        for (int i = 0; i < players.Count; i++)
        //        {
        //            builder.Append("(");



        //            builder.Append(")");

        //            if (i != players.Count)
        //            {
        //                builder.Append(" , ");
        //            }
        //        }
        //        mycmd.CommandText = builder.ToString();

        //        mycmd.ExecuteNonQuery();

        //    }
        //    finally
        //    {
        //        if (mycmd != null)
        //        {
        //            mycmd.Dispose();
        //        }
        //        if (myconn != null)
        //        {
        //            myconn.Close();
        //            myconn.Dispose();
        //        }
        //    }
        //}

        public PlayerInfo[] GetDeletedPlayers()
        {
            MySqlConnection myconn = null;
            MySqlCommand    mycmd  = null;

            try
            {
                myconn = MyDBHelper.Instance.CreateConnection();
                myconn.Open();
                mycmd = myconn.CreateCommand();

                string sqlText = "select * from deletedplayerinfo ";
                mycmd.CommandText = sqlText;
                DataTable        table   = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd);
                adapter.Fill(table);
                var lists = MetaDBAdapter <PlayerInfo> .GetPlayerInfoFromDataTable(table);

                table.Clear();
                table.Dispose();
                adapter.Dispose();
                return(lists);
            }
            finally
            {
                if (mycmd != null)
                {
                    mycmd.Dispose();
                }
                if (myconn != null)
                {
                    myconn.Close();
                    myconn.Dispose();
                }
            }
        }