public void LoadDetailView(LoggingViewDataSet.T_IC_LOGGING_LOGRow row) { if (row == null) { return; } this.TextBoxOffice.Text = ConvertToString(row.OFFICE); this.TextBoxComponent.Text = ConvertToString(row.COMPONENT); this.TextBoxParameterValues.Text = ConvertToString(row.PARAMETER_VALUES); this.TextBoxIPAddress.Text = ConvertToString(row.IP_ADDRESS); this.TextBoxPCName.Text = ConvertToString(row.MACHINE_NAME); this.TextBoxModuleID.Text = ConvertToString(row.MODULE_ID); this.TextBoxFunctionID.Text = ConvertToString(row.FUNCTION_ID); this.TextBoxTime.Text = row.LOG_TIME.ToString(); this.TextBoxUserName.Text = ConvertToString(row.USER_NAME); this.TextBoxUserRoles.Text = ConvertToString(row.USER_ROLES); this.TextBoxMethodName.Text = ConvertToString(row.METHOD_NAME); this.TextBoxStartTicks.Text = ConvertToString(row.TRACING_START_TICKS); this.TextBoxEndTicks.Text = ConvertToString(row.TRACING_END_TICKS); this.TextBoxDuration.Text = ConvertToString(row.SECONDS_ELAPSED); }
private void ShowExceptionLogList( LoggingViewDataSet loggingViewData, LogIDPairEntity logIDPair, DateTimeCompare timeEntity, string userName, string severity, string machineName, string logContent, string instanceID) { using (AsyncWorkerByTrunk<IExceptionLogView> worker = new AsyncWorkerByTrunk<IExceptionLogView>(_presenter, this.GridViewExceptionLog, new Control[] { ButtonClear }, true)) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { eDoWork.Result = _presenter.GetExceptionLog( logIDPair, timeEntity, userName, severity, machineName, logContent, instanceID); Thread.Sleep(300); // default 300 }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { if (WorkItem.SmartParts[ViewId] == null || !IsAsyncWorking) { this.ButtonSearch.Text = "&Search"; return; } // ExceptionViewData exceptionViewData = eCompleted.Result as ExceptionViewData; LoggingViewDataSet LoggingViewData = eCompleted.Result as LoggingViewDataSet; if (LoggingViewData == null) LoggingViewData = new LoggingViewDataSet(); loggingViewData.Merge(LoggingViewData); GridViewExceptionLog.DataSource = loggingViewData; this.totalCount.Text = GridViewExceptionLog.Rows.Count.ToString(); string[] logIDPairArray = LoggingViewData.ExtendedProperties["LogIDPair"].ToString().Split(','); Int64 minLogID = Convert.ToInt64(logIDPairArray[0]); Int64 maxLogID = Convert.ToInt64(logIDPairArray[1]); double remain = maxLogID - minLogID; double total = totalMaxLogID - minLogID; double remains = (1 - remain / total) * 97 + 3; if (remains > 0 && remains <= 100) { this._ultraProgressBarForSearch.Value = Convert.ToInt32(remains); } if (minLogID <= maxLogID) { ShowExceptionLogList( loggingViewData, new LogIDPairEntity(minLogID, maxLogID), timeEntity, TextBoxUseName.Text, ComboxSeverity.Value.ToString(), TextBoxMachineName.Text, TextBoxLogContent.Text, TextBoxInstanceID.Text.Trim()); } else { IsAsyncWorking = false; this.ButtonSearch.Text = "&Search"; _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd); ProgressCounter--; this._ultraProgressBarForSearch.Value = 100; AsyncWaiting(500); } }; worker.Run(); } }
public LoggingViewDataSet RetrievePerformanceInformation(DateTimeCompare timeEntity, string functionId, string componentName, string userName) { LoggingViewDataSet logDs = new LoggingViewDataSet(); Helper.Fill(logDs.T_IC_PERFORMANCE_LOG, "dbo.P_IC_LOGGING_PERFORMANCE_S", timeEntity.StartTime, timeEntity.EndTime, functionId, componentName, userName); return logDs; }
public LoggingViewDataSet RetrieveInstrumentation(LogIDPairEntity logIDPair, DateTimeCompare timeEntity,string userName, string ipAddress, string moduleId, string functionId, string componentName, string category, string pcName) { long minLogID = logIDPair.MinLogID; long maxLogID = logIDPair.MaxLogID; long currentMinLogID = maxLogID - MaxRecords; LoggingViewDataSet logDs; LoggingViewDataSet logDsByFilter = new LoggingViewDataSet(); DbCommand command; int recordCount = 0; int computeCount = 0; while (recordCount == 0 && minLogID <= maxLogID && computeCount < MaxNullFounds) { command = Helper.BuildDbCommand("dbo.P_IC_LOGGING_INSTRUMENTATION_S"); command.CommandTimeout = 0; if (currentMinLogID < minLogID) { currentMinLogID = minLogID; } logDs = new LoggingViewDataSet(); Helper.AssignParameterValues(command, currentMinLogID, maxLogID); Helper.Fill(logDs.T_IC_LOGGING_LOG, command); var list = (from n in logDs.T_IC_LOGGING_LOG // ReSharper disable ConditionIsAlwaysTrueOrFalse where (string.IsNullOrEmpty(category) || n.CATEGORY_NAME.Equals(category)) && (string.IsNullOrEmpty(componentName) || n.COMPONENT.Equals(ConvertToString(componentName))) && (!string.IsNullOrEmpty(userName) ? SearchHelper.IsRegexMatch(ConvertToString(n.USER_NAME), userName, @"[\w|\W]*") : true) && (!string.IsNullOrEmpty(ipAddress) ? SearchHelper.IsRegexMatch(ConvertToString(n.IP_ADDRESS), ipAddress, @"[\w|\W]*") : true) && (!string.IsNullOrEmpty(moduleId) ? SearchHelper.IsRegexMatch(ConvertToString(n.MODULE_ID), moduleId, @"[\w|\W]*") : true) && (!string.IsNullOrEmpty(functionId) ? SearchHelper.IsRegexMatch(ConvertToString(n.FUNCTION_ID), functionId, @"[\w|\W]*") : true) && (!string.IsNullOrEmpty(pcName) ? SearchHelper.IsRegexMatch(ConvertToString(n.MACHINE_NAME), pcName, @"[\w|\W]*") : true) // ReSharper restore ConditionIsAlwaysTrueOrFalse && (timeEntity == null ? true : n.LOG_TIME <= timeEntity.EndTime) && (timeEntity == null ? true : n.LOG_TIME >= timeEntity.StartTime) select n); maxLogID = currentMinLogID - 1; currentMinLogID = maxLogID - MaxRecords; recordCount += list.Count(); computeCount += 1; foreach (var row in list) { logDsByFilter.T_IC_LOGGING_LOG.ImportRow(row); } logDs.Dispose(); } logDsByFilter.ExtendedProperties.Add("LogIDPair", minLogID.ToString() + "," + maxLogID.ToString()); logDsByFilter.AcceptChanges(); return logDsByFilter; }
public LoggingViewDataSet RetrieveExceptionLog(LogIDPairEntity logIDPair, DateTimeCompare timeEntity, string userName, string category, string severity, string machineName, string logContent, string instanceID) { const int MaxErrorLogNumber = 1000; if (!string.IsNullOrEmpty(instanceID)) { LoggingViewDataSet logDs = new LoggingViewDataSet(); DbCommand command; command = Helper.BuildDbCommand("dbo.P_IC_LOGGING_EXCEPTION_LOG_S_BY_ID"); Helper.AssignParameterValues(command, instanceID); Helper.Fill(logDs.T_IC_LOGGING_LOG, command); return logDs; } else { long minLogID = logIDPair.MinLogID; long maxLogID = logIDPair.MaxLogID; long currentMinLogID = maxLogID - MaxErrorLogNumber; LoggingViewDataSet logDs; LoggingViewDataSet logDsByFilter = new LoggingViewDataSet(); DbCommand command; int recordCount = 0; int computeCount = 0; string temporaryUserNameInput = TranslateWildcardForExceptionLog(userName); string temporaryMachineameInput = TranslateWildcardForExceptionLog(machineName); while (recordCount == 0 && minLogID <= maxLogID && computeCount < MaxNullFounds) { command = Helper.BuildDbCommand("dbo.P_IC_LOGGING_EXCEPTION_LOG_S"); command.CommandTimeout = 0; if (currentMinLogID < minLogID) { currentMinLogID = minLogID; } logDs = new LoggingViewDataSet(); Helper.AssignParameterValues(command, currentMinLogID, maxLogID, temporaryUserNameInput, temporaryMachineameInput); Helper.Fill(logDs.T_IC_LOGGING_LOG, command); var list = (from n in logDs.T_IC_LOGGING_LOG // ReSharper disable ConditionIsAlwaysTrueOrFalse where (string.IsNullOrEmpty(severity) || ConvertToString(n.SEVERITY).Equals(severity)) && (!string.IsNullOrEmpty(userName) ? SearchHelper.IsRegexMatch(ConvertToString(n.USER_NAME), userName, @"[\w|\W]*") : true) && (string.IsNullOrEmpty(category) || ConvertToString(n.CATEGORY_NAME).Equals(category)) && (!string.IsNullOrEmpty(machineName) ? SearchHelper.IsRegexMatch(ConvertToString(n.MACHINE_NAME), machineName, @"[\w|\W]*") : true) && (!string.IsNullOrEmpty(logContent) ? SearchHelper.IsRegexMatch(ConvertToString(n.FORMATTED_MESSAGE), logContent, @"[\w|\W]*") : true) && (string.IsNullOrEmpty(instanceID) || ConvertToString(n.INSTANCE_ID).Equals(instanceID)) && (timeEntity == null ? true : n.LOG_TIME <= timeEntity.EndTime) && (timeEntity == null ? true : n.LOG_TIME >= timeEntity.StartTime) // ReSharper restore ConditionIsAlwaysTrueOrFalse select n); maxLogID = currentMinLogID - 1; currentMinLogID = maxLogID - MaxErrorLogNumber; recordCount += list.Count(); computeCount += 1; foreach (var row in list) { logDsByFilter.T_IC_LOGGING_LOG.ImportRow(row); } logDs.Dispose(); } logDsByFilter.ExtendedProperties.Add("LogIDPair", minLogID.ToString() + "," + maxLogID.ToString()); logDsByFilter.AcceptChanges(); return logDsByFilter; } }
public LoggingViewDataSet GetLogsByID(string logId) { LoggingViewDataSet logDs = new LoggingViewDataSet(); Helper.Fill(logDs.T_IC_LOGGING_LOG, "dbo.P_IC_LOGGING_SEARCH_BY_ID", logId); return logDs; }
private void ShowInstrumentationLogList( LoggingViewDataSet loggingViewData, LogIDPairEntity logIDPair,DateTimeCompare timeEntity, InstrumentationSearchCondition condition) { using (AsyncWorkerByTrunk<IInstrumentationView> worker = new AsyncWorkerByTrunk<IInstrumentationView>(_presenter, this.GridViewInstrumentation, new Control[] { ButtonClear }, true)) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { eDoWork.Result = _presenter.GetInstrumentationData( logIDPair,timeEntity, condition); Thread.Sleep(300); // default 300 }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { if (WorkItem.SmartParts[ViewId] == null || !IsAsyncWorking) { this.ButtonSearch.Text = "&Search"; return; } // ExceptionViewData exceptionViewData = eCompleted.Result as ExceptionViewData; LoggingViewDataSet tempLoggingViewData = eCompleted.Result as LoggingViewDataSet; if (tempLoggingViewData == null) tempLoggingViewData = new LoggingViewDataSet(); loggingViewData.Merge(tempLoggingViewData); GridViewInstrumentation.DataSource = loggingViewData; this.totalCount.Text = GridViewInstrumentation.Rows.Count.ToString(); string[] logIDPairArray = tempLoggingViewData.ExtendedProperties["LogIDPair"].ToString().Split(','); Int64 minLogID = Convert.ToInt64(logIDPairArray[0]); Int64 maxLogID = Convert.ToInt64(logIDPairArray[1]); if (minLogID <= maxLogID) { ShowInstrumentationLogList( loggingViewData, new LogIDPairEntity(minLogID, maxLogID),timeEntity, condition); } else { IsAsyncWorking = false; this.ButtonSearch.Text = "&Search"; _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd); ProgressCounter--; AsyncWaiting(500); } }; worker.Run(); } }
private void ButtonSearch_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (this.ValidateChildren()) { // Initialize data grid LoggingViewData = new LoggingViewDataSet(); GridViewPerformance.DataSource = LoggingViewData.T_IC_PERFORMANCE_LOG; this.totalCount.Text = GridViewPerformance.Rows.Count.ToString(); this.GridViewPerformance.Focus(); DateTimeCompare timeEntity = new DateTimeCompare(DateTimeStartDate.DateTime, DateTimeEndDate.DateTime); var argus = new object[] { timeEntity, TextBoxFunctionId.Text, ComboxComponentName.Value.ToString(), this.TextBoxUserName.Text }; using (AsyncWorkerByTrunk<IPerformanceMonitoringView> worker = new AsyncWorkerByTrunk<IPerformanceMonitoringView>(_presenter, this.GridViewPerformance, new Control[] { ButtonSearch, ButtonClear })) { #region worker definition worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { var tempArgus = eDoWork.Argument as object[]; if (tempArgus==null || tempArgus.Length<=3) { return; } eDoWork.Result = _presenter.GetPerformanceData( tempArgus[0] as DateTimeCompare, tempArgus[1] as string, tempArgus[2] as string, tempArgus[3] as string); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { LoggingViewData = eCompleted.Result as LoggingViewDataSet; if (null==LoggingViewData) { LoggingViewData = new LoggingViewDataSet(); } GridViewPerformance.DataSource = LoggingViewData.T_IC_PERFORMANCE_LOG; this.totalCount.Text = GridViewPerformance.Rows.Count.ToString(); }; #endregion worker.Run(argus); } } } catch (Exception ex) { if (ExceptionManager.Handle(ex)) throw; } finally { this.Cursor = Cursors.Default; } }