Ejemplo n.º 1
0
        public bool AddAgentUser(AgentUserInfo info, CustomerMySqlTransaction trans)
        {
            MySqlCommand mycmd = null;

            try
            {
                mycmd = trans.CreateCommand();

                string sqlText = "insert into agentuserinfo " +
                                 " (`UserID`,`TotalAwardRMB`,`InvitationURL`) " +
                                 " values (@UserID,@TotalAwardRMB,@InvitationURL)";
                mycmd.CommandText = sqlText;
                mycmd.Parameters.AddWithValue("@UserID", info.Player.SimpleInfo.UserID);
                mycmd.Parameters.AddWithValue("@TotalAwardRMB", info.TotalAwardRMB);
                mycmd.Parameters.AddWithValue("@InvitationURL", info.InvitationURL);
                mycmd.ExecuteNonQuery();
                return(true);
            }
            finally
            {
                if (mycmd != null)
                {
                    mycmd.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        private AgentUserInfo GetReferredAgent(PlayerInfo player)
        {
            PlayerInfo AgentUser = DBProvider.UserDBProvider.GetPlayerByUserID(player.SimpleInfo.AgentUserID);

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

            AgentUserInfo agent = DBProvider.AgentUserInfoDBProvider.GetAgentUserInfo(AgentUser);

            return(agent);
        }
Ejemplo n.º 3
0
        public AgentUserInfo GetAgentUserInfo(PlayerInfo player)
        {
            if (player.SimpleInfo.GroupType != PlayerGroupType.AgentPlayer)
            {
                return(null);
            }

            MySqlConnection myconn = null;
            MySqlCommand    mycmd  = null;

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

                AgentUserInfo agent = new AgentUserInfo();
                agent.ID            = Convert.ToInt32(tableAgents.Rows[0]["id"]);
                agent.TotalAwardRMB = Convert.ToDecimal(tableAgents.Rows[0]["TotalAwardRMB"]);
                agent.InvitationURL = Convert.ToString(tableAgents.Rows[0]["InvitationURL"]);
                agent.Player        = player;
                tableAgents.Clear();
                tableAgents.Dispose();
                adapter.Dispose();

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