void QueryNode(int serverId, string nodeGuid)
    {
        try
        {
            GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverId);
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }

            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();
            string        cmdText         = "SELECT NodeName,LeaderName,LayerId,NodeGUID,ChildCount FROM socialrelation {0}";

            searchCondition.AppendFormat("WHERE {0}='1' AND {1}='?'", FS2TableString.SocialrelationFieldTemplateId, FS2TableString.SocialrelationFieldParentGUID);
            paramList.Add(nodeGuid);

            SqlCommand cmd    = new SqlCommand(string.Format(cmdText, searchCondition.ToString()), paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                DataGridResult.DataSource = CreateDataSource(result, serverId);
                if ((DataGridResult.DataSource as DataView).Table.Rows.Count == 0)
                {
                    LabelOpMsg.Text        = StringDef.NoMatchingRecord;
                    DataGridResult.Visible = false;
                    return;
                }
                else
                {
                    DataGridResult.DataBind();
                    DataGridResult.Visible = true;
                }
            }
            else
            {
                LabelOpMsg.Text        = StringDef.Query + StringDef.Failure;
                DataGridResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text        = ex.Message;
            DataGridResult.Visible = false;
        }
    }
Esempio n. 2
0
    private void ListFile()
    {
        GameServer server = ServerDropDownList.SelectedGameServer;

        if (server != null)
        {
            //加入权限检查
            if (!WebUtil.CheckPrivilege(TheAdminServer.GameServerManager.SecurityObject, OpType.READ, Session))
            {
                LabelOpMsg.Text = StringDef.NotEnoughPrivilege;
                return;
            }
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            if (!server.DoPlugInAction(CurrentUser.Id, GameServerControl.PlugInGuid, GameServerControl.ActionKeyRefreshUploadDir, TextBoxPath.Text))
            {
                LabelOpMsg.Text = StringDef.OperationFail;
                return;
            }
            DataGridResult.DataSource = CreateDataSource(LoadFileInfo());
            if (DataGridResult.DataSource != null && (DataGridResult.DataSource as ICollection).Count != 0)
            {
                DataGridResult.Visible = true;
                DataGridResult.DataBind();
            }
            else
            {
                DataGridResult.Visible = false;
                LabelOpMsg.Text        = StringDef.NoFiles;
                return;
            }
        }
        else
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
        }
    }
