IList <NpcStatisticInfo> QueryNpc(GameServer server, DateTime startTime, DateTime endTime, int logEvent, int offset) { string baseCmdString = string.Format("SELECT LogKey1, SUM(LogKey6) AS SubSum FROM {0} WHERE {1}='{2}' AND {3}>='{4}' AND {3}<'{5}' GROUP BY LogKey1", "{0}", FS2TableString.LogFieldLogEvent, logEvent, FS2TableString.LogFieldLogTime, _start.ToString("yyyy-MM-dd HH:mm:ss"), _end.ToString("yyyy-MM-dd HH:mm:ss")); string addTableCmdString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, _start, _end, out addTableCmdString); if (addTableCmdString.Length == 0) { return(null); } string cmdText = string.Format("SELECT LogKey1, SUM(SubSum) AS ByKillCount FROM ({0}) AS A GROUP BY LogKey1 ORDER BY ByKillCount DESC LIMIT {1},{2};", addTableCmdString, offset, EntryPerPage); SqlResult queryResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, new SqlCommand(cmdText)); if (queryResult != null && queryResult.Success) { queryResult.SetFieldType(new SqlDataType[] { SqlDataType.String, SqlDataType.Int32 }); IList <NpcStatisticInfo> infos = new List <NpcStatisticInfo>(); object[] record = queryResult.ReadRecord(); while (record != null) { NpcStatisticInfo info = new NpcStatisticInfo(); info.TemaplteId = (string)record[0]; info.Count = (int)record[1]; infos.Add(info); record = queryResult.ReadRecord(); } ViewState[WebConfig.SessionQueryLogOffset] = offset; ButtonPreviousPage.Enabled = (offset > 0); ButtonFirstPage.Enabled = (offset > 0); ButtonNextPage.Enabled = (infos.Count >= EntryPerPage); return(infos); } else { if (queryResult == null) { LabelOpMsg.Text = StringDef.QueryTimeOut; } else { LabelOpMsg.Text = StringDef.OperationFail; } return(null); } }
AnalyseResult AnalyseData(GameServer server, int logEventId, string additionalFilter) { double[] statisticValues = null; double[] statisticTimes = null; double[] statisticCounts = null; bool bQuitFlag = false; StringBuilder whereStatement = new StringBuilder(); whereStatement.AppendFormat(" WHERE {0}={1} ", FS2TableString.LogFieldLogEvent, logEventId); if (_roleGuid != null) { whereStatement.AppendFormat(" AND {0}='{1}'", FS2TableString.LogFieldLogKey1, _roleGuid); } whereStatement.AppendFormat(" AND {0} >= '{1}' AND {0} <= '{2}'", FS2TableString.LogFieldLogTime, _startDate, _endDate); if (additionalFilter != null && additionalFilter.Length > 0) { whereStatement.AppendFormat(" AND {0} ", additionalFilter); } string baseCmdString = string.Empty; switch (_viewType) { case ViewType.ByMonth: baseCmdString = string.Format("SELECT DATE_FORMAT(LogTime,'%Y-%m'),SUM(LogKey6),COUNT(*) FROM {0} {1} GROUP BY LogEvent", "{0}", whereStatement.ToString()); int monthCount = 12 * (_endDate.Year - _startDate.Year) + (_endDate.Month - _startDate.Month) + 1; statisticValues = new double[monthCount]; statisticTimes = new double[monthCount]; statisticCounts = new double[monthCount]; for (int index = 0; index != statisticValues.Length; ++index) { DateTime tempDate = _startDate.AddMonths(index); statisticTimes[index] = new XDate(tempDate.Year, tempDate.Month, 1); } break; case ViewType.ByDay: baseCmdString = string.Format("SELECT DATE(LogTime), SUM(LogKey6), COUNT(*) FROM {0} {1} GROUP BY DATE(LogTime)", "{0}", whereStatement.ToString()); TimeSpan span = _endDate.Subtract(_startDate); int dayCount = span.Days + 1; statisticValues = new double[dayCount]; statisticTimes = new double[dayCount]; statisticCounts = new double[dayCount]; for (int index = 0; index != statisticTimes.Length; ++index) { DateTime tempDate = _startDate.Date.AddDays(index); statisticTimes[index] = new XDate(tempDate); } break; case ViewType.ByHour: bQuitFlag = true; break; default: bQuitFlag = true; break; } if (bQuitFlag) { return(null); } string addTableCmdString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, _startDate, _endDate, out addTableCmdString); if (addTableCmdString.Length == 0) { return(null); } SqlResult sqlResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, new SqlCommand(addTableCmdString)); if (sqlResult != null && sqlResult.Success) { sqlResult.SetFieldType(new SqlDataType[] { SqlDataType.DateTime, SqlDataType.Int64, SqlDataType.Int32 }); object[] record = sqlResult.ReadRecord(); switch (_viewType) { case ViewType.ByMonth: while (record != null) { DateTime date = (DateTime)record[0]; long sum = (long)record[1]; int count = (int)record[2]; int monthIndex = 12 * (date.Year - _startDate.Year) + (date.Month - _startDate.Month); statisticTimes[monthIndex] = new XDate(date); statisticValues[monthIndex] = sum; statisticCounts[monthIndex] = count; record = sqlResult.ReadRecord(); } break; case ViewType.ByDay: while (record != null) { DateTime date = (DateTime)record[0]; long sum = (long)record[1]; int count = (int)record[2]; TimeSpan indexSpan = date.Subtract(_startDate.Date); statisticTimes[indexSpan.Days] = new XDate(date); statisticValues[indexSpan.Days] = sum; statisticCounts[indexSpan.Days] = count; record = sqlResult.ReadRecord(); } break; } } else { return(null); } AnalyseResult result = new AnalyseResult(); result.Values = statisticValues; result.Times = statisticTimes; result.Counts = statisticCounts; return(result); }
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; } }
void ExpByDate(System.Drawing.Graphics g, ZedGraph.MasterPane masterPane) { try { GameServer server = ServerDropDownList.SelectedGameServer; if (server == null) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer); return; } //加入权限检查 if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.READ, Session)) { Response.Redirect(WebConfig.PageNotEnoughPrivilege, true); } if (!server.IsConnected) { LabelOpMsg.Text = StringDef.NoConnectionAlert; return; } List <DateTime> dateList = new List <DateTime>(); List <int> expList = new List <int>(); string baseCmdString = string.Format("SELECT DATE({0}) AS LogDate, SUM({1}) AS ExpSum FROM {2} WHERE {3}='{4}' AND {5}='{6}' GROUP BY LogDate", FS2TableString.LogFieldLogTime, FS2TableString.LogFieldLogKey6, "{0}", FS2TableString.LogFieldLogEvent, LogEvent.GetExperience, FS2TableString.LogFieldLogKey1, _roleGuid); string addTableCmdString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, _start, _end, out addTableCmdString); if (addTableCmdString.Length == 0) { return; } SqlCommand cmd = new SqlCommand(string.Format("SELECT LogDate,ExpSum FROM ({0}) AS A ORDER BY LogDate ASC", addTableCmdString)); SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd); if (result != null && result.Success) { result.SetFieldType(new SqlDataType[] { SqlDataType.DateTime, SqlDataType.Int32 }); object[] record = null; while ((record = result.ReadRecord()) != null) { dateList.Add((DateTime)record[0]); expList.Add((Int32)record[1]); } } else { if (result == null) { LabelOpMsg.Text = StringDef.QueryTimeOut; } else { LabelOpMsg.Text = StringDef.OperationFail; } } TimeSpan actualTime = DateTime.Now.Subtract(_start > _createTime ? _start : _createTime); int days = actualTime.Days + 1; double[] dateArray = new double[days]; double[] expArray = new double[days]; for (int date = 0; date < days; date++) { DateTime dateTime = _createTime.AddDays(date); dateArray[date] = new XDate(dateTime.Year, dateTime.Month, dateTime.Day); double expAddToday = 0; for (int j = 0; j < dateList.Count; j++) { DateTime date2 = dateList[j]; if (date2.Date == dateTime.Date) { expAddToday += expList[j]; } } expArray[date] = expAddToday; if (date > 0) { expArray[date] += expArray[date - 1]; } } GraphPane graphPane = masterPane[0]; graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor); graphPane.Legend.Fill.IsVisible = false; graphPane.Legend.Border.IsVisible = false; graphPane.Legend.FontSpec.Fill.IsVisible = false; graphPane.XAxis.Title.Text = StringDef.Date; graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor; graphPane.XAxis.Type = AxisType.DateAsOrdinal; graphPane.XAxis.MinorTic.Size = 0; graphPane.XAxis.Scale.MajorStep = 1; graphPane.XAxis.Scale.FontSpec.Size = 12; graphPane.XAxis.Scale.MajorUnit = DateUnit.Day; graphPane.XAxis.Scale.Format = "MM-dd"; graphPane.YAxis.MajorGrid.IsVisible = true; graphPane.YAxis.MajorGrid.DashOff = 0; graphPane.YAxis.MajorGrid.Color = Color.Gray; graphPane.YAxis.MinorGrid.IsVisible = true; graphPane.YAxis.MinorGrid.Color = Color.LightGray; graphPane.YAxis.MinorGrid.DashOff = 0; graphPane.Title.Text = string.Format("[{0}] {1}", _roleName, StringDef.ExperienceCurve); graphPane.YAxis.Title.Text = StringDef.Exp; graphPane.AddCurve(StringDef.Exp, dateArray, expArray, Color.Red, SymbolType.None); } catch (Exception ex) { LabelOpMsg.Visible = true; LabelOpMsg.Text = ex.Message; ZedGraphWebExpStatistic.Visible = false; } }
void ExpByPlayTime(System.Drawing.Graphics g, ZedGraph.MasterPane masterPane) { try { GameServer server = ServerDropDownList.SelectedGameServer; if (server == null) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer); return; } //加入权限检查 if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.READ, Session)) { Response.Redirect(WebConfig.PageNotEnoughPrivilege, true); } if (!server.IsConnected) { LabelOpMsg.Text = StringDef.NoConnectionAlert; return; } List <int> playTimeList = new List <int>(); List <int> reachLevelList = new List <int>(); string baseCmdString = string.Format("SELECT LogKey2, LogKey6,LogTime FROM {0} WHERE {1}='{2}' AND {3}='{4}'", "{0}", FS2TableString.LogFieldLogEvent, LogEvent.PlayerUpgrade, FS2TableString.LogFieldLogKey1, _roleGuid); string addTableCmdString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, _start, _end, out addTableCmdString); if (addTableCmdString.Length == 0) { return; } string cmdString = string.Format("SELECT LogKey2,LogKey6 FROM ({0}) AS A ORDER BY LogTime ASC", addTableCmdString); SqlCommand cmd = new SqlCommand(cmdString); SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd); if (result != null && result.Success) { result.SetFieldType(new SqlDataType[] { SqlDataType.String, SqlDataType.Int32 }); object[] record = null; while ((record = result.ReadRecord()) != null) { reachLevelList.Add(int.Parse((string)record[0])); playTimeList.Add((Int32)record[1]); } } else { if (result == null) { LabelOpMsg.Text = StringDef.QueryTimeOut; } else { LabelOpMsg.Text = StringDef.OperationFail; } } int count = playTimeList.Count; double[] playTimeArray = new double[count + 1]; double[] reachLevelArray = new double[count + 1]; playTimeArray[0] = 0; reachLevelArray[0] = 1; for (int i = 0; i < count; i++) { playTimeArray[i + 1] = playTimeList[i] / 60; reachLevelArray[i + 1] = reachLevelList[i]; } GraphPane graphPane = masterPane[0]; graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor); graphPane.Legend.Fill.IsVisible = false; graphPane.Legend.Border.IsVisible = false; graphPane.Legend.FontSpec.Fill.IsVisible = false; graphPane.XAxis.Title.Text = string.Format("{0} [{1}]", StringDef.PlayedTime, StringDef.Minute); graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor; graphPane.XAxis.MinorTic.Size = 0; graphPane.XAxis.Scale.FontSpec.Size = 12; graphPane.YAxis.Title.Text = StringDef.Level; graphPane.YAxis.MajorGrid.IsVisible = true; graphPane.YAxis.MajorGrid.DashOff = 0; graphPane.YAxis.MajorGrid.Color = Color.Gray; graphPane.YAxis.MinorGrid.IsVisible = true; graphPane.YAxis.MinorGrid.Color = Color.LightGray; graphPane.YAxis.MinorGrid.DashOff = 0; graphPane.Title.Text = string.Format("[{0}] {1}", _roleName, StringDef.LevelCurve); graphPane.AddCurve(StringDef.Level, playTimeArray, reachLevelArray, Color.Red, SymbolType.None); } catch (Exception ex) { LabelOpMsg.Visible = true; LabelOpMsg.Text = ex.Message; ZedGraphWebExpStatistic.Visible = false; } }
void Query(int offset) { try { int serverId = ServerDropDownList.SelectedServerId; 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 tempParamList = new ArrayList(); ArrayList paramList = new ArrayList(); StringBuilder searchCondition = new StringBuilder(); searchCondition.Append(string.Format("WHERE LogEvent='{0}'", LogEvent.NpcDropStatistic)); string npcId = TextBoxNpcId.Text.Trim(); if (npcId.Length == 0) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.NpcID); return; } searchCondition.Append(string.Format(" AND {0}='{1}' ", FS2TableString.LogFieldLogKey1, npcId)); _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 LogKey2,SUM(LogKey6) AS SubSum FROM {0} {1} GROUP BY LogKey2", "{0}", searchCondition.ToString()); string addTableCmdString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, tempParamList, _start, _end, out addTableCmdString, out paramList); if (addTableCmdString.Length == 0) { return; } int limitCount = _recordPerPage; string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount); string cmdString = "SELECT LogKey2,SUM(SubSum) AS Total FROM ({0}) AS A GROUP BY LogKey2 ORDER BY Total DESC {1}"; SqlCommand cmd = new SqlCommand(string.Format(cmdString, addTableCmdString, limitStatement), paramList.ToArray()); SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd); if (result != null && result.Success) { result.SetFieldType(new SqlDataType[] { SqlDataType.String, SqlDataType.UInt32 }); object[] record = null; ArrayList infos = new ArrayList(); while ((record = result.ReadRecord()) != null) { NpcDropItem info = new NpcDropItem(); info.itemTemplateId = record[0] as string; info.num = (UInt32)record[1]; infos.Add(info); } //²éѯ×ÜÊý uint total = 0; string baseCmdTotalString = string.Format("SELECT SUM(LogKey6) AS SubSum FROM {0} {1}", "{0}", searchCondition.ToString()); string addTableCmdTotalString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdTotalString, _start, _end, out addTableCmdTotalString); if (addTableCmdTotalString.Length != 0) { string cmdTotalString = "SELECT SUM(SubSum) FROM ({0}) AS A"; SqlCommand sqlTotal = new SqlCommand(string.Format(cmdTotalString, addTableCmdTotalString), paramList.ToArray()); SqlResult sqlTotalResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, sqlTotal); if (sqlTotalResult != null && sqlTotalResult.Success) { sqlTotalResult.SetFieldType(new SqlDataType[] { SqlDataType.UInt32 }); record = sqlTotalResult.ReadRecord(); if (record != null && record[0] != null) { total = (uint)record[0]; } } } ViewState[WebConfig.SessionQueryLogOffset] = offset; ButtonPreviousPage.Enabled = (offset > 0); ButtonFirstPage.Enabled = (offset > 0); ButtonNextPage.Enabled = (infos.Count >= limitCount); if (infos.Count != 0) { PanelResult.Visible = true; CreateSearchResultList((NpcDropItem[])infos.ToArray(typeof(NpcDropItem)), total); LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name, server.Name, string.Empty, StringDef.NpcDropItem); } else { PanelResult.Visible = false; 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() { try { int serverId = ServerDropDownList.SelectedServerId; 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.Append(string.Format(" WHERE {0} = '{1}' ", FS2TableString.LogFieldLogEvent, LogEvent.TaiSuiStatistic)); string roleName = TextBoxRoleName.Text.Trim(); WebUtil.ValidateValueString(roleName); if (roleName.Length > 0) { string subTable = "(SELECT GUID FROM rolesfirst WHERE RoleName='?')"; searchCondition.Append(string.Format(" AND {0} IN {1} ", FS2TableString.LogFieldLogKey1, subTable)); paramList.Add(roleName); } string type = string.Empty; switch (RadioButtonListType.SelectedValue) { case "Day": type = "DATE(LogTime)"; break; case "Month": type = "DATE_FORMAT(LogTime,'%Y-%m')"; break; } _start = StartDate.SelectedDate; if (_start == DateTime.MinValue) { LabelOpMsg.Text = StringDef.ParameterInputError; return; } _end = EndDate.SelectedDate; if (_end == DateTime.MinValue) { LabelOpMsg.Text = StringDef.ParameterInputError; return; } if (_start >= _end) { LabelOpMsg.Text = StringDef.EndTimeError; return; } searchCondition.AppendFormat(" 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 {0},SUM(LogKey6) FROM {1} {2} GROUP BY {0}", type, "{0}", searchCondition.ToString()); string cmdString; WebUtil.AddTableNameToCmd(CurrentUser.Id, server, baseCmdString, paramList, _start, _end, out cmdString, out paramList); if (cmdString.Length == 0) { // return; } SqlCommand cmd = new SqlCommand(cmdString, paramList.ToArray()); SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd); if (result != null && result.Success) { result.SetFieldType(new SqlDataType[] { SqlDataType.DateTime, SqlDataType.Int32 }); object[] record = null; ArrayList infos = new ArrayList(); int total = 0; while ((record = result.ReadRecord()) != null) { TaiSuiUseInfo info = new TaiSuiUseInfo(); info.date = (DateTime)record[0]; info.num = (int)record[1]; total += info.num; infos.Add(info); } if (infos.Count != 0) { ZedGraphWebStatistic.Visible = true; PanelResult.Visible = true; _statInfo = (TaiSuiUseInfo[])infos.ToArray(typeof(TaiSuiUseInfo)); _totalCount = total; //CreateTableHead(); //CreateSearchResultList((TaiSuiUseInfo[])infos.ToArray(typeof(TaiSuiUseInfo)), total); LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name, server.Name, roleName.Length == 0 ? string.Empty : string.Format("[{0}]{1}", roleName, StringDef.Use), StringDef.TaiSui); } else { 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; } }