private void DgrResults_SelectionChanged(object sender, SelectionChangedEventArgs e) { int intSelectedIndex; bool blnProcessProject; intSelectedIndex = dgrResults.SelectedIndex; if (intSelectedIndex > -1) { blnProcessProject = !TheDesignProjectsNeedingInvoiceDataSet.designprojects[intSelectedIndex].ProcessProject; MainWindow.gstrAssignedProjectID = TheDesignProjectsNeedingInvoiceDataSet.designprojects[intSelectedIndex].AssignedProjectID; TheDesignProjectsNeedingInvoiceDataSet.designprojects[intSelectedIndex].ProcessProject = blnProcessProject; dgrResults.ItemsSource = TheDesignProjectsNeedingInvoiceDataSet.designprojects; TheFindDesignProjectsByAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(MainWindow.gstrAssignedProjectID); if (TheFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].IsBillingIDNull() == true) { AddBillingCodeToProject AddBillingCodeToProject = new AddBillingCodeToProject(); AddBillingCodeToProject.ShowDialog(); } } }
public FindDesignProjectsByAssignedProjectIDDataSet FindDesignProjectsByAssignedProjectID(string strAssignedProjectID) { try { aFindDesignProjectsByAssignedProjectIDDataSet = new FindDesignProjectsByAssignedProjectIDDataSet(); aFindDesignProjectsByAssignedProjectIDTableAdapter = new FindDesignProjectsByAssignedProjectIDDataSetTableAdapters.FindDesignProjectsByAssignedProjectIDTableAdapter(); aFindDesignProjectsByAssignedProjectIDTableAdapter.Fill(aFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID, strAssignedProjectID); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Design Projects Class // Find Design Projects By Assigned Project ID " + Ex.Message); } return(aFindDesignProjectsByAssignedProjectIDDataSet); }
private void Window_Loaded(object sender, RoutedEventArgs e) { //setting up the variables int intCounter; int intNumberOfRecords; try { //loading billing codes TheFindSortedWOVBillingCodes = TheWOVInvoicingClass.FindSortedWOVBillingCodes(); intNumberOfRecords = TheFindSortedWOVBillingCodes.FindSortedWOVBillingCodes.Rows.Count - 1; cboSelectBillingCode.Items.Add("Select Billing Code"); for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { cboSelectBillingCode.Items.Add(TheFindSortedWOVBillingCodes.FindSortedWOVBillingCodes[intCounter].BillingDescription); } cboSelectBillingCode.SelectedIndex = 0; TheFindDesignProjectsByAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(MainWindow.gstrAssignedProjectID); txtAddress.Text = TheFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectAddress; txtJobType.Text = TheFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].JobType; txtProjectID.Text = MainWindow.gstrAssignedProjectID; txtProjectName.Text = TheFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectName; MainWindow.gintProjectID = TheFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectID; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Adding Billing Codes to Project // Window Loaded Method " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void ResetControls() { //setting local variables int intCounter; int intNumberOfRecords; int intSecondCounter; int intProjectID; bool blnItemFound; string strAssignedProjectID; try { //filling data set TheFindDesignProjectsByJobStatusDataSet = TheDesignProjectsClass.FindDesignProjectsByJobStatus("INVOICED"); //getting ready for the loop intNumberOfRecords = TheFindDesignProjectsByJobStatusDataSet.FindDesignProjectsByJobStatus.Rows.Count - 1; TheDesignProjectsNeedingInvoiceDataSet.designprojects.Rows.Clear(); gintCounter = 0; gintNumberOfRecords = 0; if (intNumberOfRecords > -1) { for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { blnItemFound = false; strAssignedProjectID = TheFindDesignProjectsByJobStatusDataSet.FindDesignProjectsByJobStatus[intCounter].AssignedProjectID; TheFindDesignProjectsByAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(strAssignedProjectID); intProjectID = TheFindDesignProjectsByAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectID; if (gintCounter > 0) { for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++) { if (intProjectID == TheDesignProjectsNeedingInvoiceDataSet.designprojects[intSecondCounter].ProjectID) { blnItemFound = true; } } } if (blnItemFound == false) { DesignProjectsNeedingInvoiceDataSet.designprojectsRow NewProjectRow = TheDesignProjectsNeedingInvoiceDataSet.designprojects.NewdesignprojectsRow(); NewProjectRow.AssignedOffice = TheFindDesignProjectsByJobStatusDataSet.FindDesignProjectsByJobStatus[intCounter].FirstName; NewProjectRow.AssignedProjectID = TheFindDesignProjectsByJobStatusDataSet.FindDesignProjectsByJobStatus[intCounter].AssignedProjectID; NewProjectRow.ProjectID = intProjectID; NewProjectRow.ProjectName = TheFindDesignProjectsByJobStatusDataSet.FindDesignProjectsByJobStatus[intCounter].ProjectName; NewProjectRow.ProcessProject = false; NewProjectRow.DateReceived = TheFindDesignProjectsByJobStatusDataSet.FindDesignProjectsByJobStatus[intCounter].DateReceived; TheDesignProjectsNeedingInvoiceDataSet.designprojects.Rows.Add(NewProjectRow); gintNumberOfRecords = gintCounter; gintCounter++; } } } dgrResults.ItemsSource = TheDesignProjectsNeedingInvoiceDataSet.designprojects; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Design Project Invoicing // Reset Controls " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private bool ProcessClevelandInvoice() { bool blnFatalError = false; int intRowCounter; int intRowNumberOfRecords; int intColumnCounter; int intColumnNumberOfRecords; int intCounter; int intNumberOfRecords; DateTime datTransactionDate; string strAssignedProjectID; int intProjectID; int intEmployeeID; int intProjectIdentifictionID; string strWOVDescription; decimal decTotalQuantity = 0; int intWOVTaskID = 0; int intTransactionID; // Creating a Excel object. Microsoft.Office.Interop.Excel._Application excel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel._Workbook workbook = excel.Workbooks.Add(Type.Missing); Microsoft.Office.Interop.Excel._Worksheet worksheet = null; try { intNumberOfRecords = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice.Rows.Count - 1; for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++) { //getting ready to insert into tables datTransactionDate = DateTime.Now; strAssignedProjectID = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].DockID; TheFindDesignProjectsByAssignedProjectID = TheDesignProjectClass.FindDesignProjectsByAssignedProjectID(strAssignedProjectID); intProjectID = TheFindDesignProjectsByAssignedProjectID.FindDesignProjectsByAssignedProjectID[0].ProjectID; intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; intTransactionID = TheFindDesignProjectsByAssignedProjectID.FindDesignProjectsByAssignedProjectID[0].TransactionID; blnFatalError = TheWOVInvoicingClass.InsertWOVInvoice(datTransactionDate, intProjectID, intEmployeeID, MainWindow.gintBillingID); if (blnFatalError == true) { throw new Exception(); } TheFindWOVInvoicingByTransactionDateDataSet = TheWOVInvoicingClass.FindWOVInvoicingByTransactionDate(datTransactionDate, intProjectID); intProjectIdentifictionID = TheFindWOVInvoicingByTransactionDateDataSet.FindWOVInvoicingByTransactionDate[0].ProjectIdentificationID; if (MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].WOV1 != 0) { strWOVDescription = "WOV1"; decTotalQuantity = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].WOV1; TheFindTechPayItemByCodeDataSet = TheTechPayClass.FindTechPayItemByCode(strWOVDescription); intWOVTaskID = TheFindTechPayItemByCodeDataSet.FindTechPayItemByCode[0].TechPayID; } if (MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].WOV2 != 0) { strWOVDescription = "WOV2"; decTotalQuantity = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].WOV2; TheFindTechPayItemByCodeDataSet = TheTechPayClass.FindTechPayItemByCode(strWOVDescription); intWOVTaskID = TheFindTechPayItemByCodeDataSet.FindTechPayItemByCode[0].TechPayID; } if (MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].WOV3 != 0) { strWOVDescription = "WOV3"; decTotalQuantity = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].WOV3; TheFindTechPayItemByCodeDataSet = TheTechPayClass.FindTechPayItemByCode(strWOVDescription); intWOVTaskID = TheFindTechPayItemByCodeDataSet.FindTechPayItemByCode[0].TechPayID; } if (MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].PP1 != 0) { strWOVDescription = "PP1"; decTotalQuantity = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].PP1; TheFindTechPayItemByCodeDataSet = TheTechPayClass.FindTechPayItemByCode(strWOVDescription); intWOVTaskID = TheFindTechPayItemByCodeDataSet.FindTechPayItemByCode[0].TechPayID; } if (MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].PP2 != 0) { strWOVDescription = "PP2"; decTotalQuantity = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice[intCounter].PP2; TheFindTechPayItemByCodeDataSet = TheTechPayClass.FindTechPayItemByCode(strWOVDescription); intWOVTaskID = TheFindTechPayItemByCodeDataSet.FindTechPayItemByCode[0].TechPayID; } blnFatalError = TheWOVInvoicingClass.InsertWOVInvoicingItems(intProjectID, intProjectIdentifictionID, intEmployeeID, intWOVTaskID, Convert.ToInt32(decTotalQuantity)); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheDesignProjectClass.CloseDesignProject(intTransactionID, DateTime.Now); if (blnFatalError == true) { throw new Exception(); } } worksheet = workbook.ActiveSheet; worksheet.Name = "Projects Invoiced"; int cellRowIndex = 1; int cellColumnIndex = 1; intRowNumberOfRecords = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice.Rows.Count; intColumnNumberOfRecords = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice.Columns.Count; for (intColumnCounter = 0; intColumnCounter < intColumnNumberOfRecords; intColumnCounter++) { worksheet.Cells[cellRowIndex, cellColumnIndex] = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice.Columns[intColumnCounter].ColumnName; cellColumnIndex++; } cellRowIndex++; cellColumnIndex = 1; //Loop through each row and read value from each column. for (intRowCounter = 0; intRowCounter < intRowNumberOfRecords; intRowCounter++) { for (intColumnCounter = 0; intColumnCounter < intColumnNumberOfRecords; intColumnCounter++) { worksheet.Cells[cellRowIndex, cellColumnIndex] = MainWindow.TheClevelandDesignProjectInvoicingDataSet.clevelanddesigninvoice.Rows[intRowCounter][intColumnCounter].ToString(); cellColumnIndex++; } cellColumnIndex = 1; cellRowIndex++; } //Getting the location and file name of the excel to save from user. SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"; saveDialog.FilterIndex = 1; saveDialog.ShowDialog(); workbook.SaveAs(saveDialog.FileName); MessageBox.Show("Projects Invoiced"); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Process Design Invoice // Process Cleveland Invoice " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); blnFatalError = true; } return(blnFatalError); }
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()); } }