示例#1
0
        public LogIDPairEntity GetLogIDRangeByLogTime(DateTimeCompare timeEntity, string userName, string machineName)
        {
            string temporaryUserNameInput = TranslateWildcardForExceptionLog(userName);

            string temporaryMachineameInput = TranslateWildcardForExceptionLog(machineName);

            DbCommand command = Helper.BuildDbCommand("P_IC_LOGGING_EXCEPTION_LOG_ID_RANGE");
            Helper.AssignParameterValues(
                command,
                timeEntity.StartTime,
                timeEntity.EndTime,
                temporaryUserNameInput,
                temporaryMachineameInput
                );
            Helper.ExecuteScalar(command);

            long minLogID = (long)(Helper.GetParameterValue(command, "p_min_log_id"));
            long maxLogID = (long)(Helper.GetParameterValue(command, "p_max_log_id"));

            return new LogIDPairEntity(minLogID, maxLogID);
        }
示例#2
0
 public LoggingUsageDataSet RetrieveUsagesForOrganization(DateTimeCompare timeEntity, string organization)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_USAGE_BY_ORGANIZATION", timeEntity.StartTime, timeEntity.EndTime, organization);
     return usageDs;
 }
示例#3
0
 public LoggingUsageDataSet RetrieveUsagesForOffice(DateTimeCompare timeEntity, string office)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_USAGE_BY_OFFICE", timeEntity.StartTime, timeEntity.EndTime, office);
     return usageDs;
 }
示例#4
0
        private void ButtonSearchForCount_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                DisableValidationProvider();
                this.validationProvider7.Enabled = true;
                if (this.ValidateChildren())
                {
                    DateTimeCompare timeEntity = new DateTimeCompare(
                        DateTimeStartDateForCount.DateTime.Date, DateTimeEndDateForCount.DateTime.Date);

                    using (AsyncWorker<IUsageLogView> worker = new AsyncWorker<IUsageLogView>(_presenter, this.ultraChart7, new Control[] { ButtonSearchForCount }))
                    {
                        #region worker defini
                        worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                        {
                            var tempEntity = eDoWork.Argument as DateTimeCompare;
                            if (tempEntity == null)
                            {
                                return;
                            }
                            eDoWork.Result = _presenter.GetAllCountOfUsers(tempEntity);
                        };
                        worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                        {
                            LoggingUsageDataSet dataset = eCompleted.Result as LoggingUsageDataSet;
                            if (dataset != null && dataset.T_IC_LOGGING_USAGE.Rows.Count > 0)
                            {
                                int rowCount = dataset.T_IC_LOGGING_USAGE.Rows.Count - 1;
                                this.ultraChart7.Height = CHART_BASE_HEIGHT + rowCount * INCREMENT_FEED;
                                this.usageByUserCountExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT + rowCount * INCREMENT_FEED;
                                SetChartStype(this.ultraChart7, "USER_COUNT", dataset);
                                this.ultraChart7.DataSource = dataset.T_IC_LOGGING_USAGE.Select(
                                    data => new
                                    {
                                        emptyname = String.Empty,
                                        usercount = Convert.ToInt32(data["USER_COUNT"])
                                    }
                                    ).ToList();
                                this.ultraChart7.Visible = true;
                            }
                            else
                            {
                                this.ultraChart7.Visible = false;
                                this.usageByUserCountExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT - CHART_BASE_HEIGHT;
                            }
                        };
                        #endregion
                        worker.Run(timeEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ExceptionManager.Handle(ex))
                {
                    throw;
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#5
0
        private void PrepareShowExceptionList(DateTimeCompare timepair, string userName, string machineName)
        {
            string instanceID = TextBoxInstanceID.Text.Trim();

            if (!string.IsNullOrEmpty(instanceID))
            {
                using (AsyncWorkerByTrunk<IExceptionLogView> worker = new AsyncWorkerByTrunk<IExceptionLogView>(_presenter, this.GridViewExceptionLog, new Control[] { ButtonSearch, ButtonClear }, true))
                {
                    worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                    {
                        eDoWork.Result = _presenter.GetExceptionLog(
                                new LogIDPairEntity(),
                                null,
                                null,
                                null,
                                null,
                                null,
                                instanceID);
                    };
                    worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                    {
                        LoggingViewDataSet loggingViewData = eCompleted.Result as LoggingViewDataSet;
                        GridViewExceptionLog.DataSource = loggingViewData;
                        this.totalCount.Text = GridViewExceptionLog.Rows.Count.ToString();
                    };
                    worker.Run();
                }
            }
            else
            {
                using (AsyncWorkerByTrunk<IExceptionLogView> worker = new AsyncWorkerByTrunk<IExceptionLogView>(_presenter, this.GridViewExceptionLog, new Control[] { ButtonSearch, ButtonClear }, true))
                {
                    worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                    {
                        eDoWork.Result = _presenter.GetLogIDRangeByLogTime(timepair, userName, machineName);
                    };
                    worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                    {
                        LogIDPairEntity logIDPairEntity = eCompleted.Result as LogIDPairEntity;

                        GridViewExceptionLog.DataSource = new LoggingViewDataSet();
                        this.totalCount.Text = GridViewExceptionLog.Rows.Count.ToString();

                        if (logIDPairEntity != null && logIDPairEntity.MinLogID > 0)
                        {
                            // Step 1. Return Min LOG_ID and Max LOG_ID

                            totalMaxLogID = logIDPairEntity.MaxLogID;
                            this._ultraProgressBarForSearch.Value = 3;  // only prepare for loading data, initial progress is 3%

                            _presenter.OnUpdateProgressBar(ProgressBarStatus.OnProcess);
                            ProgressCounter++;
                            this.ButtonSearch.Text = "&Stop";
                            IsAsyncWorking = true;

                            // Step 2. Recursive loading data according to LOG_ID and LOG_ID
                            ShowExceptionLogList(
                                new LoggingViewDataSet(),
                                logIDPairEntity,
                                timepair,
                                TextBoxUseName.Text,
                                ComboxSeverity.Value.ToString(),
                                TextBoxMachineName.Text,
                                TextBoxLogContent.Text,
                                TextBoxInstanceID.Text.Trim());
                        }
                        else
                        {
                            this._ultraProgressBarForSearch.Visible = false;
                        }
                    };
                    worker.Run();
                }
            }
        }
示例#6
0
        private LogIDPairEntity GetIDRangeByLogTime(DateTimeCompare timeEntity, string spName)
        {
            DataTable dt = new DataTable();
            DbCommand command = Helper.BuildDbCommand(spName);
            Helper.AssignParameterValues(
                command,
                timeEntity.StartTime,
                timeEntity.EndTime
                );
            Helper.Fill(dt, command);

            long minLogID = (long)(Helper.GetParameterValue(command, "p_min_log_id"));
            long maxLogID = (long)(Helper.GetParameterValue(command, "p_max_log_id"));

            //LogIDPairEntity logIDPair = new LogIDPairEntity();
            //long logID;
            //if (dt.Rows.Count > 0 && dt.Rows.Count <= 1)
            //{
            //    logID = long.Parse(dt.Rows[0][0].ToString());
            //    logIDPair = new LogIDPairEntity(logID, logID);
            //}
            //if (dt.Rows.Count > 1)
            //{
            //    List<long> logIDCollection = new List<long>();
            //    foreach (DataRow row in dt.Rows)
            //    {
            //        logID = long.Parse(row[0].ToString());
            //        logIDCollection.Add(logID);
            //    }
            //    logIDPair = new LogIDPairEntity(logIDCollection.Min<long>(), logIDCollection.Max<long>());
            //}

            //return logIDPair;

            return new LogIDPairEntity(minLogID, maxLogID);
        }
示例#7
0
        public Int64[] GetIndexRange(DateTimeCompare timeEntity)
        {
            DbCommand cmd = _loggingDBHelper.BuildDbCommand(GetIndexRangeSP);
            _loggingDBHelper.AssignParameterValues(cmd,timeEntity.StartTime,timeEntity.EndTime);
            _loggingDBHelper.ExecuteNonQuery(cmd);

            object temp = _loggingDBHelper.GetParameterValue(cmd, "min");
            Int64 min = (temp==DBNull.Value)?0:(Int64)temp;

            temp = _loggingDBHelper.GetParameterValue(cmd, "max");
            Int64 max = (temp == DBNull.Value) ? 0 : (Int64)temp;

            return new [] { min,max};
        }
示例#8
0
 public LoggingUsageDataSet RetrieveUsagesForUsersCount(DateTimeCompare timeEntity)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_COUNT_BY_TIME", timeEntity.StartTime, timeEntity.EndTime);
     return usageDs;
 }
        private void PrepareShowInstrumentationList(DateTimeCompare timepair)
        {
            using (AsyncWorkerByTrunk<IInstrumentationView> worker = new AsyncWorkerByTrunk<IInstrumentationView>(_presenter, this.GridViewInstrumentation, new Control[] { ButtonSearch, ButtonClear }, true))
            {
                worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                {
                    eDoWork.Result = _presenter.GetLogIDRangeByLogTime(timepair);
                };
                worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                {
                    LogIDPairEntity logIDPairEntity = eCompleted.Result as LogIDPairEntity;

                    GridViewInstrumentation.DataSource = new LoggingViewDataSet();
                    this.totalCount.Text = GridViewInstrumentation.Rows.Count.ToString();

                    if (logIDPairEntity != null && logIDPairEntity.MinLogID > 0)
                    {
                        // Step 1. Return Min LOG_ID and Max LOG_ID

                        _presenter.OnUpdateProgressBar(ProgressBarStatus.OnProcess);
                        ProgressCounter++;
                        this.ButtonSearch.Text = "&Stop";
                        IsAsyncWorking = true;

                        // Step 2. Recursive loading data according to LOG_ID and LOG_ID
                        InstrumentationSearchCondition condition = new InstrumentationSearchCondition();
                        condition.UserName = TextBoxUserName.Text;
                        condition.IpAddress = TextBoxIpAddress.Text;
                        condition.ModuleId = TextBoxModuleId.Text;
                        condition.FunctionId = TextBoxFunctionId.Text;
                        condition.ComponentName = ComboxComponentName.Value.ToString();
                        condition.PCName = PCName.Text;
                        ShowInstrumentationLogList(
                            new LoggingViewDataSet(),
                            logIDPairEntity,timepair,
                            condition);
                    }
                };
                worker.Run();
            }
        }
示例#10
0
        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();
            }
        }
示例#11
0
        private void ButtonSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateChildren())
                {
                    this.Cursor = Cursors.WaitCursor;

                    switch (this.ButtonSearch.Text)
                    {
                        case "&Search":
                            // Step 1. Return Min LOG_ID and Max LOG_ID
                            DateTimeCompare timepair = new DateTimeCompare(DateTimeStartDate.DateTime, DateTimeEndDate.DateTime);
                            PrepareShowInstrumentationList(timepair);
                            this.GridViewInstrumentation.Focus();
                            break;
                        case "&Stop":
                            IsAsyncWorking = false;
                            this.ButtonSearch.Text = "&Search";
                            _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd);
                            ProgressCounter--;
                            break;
                    }

                }
            }
            catch (Exception ex)
            {
                _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd);
                if (ExceptionManager.Handle(ex)) throw;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        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;
            }
        }
示例#13
0
        private void ButtonSearchForUser_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                DisableValidationProvider();
                this.validationProvider1.Enabled = true;
                if (this.ValidateChildren())
                {
                    DateTimeCompare timeEntity = new DateTimeCompare(DateTimeStartDateForUser.DateTime.Date,
                        DateTimeEndDateForUser.DateTime.Date);
                    var argus = new object[] {timeEntity, TextBoxUserName.Text};

                    using (AsyncWorker<IUsageLogView> worker = new AsyncWorker<IUsageLogView>(_presenter, this.ultraChart1, new Control[] { ButtonSearchForUser }))
                    {
                        #region worker definition
                        worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                        {
                            var tempArgus = eDoWork.Argument as object[];

                            if (tempArgus==null || tempArgus.Length<=1)
                            {
                                return;
                            }
                            eDoWork.Result = _presenter.GetUsageForUserData(
                                tempArgus[0] as DateTimeCompare,tempArgus[1] as string );
                        };
                        worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                        {
                            LoggingUsageDataSet dataset = eCompleted.Result as LoggingUsageDataSet;
                            if (dataset != null && dataset.T_IC_LOGGING_USAGE.Rows.Count > 0)
                            {
                                int rowCount = dataset.T_IC_LOGGING_USAGE.Rows.Count - 1;
                                this.ultraChart1.Height = CHART_BASE_HEIGHT + rowCount * INCREMENT_FEED;
                                this.usageByUserExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT + rowCount * INCREMENT_FEED;
                                SetChartStype(this.ultraChart1, "FREQUENCY", dataset);
                                this.ultraChart1.DataSource = dataset.T_IC_LOGGING_USAGE.Select(
                                    data => new
                                    {
                                        username = data["USER_NAME"].ToString(),
                                        logintimes = Convert.ToInt32(data["FREQUENCY"])
                                    }
                                    ).ToList();
                                this.ultraChart1.Visible = true;
                            }
                            else
                            {
                                this.ultraChart1.Visible = false;
                                this.usageByUserExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT - CHART_BASE_HEIGHT;
                            }
                        };
                        #endregion
                        worker.Run(argus);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ExceptionManager.Handle(ex)) throw;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#14
0
 public LoggingUsageDataSet RetrieveUsagesForRole(DateTimeCompare timeEntity, string roleId)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_USAGE_BY_ROLE", timeEntity.StartTime, timeEntity.EndTime, roleId);
     return usageDs;
 }