Esempio n. 3
0
    void Query()
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();
            searchCondition.AppendFormat("WHERE {0}={1}", FS2TableString.LogFieldLogEvent, LogEvent.ExchangeItem);

            string itemName = TextBoxInputItemName.Text.Trim();
            if (itemName.Length != 0)
            {
                searchCondition.AppendFormat(" AND {0} LIKE '?'", FS2TableString.LogFieldLogData);
                if (CheckBoxItemName.Checked)
                {
                    paramList.Add(string.Format("%“{0}”%", itemName));
                }
                else
                {
                    paramList.Add(string.Format("%“%{0}%”%", itemName));
                }
            }

            string giverName = TextBoxInputGiver.Text.Trim();
            if (giverName.Length != 0)
            {
                if (CheckBoxGiver.Checked)
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey1,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2}='?'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey1,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2} LIKE '%?%'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                paramList.Add(giverName);
            }

            string receiverName = TextBoxInputReceiver.Text.Trim();
            if (receiverName.Length != 0)
            {
                if (CheckBoxReceiver.Checked)
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey3,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2} = '?'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} IN ({1})", FS2TableString.LogFieldLogKey3,
                                                 string.Format("SELECT {0} FROM {1} WHERE {2} LIKE '%?%'", FS2TableString.RolesfirstFieldGUID,
                                                               FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldRoleName));
                }
                paramList.Add(receiverName);
            }

            _start = StartDate.SelectedDate;
            if (_start == DateTime.MinValue)
            {
                LabelOpMsg.Text = StringDef.ParameterInputError;
                return;
            }
            _end = EndDate.SelectedDate;
            if (_end == DateTime.MinValue)
            {
                LabelOpMsg.Text = StringDef.ParameterInputError;
                return;
            }
            searchCondition.Append(string.Format(" AND {0}>='{1}' AND {0}<'{2}'", FS2TableString.LogFieldLogTime, _start.ToString("yyyy-MM-dd HH:mm:ss"), _end.ToString("yyyy-MM-dd HH:mm:ss")));

            string baseCmdString = string.Format("SELECT LogKey1,LogKey3,LogData,LogTime FROM {0} {1}",
                                                 "{0}", searchCondition.ToString());
            string addTableCmdString;
            WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, paramList, _start, _end, out addTableCmdString, out paramList);
            if (addTableCmdString.Length == 0)
            {
                //
                return;
            }

            string     cmdString = "SELECT LogKey1,LogKey3,LogData,LogTime FROM ({0}) AS A ORDER BY LogTime";
            SqlCommand cmd       = new SqlCommand(string.Format(cmdString, addTableCmdString), paramList.ToArray());
            SqlResult  result    = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                result.SetFieldType(new SqlDataType[] {
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.Blob,
                    SqlDataType.DateTime
                });

                object[]  record       = null;
                ArrayList infos        = new ArrayList();
                ArrayList roleGuidList = new ArrayList();

                while ((record = result.ReadRecord()) != null)
                {
                    ExchangeRecord info = new ExchangeRecord();

                    info.giverGuid = record[0] as string;
                    if (info.giverGuid != null && !roleGuidList.Contains(info.giverGuid))
                    {
                        roleGuidList.Add(info.giverGuid);
                    }
                    info.receiverGuid = record[1] as string;
                    if (info.receiverGuid != null && !roleGuidList.Contains(info.receiverGuid))
                    {
                        roleGuidList.Add(info.receiverGuid);
                    }
                    info.time = (DateTime)record[3];

                    string blobData = Encoding.Default.GetString((byte[])record[2]);
                    blobData = blobData.Replace("“", "\"");
                    blobData = blobData.Replace("”", "\"");
                    string[] blobDataSplit = blobData.Split('\"');
                    info.itemName = blobDataSplit[3];

                    infos.Add(info);
                }

                if (infos.Count == 0)
                {
                    //没有查询到信息
                    LabelOpMsg.Text     = StringDef.NoMatchingRecord;
                    PanelResult.Visible = false;
                }
                else
                {
                    PanelResult.Visible       = true;
                    DataGridResult.DataSource = CreateDataSource(infos, GetRoleGuid(roleGuidList));
                    DataGridResult.DataBind();
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
                PanelResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            PanelResult.Visible = false;
            LabelOpMsg.Text     = ex.Message;
        }
    }
Esempio n. 4
0
 protected void DataGridResutl_Cancel(Object sender, DataGridCommandEventArgs e)
 {
     DataGridResult.EditItemIndex = -1;
     DataGridResult.DataSource    = new DataView(Store);
     DataGridResult.DataBind();
 }
