private void btnProcessUpdate_Click(object sender, RoutedEventArgs e) { bool blnFatalError = false; string strProjectUpdate = ""; int intTransactionID; string strAssignedProjectID; try { strProjectUpdate = txtUpdateNotes.Text; if (strProjectUpdate.Length < 15) { TheMessagesClass.ErrorMessage("The Update is not Long Enough"); return; } TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(MainWindow.gintProjectID); intTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID; strAssignedProjectID = txtCustomerProjectID.Text; blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatus(intTransactionID, gintStatusID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductionProjectUpdatesClass.InsertProductionProjectUpdate(MainWindow.gintProjectID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, strProjectUpdate); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Project Has Been Updated"); blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Updates Project " + strAssignedProjectID); if (blnFatalError == true) { throw new Exception(); } this.Close(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Update Selected Project // Process Update Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expProcess_Expanded(object sender, RoutedEventArgs e) { string strCustomerProjectID; string strAssignedProjectID; string strProjectName; string strAddress; string strCity; string strState; DateTime datECDDate = DateTime.Now; string strProjectNotes; bool blnThereIsAProblem = false; bool blnFatalError = false; string strErrorMessage = ""; int intRecordsReturned; string strValueForValidation; int intTransactionID = 0; string strCurrentProjectNotes = ""; try { expProcess.IsExpanded = false; strCustomerProjectID = txtCustomerProjectID.Text; if (strCustomerProjectID.Length < 3) { blnFatalError = true; strErrorMessage += "The Customer Project ID was not Found\n"; } else { TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Customer Project ID Was not Found\n"; } else if (intRecordsReturned > 0) { gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; intTransactionID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].TransactionID; } } strAssignedProjectID = txtAssignedProjectID.Text; if (strAssignedProjectID.Length < 7) { blnFatalError = true; strErrorMessage += "The Assigned Project ID Was not Entered\n"; } strProjectName = txtProjectName.Text; if (strProjectName.Length < 10) { blnFatalError = true; strErrorMessage += "The Project Name was not Long Enough\n"; } if (cboSelectDepartment.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Department Was Not Selected\n"; } strAddress = txtAddress.Text; if (strAddress.Length < 5) { blnFatalError = true; strErrorMessage += "The Address is not Long Enough\n"; } strCity = txtCity.Text; if (strCity.Length < 3) { blnFatalError = true; strErrorMessage += "The City was not Entered\n"; } strState = txtState.Text; if (strState.Length < 2) { blnFatalError = true; strErrorMessage += "The State was not Entered\n"; } if (cboSelectManager.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Manager Was Not Selected\n"; } if (cboSelectOffice.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Office Was Not Selected\n"; } strValueForValidation = txtECDDate.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDateData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The ECD Date is not a Date\n"; } else { datECDDate = Convert.ToDateTime(strValueForValidation); } strProjectNotes = txtPRojectNotes.Text; if (strProjectNotes.Length < 10) { blnFatalError = true; strErrorMessage += "The Project Notes are not Long Enough\n"; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } strCurrentProjectNotes = txtPRojectNotes.Text; blnFatalError = TheProjectMatrixClass.UpdateProjectMatrixAssignedProjectID(intTransactionID, strAssignedProjectID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProjectMatrixClass.UpdateProjectMatrixItems(intTransactionID, gintOfficeID, gintDepartmentID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProjectClass.UpdateProjectProject(gintProjectID, strCustomerProjectID, strProjectName); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatus(gintTransactionID, gintStatusID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatusDate(gintTransactionID, DateTime.Now); if (blnFatalError == true) { throw new Exception(); } TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID); intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count; if (intRecordsReturned < 1) { throw new Exception(); } intTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID; blnFatalError = TheProductionProjectClass.UpdateProductionProject(intTransactionID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datECDDate, strCurrentProjectNotes); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProductionProjectsUpdatesClass.InsertProductionProjectUpdate(gintProjectID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, strProjectNotes); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Project Has Been Updated"); ResetControls(); } catch (Exception Ex) { TheSendEmailClass.SendEventLog("New Blue Jay ERP // Edit Project // Process Expander " + Ex.ToString()); TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Projects // Proces Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void FillControls() { //setting up local variables int intCounter; int intNumberOfRecords; int intDepartmentID; int intManagerID; int intOfficeID; int intStatusID; int intSelectedIndex = 0; int intRecordsReturned; try { TheFindProjectMatrixByProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByProjectID(gintProjectID); TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(gintProjectID); TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID); intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("The Project Is Not Completely Entered, Please Go To Add Project"); return; } gintTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID; gblnDoNotRun = true; if (gblnProjectExists == true) { txtAssignedProjectID.Text = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].AssignedProjectID; } if (gblnProjectExists == false) { txtCustomerProjectID.Text = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID; } txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; txtAddress.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessAddress; txtCity.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].City; txtDateReceived.Text = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].DateReceived); txtECDDate.Text = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ECDDate); txtState.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessState; intManagerID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectManagerID; intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID; intDepartmentID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].DepartmentID; intOfficeID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].WarehouseID; //loading comboboxes intNumberOfRecords = TheFindProductionManagersDataSet.FindProductionManagers.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intManagerID == TheFindProductionManagersDataSet.FindProductionManagers[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; } } cboSelectManager.SelectedIndex = intSelectedIndex; intNumberOfRecords = TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intDepartmentID == TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines[intCounter].DepartmentID) { intSelectedIndex = intCounter + 1; } } cboSelectDepartment.SelectedIndex = intSelectedIndex; intNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intOfficeID == TheFindWarehousesDataSet.FindWarehouses[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; } } cboSelectOffice.SelectedIndex = intSelectedIndex; //setting up the buttons 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; } const string message = "Would You Like to Edit the Project Info?"; const string caption = "Please Answer"; MessageBoxResult result = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { MainWindow.gintProjectID = gintProjectID; EditProductionProjectInfo EditProductionProjectInfo = new EditProductionProjectInfo(); EditProductionProjectInfo.ShowDialog(); } expAddEditProjectInfo.IsEnabled = true; } catch (Exception Ex) { TheSendEmailClass.SendEventLog("New Blue Jay ERP // Edit Project // Fill Controls " + Ex.ToString()); TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Projects // Fill Controls " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { int intCounter; int intNumberOfRecords; string strUpdate = ""; int intStatusID; try { TheFindProjectMatrixByProjectProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByProjectID(MainWindow.gintProjectID); TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID); TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(MainWindow.gintProjectID); txtAssignedProjectID.Text = TheFindProjectMatrixByProjectProjectIDDataSet.FindProjectMatrixByProjectID[0].AssignedProjectID; txtCustomerProjectID.Text = TheFindProjectMatrixByProjectProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID; txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID; txtProjectNotes.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes; TheFindProductionProjectUpdateByProjectIDDataSet = TheProductionProjectUpdatesClass.FindProductionProjectUpdateByProjectID(MainWindow.gintProjectID); intNumberOfRecords = TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID.Rows.Count; if (intNumberOfRecords > 0) { for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { strUpdate += Convert.ToString(TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID[intCounter].TransactionDate) + " - "; strUpdate += TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID[intCounter].ProjectUpdate + "\n\n"; } } txtProjectUpdates.Text = strUpdate; 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; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Update Selected Project // Window Loaded Method " + 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 txtAssignedProjectID_TextChanged(object sender, TextChangedEventArgs e) { string strAssignedProjectID; int intLength; int intRecordsReturned; string strCustomerID; int intCounter; int intNumberOfRecords; int intDepartmentID; int intOfficeID; int intStatusID; int intManagerID; int intSelectedIndex = 0; try { strAssignedProjectID = txtAssignedProjectID.Text; intLength = strAssignedProjectID.Length; gblnProjectExists = false; gblnProjectMatrixExists = false; if (intLength > 7) { TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { if (strAssignedProjectID.Contains("003") == false) { if (strAssignedProjectID.Contains("004") == false) { if (strAssignedProjectID.Contains("086") == false) { if (strAssignedProjectID.Contains("920") == false) { if (strAssignedProjectID.Contains("921") == false) { gblnProjectExists = true; txtProjectName.Text = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName; gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID; TheFindProjectMatrixByProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByProjectID(gintProjectID); intRecordsReturned = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID.Rows.Count; if (intRecordsReturned > 0) { strCustomerID = txtCustomerProjectID.Text; if (strCustomerID != "") { if (strCustomerID != TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID) { TheMessagesClass.ErrorMessage("The Assigned Project ID is Assigned to Another CustomerID\nContact IT"); return; } gblnProjectMatrixExists = true; intDepartmentID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].DepartmentID; intOfficeID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].WarehouseID; //setting up combo boxes intNumberOfRecords = TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intDepartmentID == TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines[intCounter].DepartmentID) { intSelectedIndex = intCounter + 1; } } cboSelectDepartment.SelectedIndex = intSelectedIndex; intNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intOfficeID == TheFindWarehousesDataSet.FindWarehouses[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; } } cboSelectOffice.SelectedIndex = intSelectedIndex; TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID); intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.InformationMessage("The Project Has Been Entered, but Missing Some Information"); return; } SetControlsReadOnly(true); txtAddress.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessAddress; txtCity.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].City; txtDateReceived.Text = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].DateReceived); txtECDDate.Text = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ECDDate); txtPRojectNotes.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes; intManagerID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectManagerID; intNumberOfRecords = TheFindProductionManagersDataSet.FindProductionManagers.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intManagerID == TheFindProductionManagersDataSet.FindProductionManagers[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; } } cboSelectManager.SelectedIndex = intSelectedIndex; intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID; intNumberOfRecords = TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intSelectedIndex == TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].StatusID) { intSelectedIndex = intCounter + 1; } } cboSelectStatus.SelectedIndex = intSelectedIndex; TheMessagesClass.InformationMessage("The Project Is Already Entered"); } else if (txtCustomerProjectID.Text == "") { txtCustomerProjectID.Text = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID; } } } } } } } } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project // Assigned Project ID Text Box " + Ex.Message); TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project // Assigned Project ID Text Box " + Ex.ToString()); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void txtCustomerProjectID_TextChanged(object sender, TextChangedEventArgs e) { string strCustomerProjectID; int intLength; int intCounter; int intNumberOfRecords; int intRecordsReturned; int intManagerID; int intDepartmentID; int intOfficeID; int intSelectedIndex = 0; int intStatusID; string strCustomerIDProjectID; string strAssignedProjectID; try { strCustomerProjectID = txtCustomerProjectID.Text; intLength = strCustomerProjectID.Length; //ClearDateEntryControls(); if (intLength > 3) { TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strCustomerProjectID); intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { gblnProjectExists = false; } else if (intRecordsReturned > 0) { txtAssignedProjectID.Text = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].AssignedProjectID; } } else { gblnProjectExists = true; gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID; TheFindDesignProjectsbyAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(strCustomerProjectID); intRecordsReturned = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { txtAddress.Text = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectAddress; txtCity.Text = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].City; txtProjectName.Text = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName; txtDateReceived.Text = Convert.ToString(TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].DateReceived); intOfficeID = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].OfficeID; intNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intOfficeID == TheFindWarehousesDataSet.FindWarehouses[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; cboSelectOffice.SelectedIndex = intSelectedIndex; } } } TheFindProjectMatrixByProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByProjectID(gintProjectID); intRecordsReturned = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID.Rows.Count; if (intRecordsReturned < 1) { gblnProjectMatrixExists = false; cboSelectStatus.IsEnabled = true; intNumberOfRecords = TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { cboSelectStatus.Items.Add(TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].WorkOrderStatus); if (TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].WorkOrderStatus == "OPEN") { intSelectedIndex = intCounter + 1; } } cboSelectStatus.SelectedIndex = intSelectedIndex; cboSelectStatus.IsEnabled = false; } else { gblnProjectMatrixExists = true; strCustomerIDProjectID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID; strAssignedProjectID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].AssignedProjectID; txtAssignedProjectID.Text = strAssignedProjectID; TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID); intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindDesignProjectsbyAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(strCustomerIDProjectID); intRecordsReturned = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID.Rows.Count; if (intRecordsReturned > 0) { txtAddress.Text = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectAddress; txtCity.Text = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].City; } TheMessagesClass.InformationMessage("The Project Has Been Entered, but is Missing Some Information"); SetControlsReadOnly(false); } else if (intRecordsReturned > 0) { SetControlsReadOnly(true); txtAddress.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessAddress; txtCity.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].City; txtDateReceived.Text = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].DateReceived); txtECDDate.Text = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ECDDate); TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(gintProjectID); txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName; txtPRojectNotes.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes; txtState.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessState; //setting the combo boxes; intNumberOfRecords = TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted.Rows.Count - 1; intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intStatusID == TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].StatusID) { intSelectedIndex = intCounter + 1; } } cboSelectStatus.SelectedIndex = intSelectedIndex; intManagerID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectManagerID; intNumberOfRecords = TheFindProductionManagersDataSet.FindProductionManagers.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intManagerID == TheFindProductionManagersDataSet.FindProductionManagers[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; } } cboSelectManager.SelectedIndex = intSelectedIndex; intDepartmentID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].DepartmentID; intNumberOfRecords = TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intDepartmentID == TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines[intCounter].DepartmentID) { intSelectedIndex = intCounter + 1; } } cboSelectDepartment.SelectedIndex = intSelectedIndex; intOfficeID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].WarehouseID; intNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (intOfficeID == TheFindWarehousesDataSet.FindWarehouses[intCounter].EmployeeID) { intSelectedIndex = intCounter + 1; } } cboSelectOffice.SelectedIndex = intSelectedIndex; TheMessagesClass.InformationMessage("The Project Has Been Entered"); } } } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project // Customer Project ID Text Box " + Ex.Message); TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project // Customer Project ID Text Box " + Ex.ToString()); 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()); } }