/// <summary>
        /// 生成按钮点击响应
        /// </summary>
        protected void createButton_Click(object sender, EventArgs e)
        {
            this.errorLabel.Text = "";

            if (this.channelList.SelectedIndex < 0)
            {
                return;
            }

            if (this.typeTextBox.Text == null || this.typeTextBox.Text == "")
            {
                return;
            }

            if (this.giftDropDownList.Items == null)
            {
                return;
            }

            int count = 0;

            if (!int.TryParse(this.countTextBox.Text, out count) || count <= 0)
            {
                return;
            }

            //如果使用次数不填,则默认为1
            if (string.IsNullOrEmpty(this.UseTimes.Text))
            {
                this.UseTimes.Text = "1";
            }


            Channel channel = CreateKey.ChannelSet[this.channelList.SelectedIndex];

            gmt.Server keyServer = gmt.Server.GetServerAt(this.serverList.SelectedIndex);

            int selectvalue = 0;

            if (!int.TryParse(this.Mutitimes.SelectedValue, out selectvalue))
            {
                return;
            }

            if (keyServer != null)
            {
                bool error = DatabaseAssistant.Execute
                             (
                    keyServer.CodeDatabaseAddress,
                    keyServer.CodeDatabasePort,
                    keyServer.CodeDatabaseCharSet,
                    keyServer.CodeDatabase,
                    keyServer.CodeDatabaseUserId,
                    keyServer.CodeDatabasePassword,
                    "CALL xp_gift_gen({0}, {1}, {2}, '{3}', {4}, '{5}','{6}','{7}','{8}');",
                    count,
                    10,
                    channel.Id,
                    DatabaseAssistant.DetectionSql(this.typeTextBox.Text),
                    this.giftDropDownList.SelectedValue,
                    channel.GiftChar,
                    ((DateTime)ViewState["expiryDate"]).ToString("yyyy-MM-dd"), int.Parse(this.UseTimes.Text), selectvalue
                             );

                if (!error)
                {
                    this.resultLabel.Text = TableManager.GetGMTText(691);
                    return;
                }

                StringBuilder builder = new StringBuilder(TableManager.GetGMTText(692) + ":");

                DatabaseAssistant.Execute
                (
                    reader => { while (reader.Read())
                                {
                                    builder.Append("<br>").Append(reader.GetString(0));
                                }
                    },
                    keyServer.CodeDatabaseAddress,
                    keyServer.CodeDatabasePort,
                    keyServer.CodeDatabaseCharSet,
                    keyServer.CodeDatabase,
                    keyServer.CodeDatabaseUserId,
                    keyServer.CodeDatabasePassword,
                    "SELECT `gift_code` FROM `gift` ORDER BY `gen_time` DESC LIMIT {0};",
                    count
                );

                this.resultLabel.Text = builder.ToString();
            }
        }
        /// <summary>
        /// 查询ID按钮点击响应
        /// </summary>
        protected void findIdButton_Click(object sender, EventArgs e)
        {
            this.idLabel.Text = "";
            if (this.selectListBox.Items.Count == 0)
            {
                this.errorLabel.Text = TableManager.GetGMTText(740);
                return;
            }

            if (string.IsNullOrEmpty(this.playerNameTextBox.Text) &&
                string.IsNullOrEmpty(this.uidTextBox.Text) &&
                string.IsNullOrEmpty(this.cyidTextBox.Text))
            {
                this.errorLabel.Text = TableManager.GetGMTText(721);
                return;
            }

            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < this.selectListBox.Items.Count; ++i)
            {
                gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[i].Text);

                builder.Append("<b style='color:orange'>").Append(server.Name).Append("</b><br>");

                string sql;

                if (!string.IsNullOrEmpty(this.playerNameTextBox.Text))
                {
                    sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `uname` LIKE '%{0}%';", DatabaseAssistant.DetectionSql(this.playerNameTextBox.Text));
                }
                else if (!string.IsNullOrEmpty(this.uidTextBox.Text))
                {
                    sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `uid`='{0}';", DatabaseAssistant.DetectionSql(this.uidTextBox.Text));
                }
                else
                {
                    sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `cyuid`='{0}';", DatabaseAssistant.DetectionSql(this.cyidTextBox.Text));
                }

                DatabaseAssistant.Execute(reader =>
                {
                    bool finded = false;
                    while (reader.Read())
                    {
                        finded = true;
                        builder.Append(TableManager.GetGMTText(46) + ":").Append(reader.GetString(0));
                        builder.Append("&#09;" + TableManager.GetGMTText(722) + ":").Append(reader.GetUInt32(1));
                        builder.Append("&#09;" + TableManager.GetGMTText(48) + ":").Append(reader.GetString(2));
                        builder.Append("&#09;" + TableManager.GetGMTText(59) + ":").Append(GetPlayerStatus(reader.GetUInt32(1)));

                        builder.Append("<br>");
                    }

                    if (!finded)
                    {
                        builder.Append(TableManager.GetGMTText(674) + "<br>");
                    }
                },
                                          server.DatabaseAddress,
                                          server.DatabasePort,
                                          server.DatabaseCharSet,
                                          server.GameDatabase,
                                          server.DatabaseUserId,
                                          server.DatabasePassword,
                                          sql);
            }

            this.idLabel.Text = builder.ToString();
        }
        /// <summary>
        /// 获取玩家编号
        /// </summary>
        /// <param name="needReport">是否需要报告</param>
        /// <returns>玩家编号</returns>
        private uint GetPlayerId(bool needReport = true)
        {
            if (this.selectListBox.Items.Count == 0)
            {
                if (needReport)
                {
                    this.errorLabel.Text = TableManager.GetGMTText(740);
                }
                return(0);
            }
            if (this.selectListBox.Items.Count != 1)
            {
                if (needReport)
                {
                    this.errorLabel.Text = TableManager.GetGMTText(748);
                }
                return(0);
            }
            gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[0].ToString());

            if (server == null)
            {
                if (needReport)
                {
                    this.errorLabel.Text = TableManager.GetGMTText(749);
                }
                return(0);
            }

            uint playerId = 0;

            string sql;

            if (!string.IsNullOrEmpty(this.playerNameTextBox.Text))
            {
                sql = string.Format("SELECT `uid` FROM `user` WHERE `uname`='{0}';", DatabaseAssistant.DetectionSql(this.playerNameTextBox.Text));
            }
            else if (!string.IsNullOrEmpty(this.uidTextBox.Text))
            {
                sql = string.Format("SELECT `uid` FROM `user` WHERE `uid`='{0}';", DatabaseAssistant.DetectionSql(this.uidTextBox.Text));
            }
            else if (!string.IsNullOrEmpty(this.cyidTextBox.Text))
            {
                sql = string.Format("SELECT `uid` FROM `user` WHERE `cyuid`='{0}';", DatabaseAssistant.DetectionSql(this.cyidTextBox.Text));
            }
            else
            {
                this.errorLabel.Text = TableManager.GetGMTText(721);
                return(0);
            }

            DatabaseAssistant.Execute(reader =>
            {
                if (reader.Read())
                {
                    playerId = reader.GetUInt32(0);
                }
            },
                                      server.DatabaseAddress,
                                      server.DatabasePort,
                                      server.DatabaseCharSet,
                                      server.GameDatabase,
                                      server.DatabaseUserId,
                                      server.DatabasePassword,
                                      sql);

            //else if (this.playerChannelIdTextBox.Text != null && this.playerChannelIdTextBox.Text != "")
            //{
            //	DatabaseAssistant.Execute(reader =>
            //	{
            //		if (reader.Read()) { playerId = reader.GetUInt32(0); }
            //	},
            //	server.DatabaseAddress,
            //	server.DatabasePort,
            //	server.DatabaseCharSet,
            //	server.GmAddress,
            //	server.DatabaseUserId,
            //	server.DatabasePassword,
            //	"SELECT `uid` FROM `user` WHERE `cyuid`='{0}';", DatabaseAssistant.DetectionSql(this.playerChannelIdTextBox.Text));
            //}

            if (playerId == 0 && needReport)
            {
                this.errorLabel.Text += TableManager.GetGMTText(737) + "\r\n";
            }

            return(playerId);
        }
        /// <summary>
        /// 确认玩家按钮点击响应
        /// </summary>
        protected void ensureButton_Click(object sender, EventArgs e)
        {
            if (this.selectListBox.Items.Count != 1 ||
                string.IsNullOrEmpty(this.selectListBox.Items[0].Value))
            {
                this.errorLabel.Text = TableManager.GetGMTText(720);
                return;
            }

            if (string.IsNullOrEmpty(this.uidTextBox.Text))
            {
                this.errorLabel.Text = TableManager.GetGMTText(721);
                return;
            }

            StringBuilder builder = new StringBuilder();

            gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[0].Value);
            builder.Append(server.Name).Append("<br>");

            string sql = "";

            if (!string.IsNullOrEmpty(this.uidTextBox.Text))
            {
                sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `uid`='{0}';", DatabaseAssistant.DetectionSql(this.uidTextBox.Text));
            }

            DatabaseAssistant.Execute(reader =>
            {
                bool finded = false;
                while (reader.Read())
                {
                    finded = true;
                    builder.Append(TableManager.GetGMTText(9) + "(").Append(reader.GetString(0));
                    this.playerNameLabel.Text = reader.GetString(0);
                    builder.Append(") " + TableManager.GetGMTText(722) + "(").Append(reader.GetUInt32(1));
                    builder.Append(") " + TableManager.GetGMTText(48) + "(").Append(reader.GetString(2)).Append(")<br>");
                }

                if (!finded)
                {
                    builder.Append(TableManager.GetGMTText(674) + "<br>");
                }
            },
                                      server.DatabaseAddress,
                                      server.DatabasePort,
                                      server.DatabaseCharSet,
                                      server.GameDatabase,
                                      server.DatabaseUserId,
                                      server.DatabasePassword,
                                      sql);

            //显示玩家信息
            //this.playerNameLabel.Text = builder.ToString();
        }