Esempio n. 5
0
    void Query(int offset)
    {
        ArrayList     paramList      = new ArrayList();
        StringBuilder whereStatement = new StringBuilder();

        whereStatement.Append("WHERE ");

        string ope = TextBoxOperator.Text.Trim();

        if (ope.Length != 0)
        {
            switch (RadioButtonListOperator.SelectedIndex)
            {
            case 0:
                whereStatement.AppendFormat("{0}='{1}' AND ", TableString.GMOpLogFieldUserId, ope);
                break;

            case 1:
                User user = TheAdminServer.SecurityManager.GetUser(ope);
                if (user != null)
                {
                    whereStatement.AppendFormat("{0}='{1}' AND ", TableString.GMOpLogFieldUserId, user.SecurityObject.Id);
                }
                else
                {
                    whereStatement.AppendFormat("{0}='{1}' AND ", TableString.GMOpLogFieldUserId, ope);
                }
                break;
            }
        }

        switch (RadioButtonListTarget.SelectedIndex)
        {
        case 1:
            whereStatement.AppendFormat("{0}={1} AND ", TableString.GMOpLogFieldTargetType, (int)GMUtil.GMOpTargetType.Account);
            break;

        case 2:
            whereStatement.AppendFormat("{0}={1} AND ", TableString.GMOpLogFieldTargetType, (int)GMUtil.GMOpTargetType.Role);
            break;

        default:
            break;
        }

        string target = TextBoxTarget.Text.Trim();

        if (target.Length != 0)
        {
            MySqlParameter param = new MySqlParameter("?target", MySqlDbType.Blob);
            if (CheckBoxExactlyMatch.Checked)
            {
                whereStatement.AppendFormat("{0}=?target AND ", TableString.GMOpLogFieldTarget);
                param.Value = Encoding.Default.GetBytes("target");
            }
            else
            {
                whereStatement.AppendFormat("{0} LIKE ?target AND ", TableString.GMOpLogFieldTarget);
                param.Value = Encoding.Default.GetBytes("%" + target + "%");
            }

            paramList.Add(param);
        }

        if (ServerDropDownList.Enabled)
        {
            whereStatement.AppendFormat("{0}={1} AND ", TableString.GMOpLogFieldServerId, ServerDropDownList.SelectedServerId);
        }

        if (CheckBoxListOperation.SelectedIndex != -1)
        {
            StringBuilder operationStr = new StringBuilder();
            foreach (ListItem item in CheckBoxListOperation.Items)
            {
                if (item.Selected)
                {
                    operationStr.AppendFormat("{0}={1} OR ", TableString.GMOpLogFieldOperation, int.Parse(item.Value));
                }
            }
            operationStr.Remove(operationStr.Length - 3, 3);
            whereStatement.Append(string.Format("({0}) AND ", operationStr.ToString()));
        }

        if (StartDate.Selected)
        {
            whereStatement.Append(string.Format("{0}>='{1}' AND ", TableString.GMOpLogFieldLogTime, StartDate.SelectedDate.ToString("yyyy-MM-dd HH:mm:ss")));
        }
        if (EndDate.Selected)
        {
            whereStatement.Append(string.Format("{0}<'{1}' AND ", TableString.GMOpLogFieldLogTime, EndDate.SelectedDate.ToString("yyyy-MM-dd HH:mm:ss")));
        }

        if (whereStatement.Length != 6)
        {
            whereStatement.Remove(whereStatement.Length - 4, 4);
        }
        else
        {
            whereStatement.Remove(0, whereStatement.Length);
        }

        int    limitCount     = _recordPerPage;
        string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount);

        string sqlStatement = string.Format("SELECT * FROM {0} {1} {2}", TableString.GMOpLogTableName, whereStatement.Length == 0 ? string.Empty : whereStatement.ToString(), limitStatement);

        //为动画效果而做延迟
        System.Threading.Thread.Sleep(500);

        DataTable table = LogSystem.TheInstance.QueryGMOperationLog(sqlStatement, paramList.ToArray());

        if (table != null && table.Rows.Count != 0)
        {
            PanelResult.Visible = true;

            DataGridResult.DataSource = CreateDataSource(table);
            DataGridResult.DataBind();

            ViewState[WebConfig.SessionQueryLogOffset] = offset;

            ButtonPreviousPage.Enabled = (offset > 0);
            ButtonFirstPage.Enabled    = (offset > 0);
            ButtonNextPage.Enabled     = (table.Rows.Count >= limitCount);
        }
        else
        {
            LabelOpMsg.Text    = StringDef.NoMatchingRecord;
            LabelOpMsg.Visible = true;
            return;
        }
    }
Esempio n. 6
0
    void Query(int offset)
    {
        try
        {
            PanelResult.Visible = false;

            GameServer server = AdminServer.TheInstance.GameServerManager.GetGameServer(int.Parse(serverGroupDropDownList.SelectedValue));
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            //读权限
            if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.READ, Session))
            {
                LabelOpMsg.Text = StringDef.NotEnoughPrivilege;
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            string cRoleName    = TextBoxcRoleName.Text;
            string cAccountName = TextBoxcAccountName.Text;
            WebUtil.ValidateValueString(cRoleName);
            WebUtil.ValidateValueString(cAccountName);
            //角色名
            if (cRoleName.Length > 0)
            {
                if (CheckBoxcRoleName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", JX2TableString.cRoleName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", JX2TableString.cRoleName);
                }
                paramList.Add(cRoleName);
            }
            //帐号名
            if (cAccountName.Length > 0)
            {
                if (CheckBoxcAccountName.Checked)
                {
                    searchCondition.Append(string.Format(" AND {0}='?'", JX2TableString.cAccountName));
                }
                else
                {
                    searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", JX2TableString.cAccountName));
                }
                paramList.Add(cAccountName);
            }


            //性别
            int sex = ListBoxSex.SelectedIndex - 1;
            if (sex >= 0)
            {
                searchCondition.Append(string.Format(" AND {0}={1}", JX2TableString.iSex, sex));
            }
            //总在线时间
            string gametime_start_str = TextBoxdwGameTime_start.Text;
            string gametime_end_str   = TextBoxdwGameTime_end.Text;
            if (gametime_start_str != "" && gametime_end_str != "")
            {
                int GameTime_start = Convert.ToInt32(TextBoxdwGameTime_start.Text);
                int GameTime_end   = Convert.ToInt32(TextBoxdwGameTime_end.Text);

                if (GameTime_start > GameTime_end)
                {
                    LabelOpMsg.Text = StringDef.EndTimesmallerThanStartTime;
                    return;
                }
                else
                {
                    GameTime_start = GameTime_start * 3600;
                    GameTime_end   = GameTime_end * 3600;
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.iGameTime,
                                                 GameTime_start, GameTime_end);
                }
            }



            //金钱
            string Money_start_str = TextBoxMoney_start.Text;
            string Money_end_str   = TextBoxMoney_end.Text;
            if (Money_start_str != "" && Money_end_str != "")
            {
                int Money_start = Convert.ToInt32(TextBoxMoney_start.Text);
                int Money_end   = Convert.ToInt32(TextBoxMoney_end.Text);
                if (Money_start > Money_end)
                {
                    LabelOpMsg.Text = StringDef.EndTimesmallerThanStartTime;
                    return;
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.iMoney,
                                                 Money_start, Money_end);
                }
            }



            //创建时间
            DateTime createtime_start = CreateTime_start.SelectedDate;
            DateTime createtime_end   = CreateTime_end.SelectedDate;
            if (createtime_start != DateTime.MinValue && createtime_end == DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}>='{1}'", JX2TableString.dCreateTime,
                                             createtime_start.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else if (createtime_start == DateTime.MinValue && createtime_end != DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}<='{1}'", JX2TableString.dCreateTime,
                                             createtime_end.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else if (createtime_start != DateTime.MinValue && createtime_end != DateTime.MinValue)
            {
                if (createtime_start > createtime_end)
                {
                    LabelOpMsg.Text = StringDef.ParameterInputError;
                    return;
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.dCreateTime,
                                                 createtime_start.ToString("yyyy-MM-dd HH:mm:ss"), createtime_end.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }


            //最后一次登陆时间
            DateTime lastlogintime_start = LastLoginTime_start.SelectedDate;
            DateTime lastlogintime_end   = LastLoginTime_end.SelectedDate;
            if (lastlogintime_start != DateTime.MinValue && lastlogintime_end == DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}>='{1}'", JX2TableString.dLastLoginTime,
                                             lastlogintime_start.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else if (lastlogintime_start == DateTime.MinValue && lastlogintime_end != DateTime.MinValue)
            {
                searchCondition.AppendFormat(" AND {0}<='{1}'", JX2TableString.dLastLoginTime,
                                             lastlogintime_end.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (lastlogintime_start != DateTime.MinValue && lastlogintime_end != DateTime.MinValue)
            {
                if (lastlogintime_start > lastlogintime_end)
                {
                    LabelOpMsg.Text = StringDef.EndTimesmallerThanStartTime;
                    return;
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<='{2}'", JX2TableString.dLastLoginTime,
                                                 lastlogintime_start.ToString("yyyy-MM-dd HH:mm:ss"), lastlogintime_end.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }

            //角色
            StringBuilder roleTypeBuilder = new StringBuilder();
            foreach (ListItem item in CheckBoxListRoleType.Items)
            {
                if (item.Selected)
                {
                    string[] conValue = item.Value.Split(',');
                    roleTypeBuilder.AppendFormat("({0}='{1}' AND {2}='{3}') OR ", JX2TableString.iFaction, conValue[0], JX2TableString.iFactionRoute, conValue[1]);    //门派,与门派路线
                }
            }
            if (roleTypeBuilder.Length != 0)
            {
                searchCondition.AppendFormat(" AND ({0}) ", roleTypeBuilder.ToString(0, roleTypeBuilder.Length - 3));
            }
            else
            {
                LabelOpMsg.Text    = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleClass);
                LabelOpMsg.Visible = true;
                return;
            }

            //等级排序
            int startLevel = int.Parse(ListBoxStartLevel.SelectedValue);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", JX2TableString.iLevel, startLevel));
            }

            int endLevel = int.Parse(ListBoxEndLevel.SelectedValue);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", JX2TableString.iLevel, endLevel));
            }

            if (searchCondition.Length > 0)
            {
                searchCondition.Remove(0, 4);
                searchCondition.Insert(0, " WHERE");
            }

            //排序
            string orderByType = string.Empty;
            switch (ListBoxOrderByType.SelectedIndex)
            {
            case 0:
                orderByType = "ASC";
                break;

            case 1:
                orderByType = "DESC";
                break;
            }

            string orderByStatement = string.Empty;
            switch (ListBoxOrderBy.SelectedIndex)
            {
            case 0:
                orderByStatement = string.Format(" ORDER BY {0} {1}", JX2TableString.iLevel, orderByType);
                break;

            case 1:
                orderByStatement = string.Format(" ORDER BY {0} {1}", JX2TableString.iFaction, orderByType);
                break;
            }

            int    limitCount     = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount + 1);

            SqlCommand cmd = new SqlCommand("SELECT cAccountName,cRoleName,iSex,iLevel,iGameTime,iFaction,iFactionRoute,iMoney, dCreateTime,dLastLoginTime,cRoleID FROM trolebaseinfo" + searchCondition.ToString() + orderByStatement + limitStatement, paramList.ToArray());

            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

            if (result != null && result.Success)
            {
                ViewState[WebConfig.SessionQueryLogOffset] = offset;

                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.SByte,
                    SqlDataType.Int32,    //等级
                    SqlDataType.Int32,    //在线时间
                    SqlDataType.Int32,
                    SqlDataType.Int32,
                    SqlDataType.Int64,
                    SqlDataType.DateTime,
                    SqlDataType.DateTime,
                    SqlDataType.String
                });
                //做结果列表了
                ArrayList roles  = new ArrayList();
                object[]  record = null;
                //Encoding utf8 = Encoding.UTF8;
                //Encoding gb2312 = Encoding.GetEncoding("GB2312");
                while ((record = result.ReadRecord()) != null)
                {
                    JX2RoleDataInfo info = new JX2RoleDataInfo();
                    info.cAccountName = (string)record[0];
                    //string strRoleName = (string)record[1];
                    //info.cRoleName = utf8.GetString(gb2312.GetBytes(strRoleName));
                    info.cRoleName = (string)record[1];
                    info.iSex      = (JX2RoleSex)(SByte)record[2];
                    info.iLevel    = (int)record[3];
                    //在线时间
                    info.iGameTime = (int)record[4];
                    //这个是门派字段
                    info.iFaction = (int)record[5];
                    //这个是门派路线字段
                    info.iFactionRoute = (int)record[6];
                    //这个是职业字段
                    info.RoleType = (JxRoleType)(info.iFaction * 100 + info.iFactionRoute);//RoleType等于iFaction乘100与iFactionRoute相加,为了与JxRoleType批配
                    info.iMoney   = (Int64)record[7];
                    if (record[8] != null)
                    {
                        info.dCreateTime = (DateTime)record[8];
                    }
                    //游戏新建角色,没登陆显示的上次登陆时间为1970-1-1 10:00:00,处理:上次登陆时间小与创建时间的,上次登陆时间置为创建时间
                    if (record[9] != null && (DateTime)record[9] > (DateTime)record[8])
                    {
                        info.dLastLoginTime = (DateTime)record[9];
                    }
                    else
                    {
                        info.dLastLoginTime = (DateTime)record[8];
                    }
                    info.cRoleID = (String)record[10];
                    roles.Add(info);
                }


                ButtonPreviousPage.Enabled = (offset > 0);
                ButtonFirstPage.Enabled    = (offset > 0);
                ButtonNextPage.Enabled     = (roles.Count > limitCount);
                DataGridResult.DataSource  = CreateDataSource(roles);
                DataGridResult.DataBind();

                if (roles != null && roles.Count != 0)
                {
                    PanelResult.Visible = true;
                }
                else
                {
                    PanelResult.Visible = false;
                }

                if (!PanelResult.Visible)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text     = ex.Message;
            PanelResult.Visible = false;
        }
    }
    void Query(int offset)
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ViewState[WebConfig.ParamServerId] = server.Id;

            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();
            string        cmdText         = "SELECT NodeName,LeaderName,LayerId,NodeGUID,ChildCount,ParentGUID FROM socialrelation {0} {1}";

            searchCondition.AppendFormat("WHERE {0}='1' ", FS2TableString.SocialrelationFieldTemplateId);
            if (DropDownListType.SelectedIndex != 0)
            {
                searchCondition.AppendFormat(" AND {0}='{1}'", FS2TableString.SocialrelationFieldLayerId, DropDownListType.SelectedValue);
            }

            string name = TextBoxName.Text.Trim();
            if (name.Length > 0)
            {
                if (CheckBoxName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", FS2TableString.SocialrelationFieldNodeName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", FS2TableString.SocialrelationFieldNodeName);
                }
                paramList.Add(name);
            }

            string leader = TextBoxLeaderName.Text.Trim();
            if (leader.Length > 0)
            {
                if (CheckBoxLeaderName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", FS2TableString.SocialrelationFieldLeaderName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", FS2TableString.SocialrelationFieldLeaderName);
                }
                paramList.Add(leader);
            }

            int    limitCount     = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount);

            SqlCommand cmd    = new SqlCommand(string.Format(cmdText, searchCondition.ToString(), limitStatement), paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                DataGridResult.DataSource = CreateDataSource(result);
                int rowCount = (DataGridResult.DataSource as DataView).Table.Rows.Count;
                if (rowCount == 0)
                {
                    LabelOpMsg.Text     = StringDef.NoMatchingRecord;
                    PanelResult.Visible = false;
                    return;
                }
                else
                {
                    ViewState[WebConfig.SessionQueryLogOffset] = offset;

                    ButtonPreviousPage.Enabled = (offset > 0);
                    ButtonFirstPage.Enabled    = (offset > 0);
                    ButtonNextPage.Enabled     = (rowCount >= limitCount);

                    PanelResult.Visible = true;
                    DataGridResult.DataBind();
                }
            }
            else
            {
                LabelOpMsg.Text        = StringDef.Query + StringDef.Failure;
                DataGridResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text        = ex.Message;
            DataGridResult.Visible = false;
        }
    }