private void txtJobNumber_GotFocus(object sender, RoutedEventArgs e) { int intRecordsReturned; try { gstrAssignedProjectID = txtAssignedProjectID.Text; TheFindProjectByAssignedProjectIDDataSet = TheProjectsClass.FindProjectByAssignedProjectID(gstrAssignedProjectID); intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("Project Does Not Exist"); txtAssignedProjectID.Focus(); return; } gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID; TheFindProductionProjectsByAssignedProjectIDDataSet = TheProductionProjectClass.FindProductionProjectsByAssignedProjectID(gstrAssignedProjectID); intRecordsReturned = TheFindProductionProjectsByAssignedProjectIDDataSet.FindProductionProjectByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("Project Needs to be Updated"); txtAssignedProjectID.Focus(); return; } TheFindPurchseRequestPRojectByProjectIDDataSet = ThePurchaseRequestProjectsClass.FindPurchaseRequestByProjectID(gintProjectID); intRecordsReturned = TheFindPurchseRequestPRojectByProjectIDDataSet.FindPurchaseRequestProjectByProjectID.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("There are Currently " + Convert.ToString(intRecordsReturned) + "Purchase Requests for this Project\nThe Last Job Number Has Been Entered in the Job Number Field"); txtJobNumber.Text = TheFindPurchseRequestPRojectByProjectIDDataSet.FindPurchaseRequestProjectByProjectID[intRecordsReturned - 1].JobNumber; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Purchase Request // Job Number Text Box Got Focus " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expProecess_Expanded(object sender, RoutedEventArgs e) { //setting local variables bool blnFatalError = false; bool blnThereIsAProblem = false; string strErrorMesssage = ""; string strAddress; string strCity; string strState; string strValueForValidation; DateTime datDateReceived = DateTime.Now; DateTime datECDDate = DateTime.Now; string strProjectNotes; string strAssignedProjectID = ""; string strProjectName = ""; string strCustomerProjectID = ""; DateTime datTransactionDate = DateTime.Now; int intEmployeeID; try { strCustomerProjectID = txtCustomerProjectID.Text; strAssignedProjectID = txtAssignedProjectID.Text; intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; if (gblnProjectExists == false) { if ((strAssignedProjectID.Length < 7) && (strAssignedProjectID.Length > 10)) { blnFatalError = true; strErrorMesssage += "The Assigned Project ID is not the Correct Format\n"; } } if (gblnProjectMatrixExists == false) { if (strCustomerProjectID.Length < 5) { blnFatalError = true; strErrorMesssage += "The Customer Project ID is not the Correct Format\n"; } else if (gintDepartmentID == 1009) { if ((strCustomerProjectID.Length < 6) && (strCustomerProjectID.Length > 7)) { blnFatalError = true; strErrorMesssage += "The Spectrum Project Length is not the Corret Length\n"; } } strProjectName = txtProjectName.Text; if (strProjectName.Length < 10) { blnFatalError = true; strErrorMesssage += "The Project Name is to Short\n"; } } expProecess.IsExpanded = false; if (cboSelectDepartment.SelectedIndex < 1) { blnFatalError = true; strErrorMesssage += "The Department was not Selected\n"; } strAddress = txtAddress.Text; if (strAddress.Length < 3) { blnFatalError = true; strErrorMesssage += "The Address Was Not Entered\n"; } strCity = txtCity.Text; if (strCity.Length < 3) { blnFatalError = true; strErrorMesssage += "The City is to Short\n"; } strState = txtState.Text; if (strState.Length != 2) { blnFatalError = true; strErrorMesssage += "The State is not the Correct Length\n"; } if (cboSelectManager.SelectedIndex < 1) { blnFatalError = true; strErrorMesssage += "The Manager Was Not Selected\n"; } if (cboSelectOffice.SelectedIndex < 1) { blnFatalError = true; strErrorMesssage += "The Office Was Not Selected\n"; } strValueForValidation = txtDateReceived.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMesssage += "The Date Received is not a Date\n"; } else { datDateReceived = Convert.ToDateTime(strValueForValidation); blnThereIsAProblem = TheDataValidationClass.verifyDateRange(datDateReceived, DateTime.Now); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMesssage += "The Date Received is after Today\n"; } } strValueForValidation = txtECDDate.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMesssage += "The ECD Date is not a Date\n"; } else { datECDDate = Convert.ToDateTime(strValueForValidation); blnThereIsAProblem = TheDataValidationClass.verifyDateRange(DateTime.Now, datECDDate); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMesssage += "The ECD Date is before today\n"; } } strProjectNotes = txtPRojectNotes.Text; if (strProjectNotes.Length < 1) { strProjectNotes = "PROJECT CREATED"; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMesssage); return; } if (gblnProjectExists == false) { blnFatalError = TheProjectClass.InsertProject(strCustomerProjectID, strProjectName); if (blnFatalError == true) { throw new Exception(); } TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strCustomerProjectID); gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID; blnFatalError = TheProductionProjectClass.InsertProdutionProject(gintProjectID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datDateReceived, datECDDate, gintStatusID, strProjectNotes); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductionProjectClass.InsertProductionProjectUpdate(gintProjectID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, DateTime.Now, strProjectNotes); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Project Number " + strAssignedProjectID + " Has Been Added"); if (blnFatalError == true) { throw new Exception(); } } if (gblnProjectMatrixExists == false) { blnFatalError = TheProjectMatrixClass.InsertProjectMatrix(gintProjectID, strAssignedProjectID, strCustomerProjectID, datTransactionDate, intEmployeeID, gintOfficeID, gintDepartmentID); if (blnFatalError == true) { throw new Exception(); } } if (gblnProjectExists == true) { TheFindProductionProjectByAssignedProjectIDDataSet = TheProductionProjectClass.FindProductionProjectsByAssignedProjectID(strCustomerProjectID); if (TheFindProductionProjectByAssignedProjectIDDataSet.FindProductionProjectByAssignedProjectID.Rows.Count < 1) { blnFatalError = TheProductionProjectClass.InsertProdutionProject(gintProjectID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datDateReceived, datECDDate, gintStatusID, strProjectNotes); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Project Number " + strAssignedProjectID + " Has Been Added"); if (blnFatalError == true) { throw new Exception(); } } else { TheFindProductionProjectByAssignedProjectIDDataSet = TheProductionProjectClass.FindProductionProjectsByAssignedProjectID(strAssignedProjectID); if (TheFindProductionProjectByAssignedProjectIDDataSet.FindProductionProjectByAssignedProjectID.Rows.Count < 1) { blnFatalError = TheProductionProjectClass.InsertProdutionProject(gintProjectID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datDateReceived, datECDDate, gintStatusID, strProjectNotes); if (blnFatalError == true) { throw new Exception(); } } } } TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID); MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; if (TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].BusinessLineID == 1009) { AddProductionProjectInfo AddProductionProjectInfo = new AddProductionProjectInfo(); AddProductionProjectInfo.ShowDialog(); } blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Project Number " + strAssignedProjectID + " Has Been Added"); if (blnFatalError == true) { throw new Exception(); } AddProjectDocumentation(); TheMessagesClass.InformationMessage("Project Has Been Entered"); TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID); MainWindow.gintTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID; blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatusDate(MainWindow.gintTransactionID, DateTime.Now); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project // Process Expander " + Ex.Message); TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project // Process Expander " + Ex.ToString()); TheMessagesClass.ErrorMessage(Ex.ToString()); } }