private void txtAssignedProjectID_TextChanged(object sender, TextChangedEventArgs e) { string strAssignedProjectID; int intLength; int intRecordsReturned; try { strAssignedProjectID = txtAssignedProjectID.Text; gstrAssignedProjectID = strAssignedProjectID; intLength = strAssignedProjectID.Length; if (((intLength > 5) && (intLength < 12)) && gblnDoNotRun == false) { TheFindProjectMatrxiByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { gintProjectID = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; gblnProjectExists = false; FillControls(); } else if (intLength > 7) { TheMessagesClass.ErrorMessage("Project Not Found, Please Add the Project"); return; } } else if (intLength >= 12) { TheMessagesClass.ErrorMessage("The Project is not the Correct Format"); return; } } catch (Exception Ex) { TheSendEmailClass.SendEventLog("New Blue Jay ERP // Edit Project // Assigned Project ID Text Box " + Ex.ToString()); TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Project // Assigned Project ID Text Box " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFindProduction_Click(object sender, RoutedEventArgs e) { string strProjectID; int intProjectID = 0; int intLength; int intRecordsReturned; try { strProjectID = txtEnterProjectID.Text; TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectmatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectmatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("Project Not Found"); return; } intProjectID = TheFindProjectmatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } else if (intRecordsReturned > 0) { intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } TheFindProductionCostsByProjectIDDataSet = TheEmployeeProjectAssignmentClass.FindProjectProductionCostsByProjectID(intProjectID); dgrProduction.ItemsSource = TheFindProductionCostsByProjectIDDataSet.FindProjectProductionCostsByProjectID; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Project Management Report // Find Production Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void mitCheckProject_Click(object sender, RoutedEventArgs e) { string strProjectID; int intRecordsReturned; if (gblnProjectFound == false) { strProjectID = txtEnterProjectID.Text; TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned == 0) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered"); return; } else { MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } } else { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID); MainWindow.gstrAssignedProjectID = strProjectID; txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; } }
private void btnProcess_Click(object sender, RoutedEventArgs e) { bool blnThereIsAProblem = false; bool blnFatalError = false; string strErrorMessage = ""; string strProjectID; string strPartNumber; string strPONumber; string strAssignedReelID; int intReelFootage = 0; int intRecordsReturned; string strValueForValidation; DateTime datTransactionDate = DateTime.Now; int intPartID = 0; int intTransactionID; int intTotalFootage; try { blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Cable Reel "); if (blnFatalError == true) { throw new Exception(); } if (cboSelectWarehouse.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Warehouse Was Not Selected\n"; } strProjectID = txtProjectID.Text; if (strProjectID.Length < 3) { blnFatalError = true; strErrorMessage += "The Project ID is not Long Enough\n"; } else { TheFindProjectMatrixByCustomerIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Project ID Was Not Found\n"; } } else if (intRecordsReturned > 0) { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } } strPartNumber = txtPartNumber.Text; if (strPartNumber.Length < 3) { blnFatalError = true; strErrorMessage += "The Part Number is not Long Enough\n"; } else { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Part Number Was Not Found\n"; } else if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } } if (cboSelectEmployee.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Employee Was Not Selected\n"; } strPONumber = txtPONumber.Text; if (strPONumber.Length < 3) { blnFatalError = true; strErrorMessage += "The MSR/PO Number is not Long Enough\n"; } strAssignedReelID = txtAssignedReelID.Text; if (strAssignedReelID.Length < 3) { blnFatalError = true; strErrorMessage += "The Assigned Reel ID is not Long Enough\n"; } else { TheFindCableReelIDByAssignedCableReelIDDataSet = TheCableInventoryClass.FindCableReelIDByAssignedCableReelID(strAssignedReelID); intRecordsReturned = TheFindCableReelIDByAssignedCableReelIDDataSet.FindCableReelIDByAssignedCableReelID.Rows.Count; if (intRecordsReturned > 0) { blnFatalError = true; strErrorMessage += "The Assigned Reel ID has been Used\n"; } } strValueForValidation = txtReelFootage.Text; blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Reel Footage is not an Integer\n"; } else { intReelFootage = Convert.ToInt32(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } //adding cable reel if (gblnReelIDChecked == true) { blnFatalError = TheCableInventoryClass.UpdateCableAssignedReelID(gintReelID, strAssignedReelID); if (blnFatalError == true) { throw new Exception(); } } else if (gblnReelIDChecked == false) { blnFatalError = TheCableInventoryClass.InsertCableReelID(datTransactionDate, intPartID, MainWindow.gintEmployeeID, strAssignedReelID); if (blnFatalError == true) { throw new Exception(); } } TheFindCableReelIDByAssignedCableReelIDDataSet = TheCableInventoryClass.FindCableReelIDByAssignedCableReelID(strAssignedReelID); gintReelID = TheFindCableReelIDByAssignedCableReelIDDataSet.FindCableReelIDByAssignedCableReelID[0].CableReelID; //inserting the reel into the table blnFatalError = TheCableInventoryClass.InsertCableReelInventory(intPartID, MainWindow.gintWarehouseID, strAssignedReelID, intReelFootage); if (blnFatalError == true) { throw new Exception(); } //updating total footage TheFindCableTotalInventoryByPartWarehouseDataSet = TheCableInventoryClass.FindCableTotalInventoryByPartWarehouse(MainWindow.gintWarehouseID, intPartID); intRecordsReturned = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse.Rows.Count; if (intRecordsReturned > 0) { intTransactionID = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse[0].TransactionID; intTotalFootage = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse[0].TotalFootage; intTotalFootage = intTotalFootage + intReelFootage; blnFatalError = TheCableInventoryClass.UpdateCableIventoryTotalFootage(intTransactionID, intTotalFootage); if (blnFatalError == true) { throw new Exception(); } } else if (intRecordsReturned < 1) { blnFatalError = TheCableInventoryClass.InsertCableTotalInventory(intPartID, MainWindow.gintWarehouseID, intReelFootage); if (blnFatalError == true) { throw new Exception(); } } TheMessagesClass.InformationMessage("Cable Reel Has Been Received"); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Cable Reel // Process Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnMainProcess_Click(object sender, RoutedEventArgs e) { //this will insert into the table string strValueForValidation = ""; string strErrorMessage = ""; bool blnFatalError = false; bool blnThereIsAProblem = false; string strAssignedProjectID; string strVehicleNumber; DateTime datTransactionDate = DateTime.Now; int intRecordsReturned; DateTime datInspectionDate = DateTime.Now; int intCounter; int intNumberOfRecords; int intEmployeeID; try { strAssignedProjectID = txtAssignedProjectID.Text; if (strAssignedProjectID == "") { blnFatalError = true; strErrorMessage += "The Project Was Not Entered\n"; } else { TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } else if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Project Was Not Found\n"; } } else { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } } if (cboSelectEmployee.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Employee Was Not Selected\n"; } if (cboSelectDepartment.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Department Was Not Selected\n"; } strVehicleNumber = txtVehicleNumber.Text; if (strVehicleNumber == "") { blnFatalError = true; strErrorMessage += "Vehicle Number Was Not Entered\n"; } else { TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber); intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Vehicle Number Was Not Found\n"; } else { MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID; } } strValueForValidation = txtInspectionDate.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnFatalError == true) { blnFatalError = true; strErrorMessage += "The Inspection Date is not a Date\n"; } else { datInspectionDate = Convert.ToDateTime(strValueForValidation); blnThereIsAProblem = TheDataValidationClass.verifyDateRange(datInspectionDate, DateTime.Now); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Inspection is after Today\n"; } } if (cboSelectManager.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Manager Was Not Selected\n"; } if (cboSelectInspector.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Inspector Was Not Selected\n"; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } MainWindow.gdatInspectionDate = datInspectionDate; intNumberOfRecords = TheJSIEmployeeAssignedDataSet.jsiemployeeassigned.Rows.Count - 1; if (intNumberOfRecords < 0) { TheMessagesClass.ErrorMessage("No Employees Were Added"); return; } MainWindow.gintEmployeeID = TheJSIEmployeeAssignedDataSet.jsiemployeeassigned[0].EmployeeID; blnFatalError = TheJSIMainClass.InsertIntoJSIMain(datTransactionDate, MainWindow.gintProjectID, MainWindow.gintEmployeeID, MainWindow.gintDepartmentID, MainWindow.gintVehicleID, datInspectionDate, MainWindow.gintManagerID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, MainWindow.gintInspectingEmployeeID); if (blnFatalError == true) { throw new Exception(); } TheFindJSIMainByDateMatchDataSet = TheJSIMainClass.FindJSIMainByDateMatch(datTransactionDate); MainWindow.gintJSITransationID = TheFindJSIMainByDateMatchDataSet.FindJSIMainByDateMatch[0].JSITransactionID; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { blnFatalError = TheJSIMainClass.InsertJSIEmployee(MainWindow.gintJSITransationID, TheJSIEmployeeAssignedDataSet.jsiemployeeassigned[intCounter].EmployeeID, datTransactionDate); if (blnFatalError == true) { throw new Exception(); } } blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create JSI Entry // JSI Created"); if (blnFatalError == true) { throw new Exception(); } JSIPPEWindow JSIPPEWindow = new JSIPPEWindow(); JSIPPEWindow.ShowDialog(); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create JSI Entry // Main Process Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void txtLastName_TextChanged(object sender, TextChangedEventArgs e) { //setting up local variables int intCounter; int intNumberOfRecords; int intLength; string strLastName; string strAssignedProjectID; int intRecordsReturned; DateTime datStartDate = DateTime.Now; try { strLastName = txtLastName.Text; intLength = strLastName.Length; datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 365); if (intLength > 2) { //getting the project id strAssignedProjectID = txtAssignedProjectID.Text; TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } else if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("The Assigned Project ID Does Not Exist"); return; } } else { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } cboSelectEmployee.Items.Clear(); cboSelectEmployee.Items.Add("Select Employee"); TheFindEmployeesForDataEntryForLastYearDataSet = TheEmployeeClass.FindEmployeesForDataEntryForLastYear(datStartDate, strLastName); intNumberOfRecords = TheFindEmployeesForDataEntryForLastYearDataSet.FindEmployeesForDataEntryForLastYear.Rows.Count - 1; if (intNumberOfRecords < 0) { TheMessagesClass.ErrorMessage("The Employee Was Not Found"); cboSelectEmployee.SelectedIndex = 0; return; } for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { cboSelectEmployee.Items.Add(TheFindEmployeesForDataEntryForLastYearDataSet.FindEmployeesForDataEntryForLastYear[intCounter].FullName); } cboSelectEmployee.SelectedIndex = 0; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create JSI Entry // Last Name Text Change " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expAddEmployee_Expanded(object sender, RoutedEventArgs e) { string strValueForValidation; string strErrorMessage = ""; bool blnFatalError = false; bool blnThereIsAProblem = false; DateTime datWorkDate = DateTime.Now; string strOutTime; string strProjectID; string strWorkLocation; string strInETA; int intRecordsReturned; int intCounter; int intNumberOfRecords; int intEmployeeID; int intManagerID; string strLastName; string strFirstName; try { expAddEmployee.IsExpanded = false; //beginning data validation if (cboSelectOffice.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Office was not Selected\n"; } if (cboSelectDepartment.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Department was not Selected\n"; } if (TheAfterWorkEmployeesDataSet.afterhoursemployees.Rows.Count < 1) { blnFatalError = true; strErrorMessage += "The Employees were not Added\n"; } if (gblnVehicleFound == false) { blnFatalError = true; strErrorMessage += "The Vehicle was not Added\n"; } strValueForValidation = txtWorkDate.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Date is not a Date\n"; } else { datWorkDate = Convert.ToDateTime(strValueForValidation); } strOutTime = txtOutTime.Text; blnThereIsAProblem = TheDataValidationClass.VerifyTime(strOutTime); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Out Time is not a Time\n"; } strProjectID = txtProjectID.Text; if (strProjectID == "") { blnFatalError = true; strErrorMessage += "The Project ID was not Entered\n"; } else { TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned == 0) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Project Was Not Entered\n"; } else { MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } } else { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } } strWorkLocation = txtWorkLocation.Text; if (strWorkLocation == "") { blnFatalError = true; strErrorMessage += "The Work Location Was Not Entered\n"; } strInETA = txtInETA.Text; blnThereIsAProblem = TheDataValidationClass.VerifyTime(strInETA); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The ETA Time In is not a Time\n"; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } intNumberOfRecords = TheAfterWorkEmployeesDataSet.afterhoursemployees.Rows.Count - 1; intManagerID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intEmployeeID = TheAfterWorkEmployeesDataSet.afterhoursemployees[intCounter].EmployeeID; strFirstName = TheAfterWorkEmployeesDataSet.afterhoursemployees[intCounter].FirstName; strLastName = TheAfterWorkEmployeesDataSet.afterhoursemployees[intCounter].LastName; SubmitAfterHoursWorkDataSet.submitafterhoursworkRow NewWorkRow = TheSubmitAfterHoursWorkDataSet.submitafterhourswork.NewsubmitafterhoursworkRow(); NewWorkRow.DataEntryDate = DateTime.Now; NewWorkRow.DepartmentID = MainWindow.gintDepartmentID; NewWorkRow.EmployeeID = intEmployeeID; NewWorkRow.InETA = strInETA; NewWorkRow.ManagerID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; NewWorkRow.OutTime = strOutTime; NewWorkRow.ProjectID = MainWindow.gintProjectID; NewWorkRow.VehicleID = MainWindow.gintVehicleID; NewWorkRow.WarehouseID = MainWindow.gintWarehouseID; NewWorkRow.WorkDate = datWorkDate; NewWorkRow.WorkLocation = strWorkLocation; TheSubmitAfterHoursWorkDataSet.submitafterhourswork.Rows.Add(NewWorkRow); EmployeesAssignedDataSet.employeesassignedRow NewEmployeeRow = TheEmployeeAssignedDataSet.employeesassigned.NewemployeesassignedRow(); NewEmployeeRow.FirstName = strFirstName; NewEmployeeRow.LastName = strLastName; NewEmployeeRow.ProjectID = strProjectID; NewEmployeeRow.VehicleNumber = MainWindow.gstrVehicleNumber; NewEmployeeRow.WorkDate = datWorkDate; NewEmployeeRow.WorkLocation = strWorkLocation; TheEmployeeAssignedDataSet.employeesassigned.Rows.Add(NewEmployeeRow); } ResetControls(); dgrAssignedEmployees.ItemsSource = TheEmployeeAssignedDataSet.employeesassigned; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Submit After Hours Work // Submit Form Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void CheckProject() { //setting local variables string strProjectID; int intRecordsReturned; DateTime datTransactionDate = DateTime.Now; DateTime datTodaysDate = DateTime.Now; bool blnFatalError = false; int intEmployeeID; decimal decHours; DateTime datEndDate; int intHours; int intRemainder; try { datEndDate = TheDateSearchClass.SubtractingDays(datTodaysDate, 21); blnFatalError = TheDataValidationClass.VerifyDateData(txtEnterDate.Text); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("The Date Entered is not a Date"); return; } else { datTransactionDate = Convert.ToDateTime(txtEnterDate.Text); } if (datTransactionDate > datTodaysDate) { TheMessagesClass.ErrorMessage("The Date Entered is in the Future"); return; } blnFatalError = TheDataValidationClass.VerifyDoubleData(txtEnterHours.Text); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("Total Hours is not Numeric"); return; } if (gblnProjectFound == false) { strProjectID = txtEnterProjectID.Text; TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned == 0) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered"); return; } else { MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } } else { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } if (MainWindow.gintProjectID == 104330) { TheMessagesClass.ErrorMessage("You do not have to Enter the Project Shop. Place the hours for Non-Productive Time in the Non-Prod Time Box"); gblnProjectFound = false; return; } TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID); MainWindow.gstrAssignedProjectID = strProjectID; txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; gblnProjectFound = true; intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; decHours = Convert.ToDecimal(txtEnterHours.Text); intHours = Convert.ToInt32(decHours * 100); intRemainder = intHours % 25; if (intRemainder > 0) { TheMessagesClass.ErrorMessage("The Hours Inputted are not a .25, .5, .75. .00. The Transaction is Rejected"); return; } blnFatalError = TheProductivityDataEntryClass.InsertProductivityDataEntry(intEmployeeID, MainWindow.gintProjectID, datTodaysDate, decHours, 0, 0); if (blnFatalError == true) { throw new Exception(); } TheFindProductivityDataEntryByDateDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByDate(datTodaysDate); gintDataEntryTransactionID = TheFindProductivityDataEntryByDateDataSet.FindProductivtyDataEntryByDate[0].TransactionID; gintEmployeeCounter = 0; gintTaskCounter = 0; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project Labor // Check Project " + Ex.Message); TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project Labor // Check Project " + Ex.ToString()); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expFindItems_Expanded(object sender, RoutedEventArgs e) { bool blnThereIsAProblem = false; bool blnFatalError = false; string strErrorMessage = ""; string strValueForValidation; string strProjectID; DateTime datTransactionDate = DateTime.Now; int intRecordsReturned; int intProjectID = 0; int intCounter; int intNumberForRecords; try { expFindItems.IsExpanded = false; TheDriveTimeForVoidingDataSet.drivetimeforvoiding.Rows.Clear(); if (cboSelectEmployee.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Employee Has Not Been Selected\n"; } strProjectID = txtProjectID.Text; if (strProjectID.Length < 4) { blnFatalError = true; strErrorMessage += "The Project ID Is Not Long Enough\n"; } else { TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned > 0) { intProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } else if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } else if (intRecordsReturned < 1) { strErrorMessage += "The Project Was Not Found\n"; } } } strValueForValidation = txtDate.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Date Entered is not a Date\n"; } else { datTransactionDate = Convert.ToDateTime(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } TheFindDriveTimeForVoidingDataSet = TheEmployeeProjectAssignmentClass.FindDriveTimeForVoiding(datTransactionDate, MainWindow.gintEmployeeID, intProjectID); intNumberForRecords = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding.Rows.Count; if (intNumberForRecords > 0) { for (intCounter = 0; intCounter < intNumberForRecords; intCounter++) { DriveTimeForVoidingDataSet.drivetimeforvoidingRow NewDriveTime = TheDriveTimeForVoidingDataSet.drivetimeforvoiding.NewdrivetimeforvoidingRow(); NewDriveTime.FirstName = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].FirstName; NewDriveTime.LastName = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].LastName; NewDriveTime.ProjectID = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].CustomerAssignedID; NewDriveTime.TransactionDate = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].TransactionDate; NewDriveTime.TransactionID = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].TransactionID; NewDriveTime.VoidTransactions = false; NewDriveTime.WorkTask = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].WorkTask; TheDriveTimeForVoidingDataSet.drivetimeforvoiding.Rows.Add(NewDriveTime); } } dgrResults.ItemsSource = TheDriveTimeForVoidingDataSet.drivetimeforvoiding; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Void Drive Time // Find Items Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { //setting up data string strAssignedProjectID = ""; string strCustomerProjectID = ""; int intRecordsReturned; int intProjectID = 0; int intNumberOfRecords; int intCounter; try { strCustomerProjectID = txtProjectNumber.Text; if (strCustomerProjectID.Length < 4) { TheMessagesClass.ErrorMessage("The Project ID is not Long Enough"); return; } TheMaterialIssuedDataSet.materialissued.Rows.Clear(); //getting the data TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { strAssignedProjectID = strCustomerProjectID; TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("Project Was Not Found"); return; } else if (intRecordsReturned > 0) { intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; strCustomerProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID; } } else if (intRecordsReturned > 0) { intProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; strAssignedProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].CustomerAssignedID; } TheFindIssuedPartsByProjectIDDataSet = TheIssuedPartsClass.FindIssuedPartsByProjectID(intProjectID); intNumberOfRecords = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID.Rows.Count; if (intNumberOfRecords > 0) { for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { MaterialIssuedDataSet.materialissuedRow NewTransactionRow = TheMaterialIssuedDataSet.materialissued.NewmaterialissuedRow(); NewTransactionRow.AssignedProjectID = strAssignedProjectID; NewTransactionRow.CustomerProjectID = strCustomerProjectID; NewTransactionRow.PartID = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].PartID; NewTransactionRow.PartNumber = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].PartNumber; NewTransactionRow.Quantity = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].Quantity; NewTransactionRow.TransactionDate = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].TransactionDate; NewTransactionRow.TransactionID = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].TransactionID; NewTransactionRow.VoidTransaction = false; NewTransactionRow.WarehouseID = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].WarehouseID; TheMaterialIssuedDataSet.materialissued.Rows.Add(NewTransactionRow); } MainWindow.gintProjectID = intProjectID; MainWindow.gstrAssignedProjectID = strAssignedProjectID; } dgrTransactions.ItemsSource = TheMaterialIssuedDataSet.materialissued; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Void Inventory Transaction // Search Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFind_Click(object sender, RoutedEventArgs e) { string strCustomerProjectID; string strAssignedProjectID = ""; string strProjectName; string strProjectUpdates = ""; int intRecordsReturned; int intCounter; int intNumberOfRecords; int intStatusID; string strProjectNotes; bool blnFatalError = false; try { //getting project id strCustomerProjectID = txtEnterProjectID.Text; if (strCustomerProjectID.Length < 1) { TheMessageClass.ErrorMessage("The Project Information Was Not Entered"); return; } TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned > 1) { TheMessageClass.ErrorMessage("The Project Has Been Entered More Than Once, Contact Admin"); return; } else if (intRecordsReturned < 1) { strAssignedProjectID = strCustomerProjectID; TheFindProjectMatrxiByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned == 0) { TheMessageClass.ErrorMessage("Project Not Found"); return; } else if (intRecordsReturned > 1) { TheMessageClass.InformationMessage("There are Multiple Projects with this Project ID, Please use the Customer Assigned ID"); return; } else if (intRecordsReturned == 1) { MainWindow.gintProjectID = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; strCustomerProjectID = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID; } } else if (intRecordsReturned == 1) { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; strAssignedProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].AssignedProjectID; } TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(MainWindow.gintProjectID); TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID); strProjectName = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; strProjectNotes = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes; intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID; ClearRadioButtons(); if (intStatusID == 1001) { rdoOpen.IsChecked = true; } else if (intStatusID == 1002) { rdoConComplete.IsChecked = true; } else if (intStatusID == 1003) { rdoOnHold.IsChecked = true; } else if (intStatusID == 1004) { rdoCancel.IsChecked = true; } else if (intStatusID == 1005) { rdoInProcess.IsChecked = true; } else if (intStatusID == 1006) { rdoClosed.IsChecked = true; } else if (intStatusID == 1007) { rdoInvoiced.IsChecked = true; } else if (intStatusID == 1008) { rdoSubmitted.IsChecked = true; } txtAssignedProjectID.Text = strAssignedProjectID; txtCustomerProjectID.Text = strCustomerProjectID; txtProjectName.Text = strProjectName; txtProjectNotes.Text = strProjectNotes; TheFindProductionProjectUpdateByProjectIDDataSet = TheProductionProjectUpdatesClass.FindProductionProjectUpdateByProjectID(MainWindow.gintProjectID); intNumberOfRecords = TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID.Rows.Count; if (intNumberOfRecords > 0) { for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { strProjectUpdates += Convert.ToString(TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID[intCounter].TransactionDate) + " - "; strProjectUpdates += TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID[intCounter].ProjectUpdate + "\n\n"; } } txtProjectUpdates.Text = strProjectUpdates; TheFindProductionProjectInfoDataSet = TheProductionProjectClass.FindProductionProjectInfo(MainWindow.gintProjectID); intRecordsReturned = TheFindProductionProjectInfoDataSet.FindProductionProjectInfo.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = TheProductionProjectClass.InsertProductionProjectInfo(MainWindow.gintProjectID, 0, " ", " ", 0); if (blnFatalError == true) { throw new Exception(); } } else if (intRecordsReturned > 0) { if (TheFindProductionProjectInfoDataSet.FindProductionProjectInfo[0].HardRestoration == true) { chkHardRestoration.IsChecked = true; } else { chkHardRestoration.IsEnabled = false; } if (TheFindProductionProjectInfoDataSet.FindProductionProjectInfo[0].QCPerformed == true) { chkQCPerformed.IsChecked = true; } else { chkQCPerformed.IsChecked = false; } if (TheFindProductionProjectInfoDataSet.FindProductionProjectInfo[0].SplicingComple == true) { chkSplicingComplete.IsChecked = true; } else { chkSplicingComplete.IsChecked = false; } } expViewDocuments.IsEnabled = true; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Update Project // Find Button " + Ex.Message); TheMessageClass.ErrorMessage(Ex.ToString()); } }
private void txtEnterLastLame_TextChanged(object sender, TextChangedEventArgs e) { //setting local variables string strProjectID; int intRecordsReturned; string strLastName; int intLength; int intCounter; int intNumberOfRecords; DateTime datTransactionDate = DateTime.Now; DateTime datTodaysDate = DateTime.Now; bool blnFatalError = false; int intEmployeeID; decimal decHours; DateTime datEndDate; try { datEndDate = TheDateSearchClass.SubtractingDays(datTodaysDate, 21); blnFatalError = TheDataValidationClass.VerifyDateData(txtTransactionDate.Text); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("The Date Entered is not a Date"); return; } else { datTransactionDate = Convert.ToDateTime(txtTransactionDate.Text); } if (datTransactionDate > datTodaysDate) { TheMessagesClass.ErrorMessage("The Date Entered is in the Future"); return; } if (gblnProjectFound == false) { strProjectID = txtEnterProjectID.Text; TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned == 0) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered"); return; } else { MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; } } else { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID); MainWindow.gstrAssignedProjectID = strProjectID; txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; gblnProjectFound = true; intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; decHours = Convert.ToDecimal(txtEnterHours.Text); blnFatalError = TheProductivityDataEntryClass.InsertProductivityDataEntry(intEmployeeID, MainWindow.gintProjectID, datTodaysDate, decHours, 0, 0); if (blnFatalError == true) { throw new Exception(); } TheFindProductivityDataEntryByDateDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByDate(datTodaysDate); gintDataEntryTransactionID = TheFindProductivityDataEntryByDateDataSet.FindProductivtyDataEntryByDate[0].TransactionID; gintEmployeeCounter = 0; gintTaskCounter = 0; } strLastName = txtEnterLastLame.Text; intLength = strLastName.Length; if (intLength > 2) { cboSelectEmployee.Items.Clear(); cboSelectEmployee.Items.Add("Select Employee"); TheFindEmployeeByLastNameEndDateDataSet = TheEmployeeClass.FindEmployeeByLastNameEndDate(strLastName, datEndDate); intNumberOfRecords = TheFindEmployeeByLastNameEndDateDataSet.FindEmployeesByLastNameEndDate.Rows.Count - 1; if (intNumberOfRecords == -1) { TheMessagesClass.InformationMessage("Employee Not Found"); return; } else { for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { cboSelectEmployee.Items.Add(TheFindEmployeeByLastNameEndDateDataSet.FindEmployeesByLastNameEndDate[intCounter].FirstName + " " + TheFindEmployeeByLastNameEndDateDataSet.FindEmployeesByLastNameEndDate[intCounter].LastName); } } cboSelectEmployee.SelectedIndex = 0; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Project Labor // Enter Last Name Text Change Event " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void ResetControls() { //setting up the local variables int intCounter; int intNumberOfRecords; int intProjectID; DateTime datTransactionDate = DateTime.Now; DateTime datStartDate = DateTime.Now; decimal decAveragePayRate; try { PleaseWait PleaseWait = new PleaseWait(); PleaseWait.Show(); TheShopViolatorDataSet.violator.Rows.Clear(); datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate); datTransactionDate = TheDateSearchClass.SubtractingDays(datTransactionDate, 31); TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID("SHOP"); intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID; datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 31); TheFindProjectStatsDataSet = TheEmployeeProductivityStatsClass.FindProjectStats(intProjectID); gdecMean = TheFindProjectStatsDataSet.FindProjectStats[0].AveHours; gdecStandDeviation = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursSTDev); gdecVariance = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursVariance); gdecTotalHours = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours); decAveragePayRate = TheFindProjectStatsDataSet.FindProjectStats[0].AveragePayRate; gdecMean = Math.Round(gdecMean, 4); txtAverageHours.Text = Convert.ToString(gdecMean); gdecVariance = Math.Round(gdecVariance, 4); gdecStandDeviation = Math.Round(gdecStandDeviation, 4); gdecUpperBound = gdecMean + gdecStandDeviation; txtUpperBound.Text = Convert.ToString(gdecUpperBound); TheFindProjectHoursAboveLimitDataSet = TheEmployeeProjectAssignmentClass.FindProjectHoursAboveLimit(intProjectID, datStartDate, gdecUpperBound); intNumberOfRecords = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit.Rows.Count; if (intNumberOfRecords > 0) { for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { ShopViolatorDataSet.violatorRow NewViolatorRow = TheShopViolatorDataSet.violator.NewviolatorRow(); NewViolatorRow.FirstName = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].FirstName; NewViolatorRow.HomeOffice = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].HomeOffice; NewViolatorRow.Hours = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].TotalHours; NewViolatorRow.LastName = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].LastName; NewViolatorRow.TransactionDate = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].TransactionDate; TheShopViolatorDataSet.violator.Rows.Add(NewViolatorRow); } } dgrResults.ItemsSource = TheShopViolatorDataSet.violator; gdecProjectHours = TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours; txtShopHours.Text = Convert.ToString(gdecProjectHours); gdecProjectCost = gdecProjectHours * decAveragePayRate; gdecProjectCost = Math.Round(gdecProjectCost, 4); txtProjectCost.Text = Convert.ToString(gdecProjectCost); PleaseWait.Close(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Shop Hours Analysis // Reset Controls " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void ResetControls() { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID("EAT ME"); dgrProduction.ItemsSource = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID; }
private void btnFind_Click(object sender, RoutedEventArgs e) { string strAssignedProjectID; int intRecordsReturned; decimal decTotalCost = 0; decimal decTotalHours = 0; int intCounter; int intNumberOfRecords; double douTotalCost; try { strAssignedProjectID = txtAssignedProjectID.Text; if (strAssignedProjectID == "") { TheMessagesClass.ErrorMessage("The Assigned Project ID Was Not Entered"); return; } TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("The Project Was Not Found"); return; } else { strAssignedProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID; } } TheFindProjectTaskCostsDataSet = TheProjectCostingClass.FindProjectTasksCosts(strAssignedProjectID); intNumberOfRecords = TheFindProjectTaskCostsDataSet.FindProjectTaskCosts.Rows.Count - 1; if (intNumberOfRecords > -1) { for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { decTotalCost += TheFindProjectTaskCostsDataSet.FindProjectTaskCosts[intCounter].LaborCost; decTotalHours += TheFindProjectTaskCostsDataSet.FindProjectTaskCosts[intCounter].TotalHours; } } dgrResults.ItemsSource = TheFindProjectTaskCostsDataSet.FindProjectTaskCosts; douTotalCost = Convert.ToDouble(decTotalCost); decTotalCost = Convert.ToDecimal(Math.Round(douTotalCost, 2)); txtTotalCost.Text = Convert.ToString(decTotalCost); txtTotalHours.Text = Convert.ToString(decTotalHours); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Employee Project Labor Report // Find Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }