Esempio n. 1
0
    void Query(int offset)
    {
        GameServer server = ServerDropDownList.SelectedGameServer;

        if (server == null)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
            return;
        }
        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return;
        }

        string roleName = TextBoxRole.Text.Trim();

        if (roleName == null || roleName.Length == 0)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleName);
            return;
        }

        string roleGuid = WebUtil.FindRoleGuidByName(CurrentUser.Id, server, roleName);

        if (roleGuid == null || roleGuid.Length == 0)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgNotExist, StringDef.RoleName);
            return;
        }

        StringBuilder whereStatement = new StringBuilder();

        whereStatement.AppendFormat(" WHERE PlayerGuid='{0}'", roleGuid);

        foreach (ListItem item in CheckBoxListPlayerAction.Items)
        {
            if (!item.Selected)
            {
                whereStatement.AppendFormat(" AND ActionId<>{0}", item.Value);
            }
        }

        if (ScriptCalendarStartTime.Selected)
        {
            DateTime startTime = ScriptCalendarStartTime.SelectedDate;
            whereStatement.AppendFormat(" AND RecordTime>='{0}'", startTime);
        }

        if (ScriptCalendarEndTime.Selected)
        {
            DateTime endTime = ScriptCalendarEndTime.SelectedDate;
            whereStatement.AppendFormat(" AND RecordTime<='{0}'", endTime);
        }

        StringBuilder orderByStatement = new StringBuilder();

        if (ListBoxOrderBy.SelectedIndex == 0)
        {
            orderByStatement.Append(" ORDER BY RecordTime");
        }
        else
        {
            orderByStatement.Append(" ORDER BY PlayerAction");
        }
        if (ListBoxOrderByType.SelectedIndex == 0)
        {
            orderByStatement.Append(" ASC");
        }
        else
        {
            orderByStatement.Append(" DESC");
        }

        SqlCommand cmd = new SqlCommand("SELECT Id,RecordTime,PlayerAction,ActionDesc FROM playeraction" + whereStatement.ToString() + orderByStatement.ToString());

        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return;
        }
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

        ArrayList c2sNetMsgInfoList = new ArrayList();

        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[] { SqlDataType.Int32, SqlDataType.DateTime, SqlDataType.Int32, SqlDataType.String });
            object[] record = null;
            while ((record = result.ReadRecord()) != null)
            {
                PlayerActionInfo info = new PlayerActionInfo();
                info.Id         = (int)record[0];
                info.RecordTime = (DateTime)record[1];
                info.Action     = (int)record[2];
                info.Desc       = record[3] as string;
                c2sNetMsgInfoList.Add(info);
            }

            if (c2sNetMsgInfoList.Count == 0)
            {
                LabelOpMsg.Text = StringDef.NoMatchingRecord;
                return;
            }
            else
            {
                CreateTableC2SNetMsg(c2sNetMsgInfoList);
                PanelResult.Visible = true;
            }
        }
        else
        {
            if (result == null)
            {
                LabelOpMsg.Text = StringDef.QueryTimeOut;
            }
            else
            {
                LabelOpMsg.Text = StringDef.OperationFail;
            }
        }
    }
Esempio n. 2
0
	void Query(int offset)
	{
		GameServer server = ServerDropDownList.SelectedGameServer;
        if (server == null)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
            return;
        }
        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return;
        }

		string roleName = TextBoxRole.Text.Trim();
        if (roleName == null || roleName.Length == 0)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleName);
            return;
        }

		string roleGuid = WebUtil.FindRoleGuidByName(CurrentUser.Id, server, roleName);
        if (roleGuid == null || roleGuid.Length == 0)
        {
            LabelOpMsg.Text = string.Format(StringDef.MsgNotExist, StringDef.RoleName);
            return;
        }

		StringBuilder whereStatement = new StringBuilder();
		whereStatement.AppendFormat(" WHERE PlayerGuid='{0}'", roleGuid);

		foreach (ListItem item in CheckBoxListPlayerAction.Items)
		{
			if (!item.Selected)
			{
				whereStatement.AppendFormat(" AND ActionId<>{0}", item.Value);
			}
		}

		if (ScriptCalendarStartTime.Selected)
		{
			DateTime startTime = ScriptCalendarStartTime.SelectedDate;
			whereStatement.AppendFormat(" AND RecordTime>='{0}'", startTime);
		}

		if (ScriptCalendarEndTime.Selected)
		{
			DateTime endTime = ScriptCalendarEndTime.SelectedDate;
			whereStatement.AppendFormat(" AND RecordTime<='{0}'", endTime);
		}

		StringBuilder orderByStatement = new StringBuilder();
		if (ListBoxOrderBy.SelectedIndex == 0)
		{
			orderByStatement.Append(" ORDER BY RecordTime");
		}
		else
		{
			orderByStatement.Append(" ORDER BY PlayerAction");
		}
		if (ListBoxOrderByType.SelectedIndex == 0)
		{
			orderByStatement.Append(" ASC");
		}
		else
		{
			orderByStatement.Append(" DESC");
		}

		SqlCommand cmd = new SqlCommand("SELECT Id,RecordTime,PlayerAction,ActionDesc FROM playeraction" + whereStatement.ToString() + orderByStatement.ToString());
        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return;
        }
		SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

		ArrayList c2sNetMsgInfoList = new ArrayList();
        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[] { SqlDataType.Int32, SqlDataType.DateTime, SqlDataType.Int32, SqlDataType.String });
            object[] record = null;
            while ((record = result.ReadRecord()) != null)
            {
                PlayerActionInfo info = new PlayerActionInfo();
                info.Id = (int)record[0];
                info.RecordTime = (DateTime)record[1];
                info.Action = (int)record[2];
                info.Desc = record[3] as string;
                c2sNetMsgInfoList.Add(info);
            }

            if (c2sNetMsgInfoList.Count == 0)
            {
                LabelOpMsg.Text = StringDef.NoMatchingRecord;
                return;
            }
            else
            {
                CreateTableC2SNetMsg(c2sNetMsgInfoList);
                PanelResult.Visible = true;
            }
        }
        else
        {
            if (result == null)
                LabelOpMsg.Text = StringDef.QueryTimeOut;
            else
                LabelOpMsg.Text = StringDef.OperationFail;
        }
	}