private void expProcess_Expanded(object sender, RoutedEventArgs e) { int intCounter; int intNumberOfRecords; int intOldProjectID; int intNewProjectID; string strAssignedProjectID; string strCustomerProjectID; DateTime datTransactionDate; int intEmployeeID; int intDepartmentID; int intWarehouseID; bool blnFatalError = false; try { expProcess.IsExpanded = false; intNumberOfRecords = TheImportProjectsDataSet.importprojects.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { if (TheImportProjectsDataSet.importprojects[intCounter].DoNotImport == false) { intNewProjectID = TheImportProjectsDataSet.importprojects[intCounter].ProjectID; intOldProjectID = TheImportProjectsDataSet.importprojects[intCounter].SecondProjectID; strAssignedProjectID = TheImportProjectsDataSet.importprojects[intCounter].AssignedProjectID; strCustomerProjectID = TheImportProjectsDataSet.importprojects[intCounter].CustomerProjectID; datTransactionDate = DateTime.Now; intEmployeeID = TheImportProjectsDataSet.importprojects[intCounter].EmployeeID; intDepartmentID = TheImportProjectsDataSet.importprojects[intCounter].DepartmentID; intWarehouseID = TheImportProjectsDataSet.importprojects[intCounter].WarehouseID; blnFatalError = TheProjectMatrixClass.InsertProjectMatrix(intNewProjectID, strAssignedProjectID, strCustomerProjectID, datTransactionDate, intEmployeeID, intWarehouseID, intDepartmentID); if (blnFatalError == true) { throw new Exception(); } if (intNewProjectID != 0) { if (intOldProjectID != 0) { if (intNewProjectID != intOldProjectID) { blnFatalError = ResetProjectIDEmployeeCrewAssignment(intOldProjectID, intNewProjectID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = ResetProjectIDEmployeeProjectAssignment(intOldProjectID, intNewProjectID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = ResetProjectIDProjectTask(intOldProjectID, intNewProjectID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheProjectClass.RemoveProjectEntry(intOldProjectID); if (blnFatalError == true) { throw new Exception(); } } } } } } TheMessagesClass.InformationMessage("Import Complete"); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Import Projects // Main Window // Process Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }