private void BtnProcess_Click(object sender, RoutedEventArgs e) { int intPartID; int intRecordsReturned; bool blnFatalError = false; int intCounter; int intNumberOfRecords; int intQuantity; int intTransactionID; try { CompareParts(); intNumberOfRecords = TheImportInventoryDataSet.importinventory.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intPartID = TheImportInventoryDataSet.importinventory[intCounter].PartID; intQuantity = TheImportInventoryDataSet.importinventory[intCounter].NewQuantity; TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, gintWarehouseID); intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned == 0) { blnFatalError = TheInventoryClass.InsertInventoryPart(intPartID, intQuantity, gintWarehouseID); if (blnFatalError == true) { throw new Exception(); } } else if (intRecordsReturned == 1) { intTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID; blnFatalError = TheInventoryClass.UpdateInventoryPart(intTransactionID, intQuantity); if (blnFatalError == true) { throw new Exception(); } } else if (intRecordsReturned > 1) { TheMessagesClass.ErrorMessage("f**k you"); } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Import Maspro Inventory // Process Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private bool UpdateInventoryInfo(int intPartID, int intWarehouseID, int intQuantity) { bool blnFatalError = false; int intRecordsReturned; int intTransactionID; int intTotalQuantity; try { TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, intWarehouseID); intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned == 0) { blnFatalError = TheInventoryClass.InsertInventoryPart(intPartID, intQuantity, intWarehouseID); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("There Has Been A Problem, Contact ID"); return(blnFatalError); } } else if (intRecordsReturned == 1) { intTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID; intTotalQuantity = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity + intQuantity; blnFatalError = TheInventoryClass.UpdateInventoryPart(intTransactionID, intTotalQuantity); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("There Has Been A Problem, Contact ID"); return(blnFatalError); } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Process Patch Class // Update Inventory Info " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); blnFatalError = true; } return(blnFatalError); }
private void mitTransferInventory_Click(object sender, RoutedEventArgs e) { int intTransactionID; int intQuantity; int intRecordsReturned; bool blnFatalError; try { TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(MainWindow.gintPartID, gintReceivingWarehouseID); intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned == 0) { blnFatalError = TheInventoryClass.InsertInventoryPart(MainWindow.gintPartID, gintQuantity, gintReceivingWarehouseID); if (blnFatalError == true) { throw new Exception(); } } else { intTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID; intQuantity = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity; intQuantity += gintQuantity; blnFatalError = TheInventoryClass.UpdateInventoryPart(intTransactionID, intQuantity); if (blnFatalError == true) { throw new Exception(); } } gintSendingQuantity -= gintQuantity; blnFatalError = TheInventoryClass.UpdateInventoryPart(gintSendingTransactionID, gintSendingQuantity); if (blnFatalError == true) { throw new Exception(); } if (gblnReceiveJHInventory == false) { TheFindCharterWarehouseInventoryForPartDataSet = TheCharterInventoryClass.FindCharterWarehouseInventoryForPart(MainWindow.gintPartID, gintReceivingWarehouseID); intRecordsReturned = TheFindCharterWarehouseInventoryForPartDataSet.FindCharterWarehouseInventoryForPart.Rows.Count; if (intRecordsReturned == 0) { blnFatalError = TheCharterInventoryClass.InsertCharterInventory(MainWindow.gintPartID, gintQuantity, gintReceivingWarehouseID); if (blnFatalError == true) { throw new Exception(); } } else { intTransactionID = TheFindCharterWarehouseInventoryForPartDataSet.FindCharterWarehouseInventoryForPart[0].TransactionID; intQuantity = TheFindCharterWarehouseInventoryForPartDataSet.FindCharterWarehouseInventoryForPart[0].Quantity; intQuantity += gintQuantity; blnFatalError = TheCharterInventoryClass.UpdateCharterInventory(intTransactionID, intQuantity); if (blnFatalError == true) { throw new Exception(); } } gintSendingQuantity -= gintQuantity; blnFatalError = TheCharterInventoryClass.UpdateCharterInventory(gintSendingTransactionID, gintSendingQuantity); if (blnFatalError == true) { throw new Exception(); } } TheMessagesClass.InformationMessage("The Part Has Been Transferred"); ResetForm(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Transfer Inventory // Transfer Inventory Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expUpdateCounts_Expanded(object sender, RoutedEventArgs e) { int intCounter; int intNumberOfRecords; bool blnFatalError = false; int intPartID; int intOldCount; int intNewCount; string strLocation; string strPartNumber; string strPartDescription; int intRecordsReturned; string strJDEPartNumber; int intTransactionID; int intSecondCounter; int intSecondNumberOfRecords; bool blnItemFound; DateTime datStartDate = DateTime.Now; DateTime datEndDate; try { blnFatalError = TheInventoryClass.ClearWarehouseInventory(MainWindow.gintWarehouseID); if (blnFatalError == true) { throw new Exception(); } datStartDate = TheDateSearchClass.RemoveTime(datStartDate); datEndDate = TheDateSearchClass.AddingDays(datStartDate, 1); blnFatalError = TheInventoryImportClass.RemoveInventoryImport(MainWindow.gintWarehouseID, datStartDate, datEndDate); if (blnFatalError == true) { throw new Exception(); } intNumberOfRecords = TheImportInventoryDataSet.importinventory.Rows.Count; for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { intPartID = TheImportInventoryDataSet.importinventory[intCounter].PartID; intOldCount = TheImportInventoryDataSet.importinventory[intCounter].OldCount; intNewCount = TheImportInventoryDataSet.importinventory[intCounter].CurrentCount; strLocation = TheImportInventoryDataSet.importinventory[intCounter].Location; strPartNumber = TheImportInventoryDataSet.importinventory[intCounter].PartNumber; strPartDescription = TheImportInventoryDataSet.importinventory[intCounter].PartDescription; strJDEPartNumber = TheImportInventoryDataSet.importinventory[intCounter].JDEPartNumber; if (intPartID < 1) { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } else if (intRecordsReturned < 1) { intPartID = intCounter * -1; blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(intPartID, strPartNumber, strJDEPartNumber, strPartDescription, 0); if (blnFatalError == true) { throw new Exception(); } TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } } else if (intPartID > 0) { TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(intPartID); intRecordsReturned = TheFindPartByPartIDDataSet.FindPartByPartID.Rows.Count; if (intRecordsReturned > 0) { if (strPartNumber != TheFindPartByPartIDDataSet.FindPartByPartID[0].PartNumber) { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } else if (intRecordsReturned < 1) { intPartID = intCounter * -1; blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(intPartID, strPartNumber, strJDEPartNumber, strPartDescription, 0); if (blnFatalError == true) { throw new Exception(); } TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } } } else if (intRecordsReturned < 1) { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } else if (intRecordsReturned < 1) { intPartID = intCounter * -1; blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(intPartID, strPartNumber, strJDEPartNumber, strPartDescription, 0); if (blnFatalError == true) { throw new Exception(); } TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } } } TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID); intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = TheInventoryClass.InsertInventoryPart(intPartID, intNewCount, MainWindow.gintWarehouseID); if (blnFatalError == true) { throw new Exception(); } } else if (intRecordsReturned > 0) { intTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID; blnFatalError = TheInventoryClass.UpdateInventoryPart(intTransactionID, intNewCount); if (blnFatalError == true) { throw new Exception(); } } //inserting inventory location TheFindInventoryLocationByPartIDDataSet = TheMaterialSheetsClass.FindInventoryLocationByPartID(intPartID, MainWindow.gintWarehouseID); intSecondNumberOfRecords = TheFindInventoryLocationByPartIDDataSet.FindInventoryLocationByPartID.Rows.Count; blnItemFound = false; if (intSecondNumberOfRecords > 0) { for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++) { if (strLocation == TheFindInventoryLocationByPartIDDataSet.FindInventoryLocationByPartID[intSecondCounter].PartLocation) { blnItemFound = true; } } } if (blnItemFound == false) { blnFatalError = TheMaterialSheetsClass.InsertInventoryLocation(intPartID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, DateTime.Now, strLocation, MainWindow.gintWarehouseID); if (blnFatalError == true) { throw new Exception(); } } //adding to inventory sheet blnFatalError = TheInventoryImportClass.InsertInventoryImport(MainWindow.gintWarehouseID, intPartID, strLocation, intOldCount, intNewCount, DateTime.Now); if (blnFatalError == true) { throw new Exception(); } } TheMessagesClass.InformationMessage("All Parts Added"); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Inventory // Update Counts Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }