private void mitProcess_Click(object sender, RoutedEventArgs e) { //setting local variables int intCounter; int intNumberOfRecords; bool blnFatalError = false; bool blnThereIsAProblem = false; DateTime datTransactionDate; int intEmployeeID; int intProjectID; int intWorkTaskID; decimal decTotalHours; int intFootagePieces; string strCrewID; string strErrorMessage = ""; try { mitRemoveTransactions.IsEnabled = true; mitRemoveEmployee.IsEnabled = false; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(txtTransactionDate.Text); if (blnFatalError == true) { strErrorMessage += "The Date is not a Date\n"; blnFatalError = true; } if (txtCrewID.Text == "") { strErrorMessage += "Crew ID Was Not Entered\n"; blnFatalError = true; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } datTransactionDate = Convert.ToDateTime(txtTransactionDate.Text); strCrewID = txtCrewID.Text; intNumberOfRecords = TheProjectWorkCompletedDataSet.workcompleted.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intEmployeeID = TheProjectWorkCompletedDataSet.workcompleted[intCounter].EmployeeID; intProjectID = TheProjectWorkCompletedDataSet.workcompleted[intCounter].ProjectID; intWorkTaskID = TheProjectWorkCompletedDataSet.workcompleted[intCounter].TaskID; decTotalHours = TheProjectWorkCompletedDataSet.workcompleted[intCounter].Hours; intFootagePieces = TheProjectWorkCompletedDataSet.workcompleted[intCounter].FootagePieces; //first insert blnFatalError = TheEmployeeProjectAssignmentClass.InsertEmployeeProjectAssignment(intEmployeeID, intProjectID, intWorkTaskID, datTransactionDate, decTotalHours); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProjectTaskClass.InsertProjectTask(intProjectID, intEmployeeID, intWorkTaskID, Convert.ToDecimal(intFootagePieces), datTransactionDate); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheEmployeeCrewAssignmentClass.InsertEmployeeCrewAssignment(strCrewID, intEmployeeID, intProjectID, datTransactionDate); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductivityDataEntryClass.UpdateProductivityDataEntryHoursTasks(gintDataEntryTransactionID, gintEmployeeCounter, gintTaskCounter); if (blnFatalError == true) { throw new Exception(); } } ResetForm(); TheMessagesClass.InformationMessage("The Project Information Has Been Saved"); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Enter Approved Transaction // Process Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expProcess_Expanded(object sender, RoutedEventArgs e) { //setting local variables int intCounter; int intNumberOfRecords; bool blnFatalError = false; bool blnThereIsAProblem = false; DateTime datTransactionDate; DateTime datTodaysDate = DateTime.Now; int intEmployeeID; int intProjectID; int intWorkTaskID; decimal decTotalHours; int intFootagePieces; string strErrorMessage = ""; try { btnResetTask.IsEnabled = true; btnResetEmployees.IsEnabled = false; expProcess.IsExpanded = false; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(txtEnterDate.Text); if (blnFatalError == true) { strErrorMessage += "The Date is not a Date\n"; blnFatalError = true; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } datTransactionDate = Convert.ToDateTime(txtEnterDate.Text); if (datTransactionDate > datTodaysDate) { TheMessagesClass.ErrorMessage("The Date Entered is in the Future"); return; } intNumberOfRecords = TheEmployeeWorkCompleteDataSet.workcompleted.Rows.Count; for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { intEmployeeID = TheEmployeeWorkCompleteDataSet.workcompleted[intCounter].EmployeeID; blnFatalError = TheEmployeeProjectAssignmentClass.InsertEmployeeProjectAssignment(intEmployeeID, MainWindow.gintProjectID, gintDriveTimeTaskID, datTransactionDate, gdecDriveTime); if (blnFatalError == true) { throw new Exception(); } if (gdecNonProductiveTime > 0) { blnFatalError = TheEmployeeProjectAssignmentClass.InsertEmployeeProjectAssignment(intEmployeeID, 104330, 1230, datTransactionDate, gdecNonProductiveTime); if (blnFatalError == true) { throw new Exception(); } } } intNumberOfRecords = TheProjectWorkCompletedDataSet.workcompleted.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intEmployeeID = TheProjectWorkCompletedDataSet.workcompleted[intCounter].EmployeeID; intProjectID = TheProjectWorkCompletedDataSet.workcompleted[intCounter].ProjectID; intWorkTaskID = TheProjectWorkCompletedDataSet.workcompleted[intCounter].TaskID; decTotalHours = TheProjectWorkCompletedDataSet.workcompleted[intCounter].Hours; intFootagePieces = TheProjectWorkCompletedDataSet.workcompleted[intCounter].FootagePieces; //first insert blnFatalError = TheEmployeeProjectAssignmentClass.InsertEmployeeProjectAssignment(intEmployeeID, intProjectID, intWorkTaskID, datTransactionDate, decTotalHours); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProjectTaskClass.InsertProjectTask(intProjectID, intEmployeeID, intWorkTaskID, Convert.ToDecimal(intFootagePieces), datTransactionDate); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheEmployeeCrewAssignmentClass.InsertEmployeeCrewAssignment(gstrCrewID, intEmployeeID, intProjectID, datTransactionDate); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductivityDataEntryClass.UpdateProductivityDataEntryHoursTasks(gintDataEntryTransactionID, gintEmployeeCounter, gintTaskCounter); if (blnFatalError == true) { throw new Exception(); } } blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "Blue Jay ERP // Add Project Labor // Project Labor Has Been Added " + txtEnterProjectID.Text); if (blnFatalError == true) { throw new Exception(); } ResetControls(); TheMessagesClass.InformationMessage("The Project Information Has Been Saved"); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project Labor // Process Expander " + Ex.Message); TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project Labor // Process Expander " + Ex.ToString()); TheMessagesClass.ErrorMessage(Ex.ToString()); } }