Пример #1
0
        public FindServerEventLogForReportsByItemDataSet FindServerEventLogForReportsByItem(string strItemAccessed, DateTime datStartDate, DateTime datEndDate)
        {
            try
            {
                aFindServerEventLogForReportsByItemDataSet      = new FindServerEventLogForReportsByItemDataSet();
                aFindServerEventLogForReportsByItemTableAdapter = new FindServerEventLogForReportsByItemDataSetTableAdapters.FindServerEventLogForReportsByItemTableAdapter();
                aFindServerEventLogForReportsByItemTableAdapter.Fill(aFindServerEventLogForReportsByItemDataSet.FindServerEventLogForReportsByItem, strItemAccessed, datStartDate, datEndDate);
            }
            catch (Exception Ex)
            {
                InsertEventLogEntry(DateTime.Now, "Event Log Class // Find Server Event Log For Reports By Item " + Ex.Message);
            }

            return(aFindServerEventLogForReportsByItemDataSet);
        }
Пример #2
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            string   strKeyword = "";
            string   strValueForValidation;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strLogonName;
            string   strItemAccessed;
            string   strEventNotes;
            bool     blnFatalError   = false;
            string   strErrorMessage = "";
            int      intSecondCounter;
            bool     blnThereIsAProblem;

            try
            {
                TheEventLogSecurityDataSet.eventlogsecurity.Rows.Clear();

                //data validation
                if (cboReportType.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Report Type Was Not Chosen\n";
                }
                if (gintSelectedIndex > 1)
                {
                    strKeyword = txtEnterKeyWord.Text;
                    if (strKeyword.Length < 3)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Word Entered is not Long Enough\n";
                    }
                }
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                if (gintSelectedIndex == 1)
                {
                    TheFindServerEventLogForReportsbyDateRangeDataSet = TheEventLogClass.FindServerEventLogForReportsByDateRange(gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                        {
                            datTransactionDate = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange[intCounter].TransactionDate;
                            strItemAccessed    = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange[intCounter].ItemAccessed;
                            strLogonName       = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange[intCounter].LogonName;

                            EventlLogSecurityDataSet.eventlogsecurityRow NewEventRow = TheEventLogSecurityDataSet.eventlogsecurity.NeweventlogsecurityRow();

                            NewEventRow.ItemAccessed    = strItemAccessed;
                            NewEventRow.LogonName       = strLogonName;
                            NewEventRow.TransactionDate = datTransactionDate;

                            TheEventLogSecurityDataSet.eventlogsecurity.Rows.Add(NewEventRow);
                        }
                    }
                }
                else if (gintSelectedIndex == 2)
                {
                    TheFindServerEventLogForReportsByUserDataSet = TheEventLogClass.FindServerEventLogForReportsByUser(strKeyword, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindServerEventLogForReportsByUserDataSet.FindServerEventLogForReportsByUser.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                        {
                            datTransactionDate = TheFindServerEventLogForReportsByUserDataSet.FindServerEventLogForReportsByUser[intCounter].TransactionDate;
                            strItemAccessed    = TheFindServerEventLogForReportsByUserDataSet.FindServerEventLogForReportsByUser[intCounter].ItemAccessed;
                            strLogonName       = TheFindServerEventLogForReportsByUserDataSet.FindServerEventLogForReportsByUser[intCounter].LogonName;

                            EventlLogSecurityDataSet.eventlogsecurityRow NewEventRow = TheEventLogSecurityDataSet.eventlogsecurity.NeweventlogsecurityRow();

                            NewEventRow.ItemAccessed    = strItemAccessed;
                            NewEventRow.LogonName       = strLogonName;
                            NewEventRow.TransactionDate = datTransactionDate;

                            TheEventLogSecurityDataSet.eventlogsecurity.Rows.Add(NewEventRow);
                        }
                    }
                }
                else if (gintSelectedIndex == 3)
                {
                    TheFindServerEventLogForReportsByItemDataSet = TheEventLogClass.FindServerEventLogForReportsByItem(strKeyword, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindServerEventLogForReportsByItemDataSet.FindServerEventLogForReportsByItem.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                        {
                            datTransactionDate = TheFindServerEventLogForReportsByItemDataSet.FindServerEventLogForReportsByItem[intCounter].TransactionDate;
                            strItemAccessed    = TheFindServerEventLogForReportsByItemDataSet.FindServerEventLogForReportsByItem[intCounter].ItemAccessed;
                            strLogonName       = TheFindServerEventLogForReportsByItemDataSet.FindServerEventLogForReportsByItem[intCounter].LogonName;

                            EventlLogSecurityDataSet.eventlogsecurityRow NewEventRow = TheEventLogSecurityDataSet.eventlogsecurity.NeweventlogsecurityRow();

                            NewEventRow.ItemAccessed    = strItemAccessed;
                            NewEventRow.LogonName       = strLogonName;
                            NewEventRow.TransactionDate = datTransactionDate;

                            TheEventLogSecurityDataSet.eventlogsecurity.Rows.Add(NewEventRow);
                        }
                    }
                }


                dgrEventLog.ItemsSource = TheEventLogSecurityDataSet.eventlogsecurity;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Server Security Report // Search Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }