Beispiel #1
0
 private void mitExit_Click(object sender, RoutedEventArgs e)
 {
     txtStartDate.Text = "";
     txtEndDate.Text   = "";
     TheFindToolProblemByDateRangeDataSet = TheToolProblemClass.FindToolProblemByDateRange(DateTime.Now, DateTime.Now);
     dgrToolProblems.ItemsSource          = TheFindToolProblemByDateRangeDataSet.FindToolProblemByDateRange;
     Visibility = Visibility.Hidden;
 }
Beispiel #2
0
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variales;
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;

            try
            {
                //doing data validation
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "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 += "End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }

                if (blnFatalError == true)
                {
                    TheMessageClass.ErrorMessage(strErrorMessage);
                    return;
                }
                else
                {
                    blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);
                    if (blnFatalError == true)
                    {
                        TheMessageClass.ErrorMessage("The Start Date is after the End Date");
                        return;
                    }
                }

                //getting ready to call the stored procedure
                gdatStartDate = TheDateSearchClass.RemoveTime(gdatStartDate);
                gdatEndDate   = TheDateSearchClass.RemoveTime(gdatEndDate);
                gdatEndDate   = TheDateSearchClass.AddingDays(gdatEndDate, 1);

                //running stored procedure
                TheFindToolProblemByDateRangeDataSet = TheToolProblemClass.FindToolProblemByDateRange(gdatStartDate, gdatEndDate);

                dgrToolProblems.ItemsSource = TheFindToolProblemByDateRangeDataSet.FindToolProblemByDateRange;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Broken Tool Report // Generate Report Menu Item " + Ex.Message);

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