示例#15
0
        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;
            }
        }
示例#16
0
 public LoggingUsageDataSet RetrieveUsagesForUser(DateTimeCompare timeEntity, string userName)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_USAGE_BY_USER", timeEntity.StartTime, timeEntity.EndTime, userName);
     return usageDs;
 }
示例#17
0
        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;
        }
示例#18
0
 public LoggingUsageDataSet RetrieveUsagesForUsersCountByModule(DateTimeCompare timeEntity, string moduleId)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_COUNT_BY_MODULE", timeEntity.StartTime, timeEntity.EndTime, moduleId);
     return usageDs;
 }
示例#19
0
 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;
 }
示例#20
0
 public LogIDPairEntity GetInstrumentationLogIDRangeByLogTime(DateTimeCompare timeEntity)
 {
     return GetIDRangeByLogTime(timeEntity, "P_IC_LOGGING_INSTRUMENTATION_LOG_ID_RANGE");
 }
示例#21
0
 public LoggingUsageDataSet RetrieveUsagesForFunction(DateTimeCompare timeEntity, string functionId)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_USAGE_BY_FUNCTION", timeEntity.StartTime, timeEntity.EndTime, functionId);
     return usageDs;
 }
示例#22
0
        private void ButtonSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateChildren())
                {
                    this.Cursor = Cursors.WaitCursor;

                    switch (this.ButtonSearch.Text)
                    {
                        case "&Search":
                            // Step 1. Return Min LOG_ID and Max LOG_ID
                            this._ultraProgressBarForSearch.Value = 0;
                            this._ultraProgressBarForSearch.Visible = false;  // Only open here.
                            DateTimeCompare timepair = new DateTimeCompare(DateTimeStartTime.DateTime, DateTimeEndTime.DateTime);
                            PrepareShowExceptionList(timepair,
                                TextBoxUseName.Text,
                            TextBoxMachineName.Text);
                            this.GridViewExceptionLog.Focus();
                            break;
                        case "&Stop":
                            IsAsyncWorking = false;
                            this.ButtonSearch.Text = "&Search";
                            _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd);
                            ProgressCounter--;
                            this._ultraProgressBarForSearch.Visible = false;
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd);
                if (ExceptionManager.Handle(ex)) throw;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#23
0
 public LoggingUsageDataSet RetrieveUsagesForGraphicArea(DateTimeCompare timeEntity, string geographicArea)
 {
     LoggingUsageDataSet usageDs = new LoggingUsageDataSet();
     Helper.Fill(usageDs.T_IC_LOGGING_USAGE, "dbo.P_IC_LOGGING_USAGE_BY_AREA", timeEntity.StartTime, timeEntity.EndTime, geographicArea);
     return usageDs;
 }
示例#24
0
        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();
            }
        }
示例#25
0
 public Int64[] GetIndexRange(DateTimeCompare timeEntity)
 {
     var da = InstanceBuilder.CreateInstance<AuditLogViewDA>();
     return da.GetIndexRange(timeEntity);
 }