public FindProjectTasksForFootageDataSet FindProjectTasksForFootage(int intWorkTaskID, DateTime datStartDate, DateTime datEndDate) { try { aFindProjectTasksForFootageDataSet = new FindProjectTasksForFootageDataSet(); aFindProjectTasksForFootageTableAdapter = new FindProjectTasksForFootageDataSetTableAdapters.FindProjectTasksForFootageTableAdapter(); aFindProjectTasksForFootageTableAdapter.Fill(aFindProjectTasksForFootageDataSet.FindProjectTasksForFootage, intWorkTaskID, datStartDate, datEndDate); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Project Task Class // Find Project Tasks For Footage " + Ex.Message); } return(aFindProjectTasksForFootageDataSet); }
private void MitGenerateReport_Click(object sender, RoutedEventArgs e) { //setting local variables string strValueForValidation; string strErrorMessage = ""; bool blnThereIsAProblem = false; bool blnFatalError = false; int intTaskCounter; int intTaskNumberOfRecords; int intProjectTaskCounter; int intProjectTaskNumberOfRecords; decimal decTotalFootages; int intWorkTaskID; string strWorkTask; PleaseWait PleaseWait = new PleaseWait(); PleaseWait.Show(); try { 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; } } TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Clear(); if (gblnAllTasks == true) { TheFindSortedWorkTaskDataSet = TheWorkTaskClass.FindSortedWorkTask(); intTaskNumberOfRecords = TheFindSortedWorkTaskDataSet.FindSortedWorkTask.Rows.Count - 1; for (intTaskCounter = 0; intTaskCounter <= intTaskNumberOfRecords; intTaskCounter++) { intWorkTaskID = TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intTaskCounter].WorkTaskID; strWorkTask = TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intTaskCounter].WorkTask; TheFindProjectTasksForFootageDataSet = TheProjectTaskClass.FindProjectTasksForFootage(intWorkTaskID, MainWindow.gdatStartDate, MainWindow.gdatEndDate); intProjectTaskNumberOfRecords = TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage.Rows.Count - 1; if (intProjectTaskNumberOfRecords > -1) { decTotalFootages = 0; for (intProjectTaskCounter = 0; intProjectTaskCounter <= intProjectTaskNumberOfRecords; intProjectTaskCounter++) { decTotalFootages += TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage[intProjectTaskCounter].FootagePieces; } ProjectTaskTotalsDataSet.projecttasktotalsRow NewTaskRow = TheProjectTaskTotalsDataSet.projecttasktotals.NewprojecttasktotalsRow(); NewTaskRow.WorkTaskID = intWorkTaskID; NewTaskRow.WorkTask = strWorkTask; NewTaskRow.FootagePieces = decTotalFootages; TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Add(NewTaskRow); } } } else if (gblnAllTasks == false) { TheFindProjectTasksForFootageDataSet = TheProjectTaskClass.FindProjectTasksForFootage(MainWindow.gintWorkTaskID, MainWindow.gdatStartDate, MainWindow.gdatEndDate); intProjectTaskNumberOfRecords = TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage.Rows.Count - 1; if (intProjectTaskNumberOfRecords > -1) { decTotalFootages = 0; for (intProjectTaskCounter = 0; intProjectTaskCounter <= intProjectTaskNumberOfRecords; intProjectTaskCounter++) { decTotalFootages += TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage[intProjectTaskCounter].FootagePieces; } ProjectTaskTotalsDataSet.projecttasktotalsRow NewTaskRow = TheProjectTaskTotalsDataSet.projecttasktotals.NewprojecttasktotalsRow(); NewTaskRow.WorkTaskID = MainWindow.gintWorkTaskID; NewTaskRow.WorkTask = MainWindow.gstrWorkTask; NewTaskRow.FootagePieces = decTotalFootages; TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Add(NewTaskRow); } } dgrResults.ItemsSource = TheProjectTaskTotalsDataSet.projecttasktotals; PleaseWait.Close(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // View Work Task Footages // Generate Report Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }