private void expAddEditProjectInfo_Expanded(object sender, RoutedEventArgs e) { int intRecordsReturned; expAddEditProjectInfo.IsExpanded = false; MainWindow.gintProjectID = gintProjectID; TheFindProductionProjectInfoDataSet = TheProductionProjectClass.FindProductionProjectInfo(MainWindow.gintProjectID); intRecordsReturned = TheFindProductionProjectInfoDataSet.FindProductionProjectInfo.Rows.Count; if (intRecordsReturned < 1) { AddProductionProjectInfo AddProductionProjectInfo = new AddProductionProjectInfo(); AddProductionProjectInfo.ShowDialog(); } else if (intRecordsReturned > 0) { EditProductionProjectInfo EditProductionProjectInfo = new EditProductionProjectInfo(); EditProductionProjectInfo.ShowDialog(); } }
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()); } }