private void Window_Loaded(object sender, RoutedEventArgs e) { //setting variables int intCounter; int intNumberOfRecords; string strName; try { cboSelectEmployee.Items.Clear(); cboSelectEmployee.Items.Add("Select Employee"); TheFindTotalNonProductionProductivityOverDateRangeDataSet = TheNonProductionProductivityClass.FindTotalNonProductionProductivityOverDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate); intNumberOfRecords = TheFindTotalNonProductionProductivityOverDateRangeDataSet.FindTotalNonProducductionProductivityOverDateRange.Rows.Count; if (intNumberOfRecords < 1) { TheMessagesClass.InformationMessage("There Are No Transactions for this Date Range"); this.Close(); } for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { strName = TheFindTotalNonProductionProductivityOverDateRangeDataSet.FindTotalNonProducductionProductivityOverDateRange[intCounter].FirstName + " "; strName += TheFindTotalNonProductionProductivityOverDateRangeDataSet.FindTotalNonProducductionProductivityOverDateRange[intCounter].LastName; cboSelectEmployee.Items.Add(strName); } cboSelectEmployee.SelectedIndex = 0; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Detailed Non-Production Employee Productivity " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expCreateReport_Expanded(object sender, RoutedEventArgs e) { string strValueForValidation; string strErrorMessage = ""; bool blnFatalError = false; bool blnThereIsAProblem = false; int intCounter; int intNumberOfRecords; int intManagerID; string strManager; try { //clearing data set TheReportedNonProdcuctionProductivityDataSet.reportednonproductionproductivity.Rows.Clear(); expCreateReport.IsExpanded = false; strValueForValidation = txtStartDate.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Start Date is not a Date\n"; } else { MainWindow.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 { MainWindow.gdatEndDate = Convert.ToDateTime(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } else { blnFatalError = TheDataValidationClass.verifyDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("The Start Date is after the End Date"); return; } } TheFindTotalNonProductionProductivityOverDateRange = TheNonProductionProductivityClass.FindTotalNonProductionProductivityOverDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate); intNumberOfRecords = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange.Rows.Count; if (intNumberOfRecords > 0) { for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { intManagerID = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange[intCounter].ManagerID; TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intManagerID); strManager = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " "; strManager += TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName; ReportedNonProductionProductivityDataSet.reportednonproductionproductivityRow NewEmployeeRow = TheReportedNonProdcuctionProductivityDataSet.reportednonproductionproductivity.NewreportednonproductionproductivityRow(); NewEmployeeRow.Department = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange[intCounter].Department; NewEmployeeRow.FirstName = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange[intCounter].FirstName; NewEmployeeRow.HomeOffice = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange[intCounter].HomeOffice; NewEmployeeRow.LastName = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange[intCounter].LastName; NewEmployeeRow.Manager = strManager; NewEmployeeRow.TotalHours = TheFindTotalNonProductionProductivityOverDateRange.FindTotalNonProducductionProductivityOverDateRange[intCounter].TotalHours; TheReportedNonProdcuctionProductivityDataSet.reportednonproductionproductivity.Rows.Add(NewEmployeeRow); } } dgrEmployees.ItemsSource = TheReportedNonProdcuctionProductivityDataSet.reportednonproductionproductivity; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Non-Production Employee Productivity Report // Create Report Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }