private void expGetReelID_Expanded(object sender, RoutedEventArgs e) { string strPartNumber; int intPartID; string strCableReelID = "NOT ASSIGNED"; DateTime datTransactionDate = DateTime.Now; bool blnFatalError = false; int intRecordsReturned; try { expGetReelID.IsExpanded = false; strPartNumber = txtPartNumber.Text; TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("The Part Number was not Found"); return; } if (cboSelectEmployee.SelectedIndex < 1) { TheMessagesClass.ErrorMessage("The Employee Was Not Selected"); return; } if (cboSelectWarehouse.SelectedIndex < 1) { TheMessagesClass.ErrorMessage("The Warehouse Was Not Selected"); return; } intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; blnFatalError = TheCableInventoryClass.InsertCableReelID(datTransactionDate, intPartID, MainWindow.gintEmployeeID, strCableReelID); if (blnFatalError == true) { throw new Exception(); } TheFindCableReelIDByTransactionDateDataSet = TheCableInventoryClass.FindCableReelIDByTransactionDate(datTransactionDate); gintReelID = TheFindCableReelIDByTransactionDateDataSet.FindCableReelIDByTransactionDate[0].CableReelID; txtAssignedReelID.Text = Convert.ToString(gintReelID); gblnReelIDChecked = true; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Cable Reel // Get Reel ID Expander " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFindPartNumber_Click(object sender, RoutedEventArgs e) { //setting local variables string strPartNumber; int intRecordsReturned; try { //data validation strPartNumber = txtEnterPartNumber.Text; if (strPartNumber == "") { TheMessagesClass.ErrorMessage("Part Number Not Entered"); return; } TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.InformationMessage("Part Number Was Not Found"); ClearControls(); } else if (intRecordsReturned > 0) { txtDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; txtJDEPartNumber.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].JDEPartNumber; txtPartID.Text = Convert.ToString(TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID); txtPartNumber.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber; txtPrice.Text = Convert.ToString(TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].Price); mitSave.IsEnabled = true; } } else if (intRecordsReturned > 0) { txtDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; txtJDEPartNumber.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; txtPartID.Text = Convert.ToString(TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID); txtPartNumber.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartNumber; txtPrice.Text = Convert.ToString(TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].Price); mitSave.IsEnabled = true; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Parts // Find Part Number Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFindPart_Click(object sender, RoutedEventArgs e) { string strPartNumber; int intRecordCount; try { strPartNumber = txtPartNumber.Text; gblnItemFound = false; TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordCount = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordCount > 0) { MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; txtPartDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; gblnItemFound = true; } else if (intRecordCount < 1) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordCount = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordCount > 0) { MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; txtPartDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; gblnItemFound = true; } else { TheMessagesClass.ErrorMessage("The Part Was Not Found"); return; } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Inventory Location // Find Part Button " + Ex.Message); TheSendEmailClass.SendEventLog(Ex.ToString()); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expCheckPartNumber_Expanded(object sender, RoutedEventArgs e) { string strPartNumber; int intRecordsReturned; try { expCheckPartNumber.IsExpanded = false; strPartNumber = txtPartNumber.Text; TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { txtPartDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } else if (intRecordsReturned < 1) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { txtPartDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; } else { TheMessagesClass.ErrorMessage("The Part Number Was Not Found"); return; } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Cable Reel // Check Cable Reel " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void cboSelectWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e) { int intSelectedIndex; int intWarehouseID; DateTime datStartDate = DateTime.Now; DateTime datEndDate = DateTime.Now; DateTime datTodaysDate = DateTime.Now; int intCounter; int intNumberOfRecords; int intRecordsReturned; int intPartID; int intLoop; string strPartNumber; double douAverage; double douSTDev; int intCount; bool blnDoNotCopy; PleaseWait PleaseWait = new PleaseWait(); PleaseWait.Show(); try { intSelectedIndex = cboSelectWarehouse.SelectedIndex - 1; if (intSelectedIndex > -1) { TheCalculatedInventoryStatsDataSet.inventorystats.Rows.Clear(); TheFinalCalculatedInventoryStatsDataSet.inventorystats.Rows.Clear(); intWarehouseID = TheFindPartsWarehouseDataSet.FindPartsWarehouses[intSelectedIndex].EmployeeID; TheFindWarehouseInventoryDataSet = TheInventoryClass.FindWarehouseInventory(intWarehouseID); intNumberOfRecords = TheFindWarehouseInventoryDataSet.FindWarehouseInventory.Rows.Count - 1; datTodaysDate = TheDateSearchClass.RemoveTime(datTodaysDate); for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { datStartDate = TheDateSearchClass.SubtractingDays(datTodaysDate, 90); datEndDate = TheDateSearchClass.AddingDays(datStartDate, 30); intLoop = 1; strPartNumber = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartNumber; TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; CalculatedInventoryStatsDataSet.inventorystatsRow NewInventoryRow = TheCalculatedInventoryStatsDataSet.inventorystats.NewinventorystatsRow(); NewInventoryRow.PartID = intPartID; NewInventoryRow.JDEPartNumber = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].JDEPartNumber; NewInventoryRow.PartDescription = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartDescription; NewInventoryRow.PartNumber = strPartNumber; while (datStartDate < datTodaysDate) { TheFindInventoryIssueStatsDataSet = TheInventoryStatsClass.FindInventoryIssueStats(intPartID, intWarehouseID, datStartDate, datEndDate); intRecordsReturned = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats.Rows.Count; if (intRecordsReturned == 0) { douAverage = 0; douSTDev = 0; intCount = 0; } else { if (TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].IsAverageIssuedNull() == true) { douAverage = 0; } else { douAverage = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].AverageIssued; } if (TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].IsIssuedSTDEVNull() == true) { douSTDev = 0; } else { douSTDev = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].IssuedSTDEV; } intCount = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].TotalIssued; } if (intLoop == 1) { NewInventoryRow.PeriodOneAvg = douAverage; NewInventoryRow.PeriodOneCount = intCount; NewInventoryRow.PeriodOneSD = douSTDev; NewInventoryRow.PeriodOneStarDate = datStartDate; } else if (intLoop == 2) { NewInventoryRow.PeriodTwoAvg = douAverage; NewInventoryRow.PeriodTwoCount = intCount; NewInventoryRow.PeriodTwoSD = douSTDev; NewInventoryRow.PeriodTwoStartDate = datStartDate; } else if (intLoop == 3) { NewInventoryRow.PeriodThreeAvg = douAverage; NewInventoryRow.PeriodThreeCount = intCount; NewInventoryRow.PeriodThreeSD = douSTDev; NewInventoryRow.PeriodThreeStartDate = datStartDate; } datStartDate = datEndDate; datEndDate = TheDateSearchClass.AddingDays(datEndDate, 30); intLoop++; } TheCalculatedInventoryStatsDataSet.inventorystats.Rows.Add(NewInventoryRow); } intNumberOfRecords = TheCalculatedInventoryStatsDataSet.inventorystats.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { blnDoNotCopy = false; if (TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneAvg == 0) { if (TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoAvg == 0) { if (TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeAvg == 0) { blnDoNotCopy = true; } } } if (blnDoNotCopy == false) { CalculatedInventoryStatsDataSet.inventorystatsRow NewStatsRow = TheFinalCalculatedInventoryStatsDataSet.inventorystats.NewinventorystatsRow(); NewStatsRow.JDEPartNumber = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].JDEPartNumber; NewStatsRow.PartDescription = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PartDescription; NewStatsRow.PartID = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PartID; NewStatsRow.PartNumber = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PartNumber; NewStatsRow.PeriodOneAvg = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneAvg; NewStatsRow.PeriodOneCount = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneCount; NewStatsRow.PeriodOneSD = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneSD; NewStatsRow.PeriodThreeAvg = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeAvg; NewStatsRow.PeriodThreeCount = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeCount; NewStatsRow.PeriodThreeSD = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeSD; NewStatsRow.PeriodTwoAvg = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoAvg; NewStatsRow.PeriodTwoCount = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoCount; NewStatsRow.PeriodTwoSD = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoSD; NewStatsRow.PeriodOneStarDate = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneStarDate; NewStatsRow.PeriodThreeStartDate = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeStartDate; NewStatsRow.PeriodTwoStartDate = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoStartDate; TheFinalCalculatedInventoryStatsDataSet.inventorystats.Rows.Add(NewStatsRow); } } dgrResults.ItemsSource = TheFinalCalculatedInventoryStatsDataSet.inventorystats; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Inventory Stats // Main Window // Combo Box Changed " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } PleaseWait.Close(); }
private void mitPrintCycleCountTickets_Click(object sender, RoutedEventArgs e) { int intCounter; int intRandomNumber = 0; int intNumberOfRecords; int intArrayCounter; bool blnDublicateNumber; bool blnItemFound; try { for (intArrayCounter = 0; intArrayCounter <= 10; intArrayCounter++) { gintNumberUsed[intArrayCounter] = -1; } gintArrayCounter = 0; TheCycleCountTicketsDataSet.tickets.Rows.Clear(); TheFindWarehouseInventoryDataSet = TheInventoryClass.FindWarehouseInventory(MainWindow.gintWarehouseID); intNumberOfRecords = TheFindWarehouseInventoryDataSet.FindWarehouseInventory.Rows.Count; for (intCounter = 0; intCounter < 10; intCounter++) { blnDublicateNumber = true; while (blnDublicateNumber == true) { blnItemFound = false; intRandomNumber = myRandomNumber.Next(0, intNumberOfRecords); for (intArrayCounter = 0; intArrayCounter <= 10; intArrayCounter++) { if (intRandomNumber == gintNumberUsed[intArrayCounter]) { blnItemFound = true; } } if (blnItemFound == false) { blnDublicateNumber = false; } } gintNumberUsed[gintArrayCounter] = intRandomNumber; gintArrayCounter++; CycleCountTicketsDataSet.ticketsRow NewPartRow = TheCycleCountTicketsDataSet.tickets.NewticketsRow(); NewPartRow.Description = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intRandomNumber].PartDescription; NewPartRow.JDEPartNumber = ""; TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intRandomNumber].PartNumber); NewPartRow.PartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; NewPartRow.PartNumber = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intRandomNumber].PartNumber; NewPartRow.Quantity = ""; TheCycleCountTicketsDataSet.tickets.Rows.Add(NewPartRow); } PrintTickets(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Cycle Count // Print Cycle Count Tickets " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { string strPartNumber; bool blnIsNotInteger = false; int intRecordsReturned; bool blnItemFound = false; strPartNumber = txtEnterPartNumber.Text; if (strPartNumber == "") { TheMessagesClass.ErrorMessage("Part Number Was Not Added"); return; } blnIsNotInteger = TheDataValidationClass.VerifyIntegerData(strPartNumber); if (blnIsNotInteger == false) { MainWindow.gintPartID = Convert.ToInt32(strPartNumber); TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(MainWindow.gintPartID); intRecordsReturned = TheFindPartByPartIDDataSet.FindPartByPartID.Rows.Count; if (intRecordsReturned > 0) { blnItemFound = true; } } if (blnItemFound == false) { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { blnItemFound = true; MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } if (blnItemFound == false) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { blnItemFound = true; MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; } } } if (blnItemFound == false) { TheMessagesClass.ErrorMessage("Part Information Does Not Exist"); return; } blnItemFound = false; TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(MainWindow.gintPartID, MainWindow.gintWarehouseID); intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.ErrorMessage("No Information for this Part, You Cannoot Change The Count"); return; } else { txtCurrentCount.Text = Convert.ToString(TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity); gintTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID; } btnUpdate.IsEnabled = true; }
private void mitSave_Click(object sender, RoutedEventArgs e) { //setting local variables string strPartNumber; int intRecordsReturned; bool blnFatalError = false; try { //data validation strPartNumber = txtEnterPartNumber.Text; if (strPartNumber == "") { TheMessagesClass.ErrorMessage("Part Number Was Not Entered"); return; } //checking to see if the part number exists within the part table //checking JDE Part Number TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table"); return; } //checking part number TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table"); return; } TheFindPartFromMasterPartListByJDEPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheFindPartFromMasterPartListByPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByPartNumber(strPartNumber); intRecordsReturned = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.ErrorMessage("The Part Number Entered is not in the Master Part List"); return; } } blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(Convert.ToInt32(txtPartID.Text), txtPartNumber.Text, txtJDEPartNumber.Text, txtDescription.Text, float.Parse(txtPrice.Text)); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Part Number Has Been Added"); ClearControls(); } catch (Exception Ex) { TheEventlogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Part From Master List // Save Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void mitSave_Click(object sender, RoutedEventArgs e) { //setting local variables string strPartNumber; int intPartID; string strDescription; string strJDEPartNumber; double douPrice = 0; string strValueForValidation; bool blnFatalError = false; bool blnThereIsAProblem = false; string strErrorMessage = ""; int intRecordsReturned; int intRecordCounter; bool blnRecordMatch; PleaseWait PleaseWait = new PleaseWait(); PleaseWait.Show(); try { //data validation strPartNumber = txtPartNumber.Text; intPartID = Convert.ToInt32(txtPartID.Text); if (strPartNumber == "") { blnFatalError = true; strErrorMessage += "Part Number Was Not Entered\n"; } strJDEPartNumber = txtJDEPartNumber.Text; if (strJDEPartNumber == "") { blnFatalError = true; strErrorMessage += "JDE Part Number Was Not Entered\n"; } strDescription = txtDescription.Text; if (strDescription == "") { blnFatalError = true; strErrorMessage += "The Description Was Not Entered\n"; } strValueForValidation = txtPrice.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDoubleData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Price Entered in not Numeric\n"; } else { douPrice = Convert.ToDouble(strValueForValidation); } if (blnFatalError == true) { PleaseWait.Close(); TheMessagesClass.ErrorMessage(strErrorMessage); return; } //validation to see if the part number is used with another row TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { blnRecordMatch = false; for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++) { if (strPartNumber == TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartNumber) { if (intPartID != TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartID) { blnRecordMatch = true; } } } if (blnRecordMatch == true) { TheMessagesClass.ErrorMessage("Part Number Exists with a Different Part ID"); return; } } if ((strJDEPartNumber != "NOT REQUIRED") && (strJDEPartNumber != "NOT PROVIDED")) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { blnRecordMatch = false; for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++) { if (strJDEPartNumber == TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].JDEPartNumber) { if (intPartID != TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].PartID) { blnRecordMatch = true; } } } if (blnRecordMatch == true) { TheMessagesClass.ErrorMessage("JDE Part Number Exists with a Different Part ID"); return; } } } //doing the loop blnFatalError = ThePartNumberClass.UpdatePartInformation(intPartID, strJDEPartNumber, strDescription, true, float.Parse(txtPrice.Text)); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Part Has Been Updated"); ClearControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Parts // Save Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } PleaseWait.Close(); }
private void AddSaveRecord() { //setting local variables string strPartNumber; string strProject; int intPartID = 0; string strMSRNumber = "NOT REQUIRED"; string strValueForValidation; int intQuantity = 0; bool blnThereIsAProblem = false; bool blnFatalError = false; string strErrorMessage = ""; int intRecordsFound; bool blnProjectNotFound = false; bool blnPartNotFound = true; bool blnKeyWordNotFound; int intTotalQuantity; int intProjectID = 0; string strJDEPartNumber = ""; int intEmployeeID = 0; int intEnterEmployeeID = 0; try { if (btnAdd.Content.ToString() == "Add") { //loading controls txtDateEntryComplete.Text = "NO"; txtDate.Text = Convert.ToString(DateTime.Now); btnAdd.Content = "Save"; } else { if (MainWindow.gstrMenuSelection == "Issue") { if (cboSelectEmployee.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "Employee Was Not Selected\n"; } } //data validation strProject = txtProjectID.Text; if (strProject == "") { blnFatalError = true; strErrorMessage += "Project ID Was Not Entered\n"; } else { TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProject); intRecordsFound = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count; if (intRecordsFound == 0) { TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProject); intRecordsFound = TheFindProjectByProjectNameDataSet.FindProjectByProjectName.Rows.Count; if (intRecordsFound == 0) { blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strProject); if (blnThereIsAProblem == true) { blnProjectNotFound = true; } else { TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(Convert.ToInt32(strProject)); intRecordsFound = TheFindProjectByProjectIDDataSet.FindProjectByProjectID.Rows.Count; if (intRecordsFound == 0) { blnProjectNotFound = true; } else { intProjectID = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectID; strProject = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].AssignedProjectID; } } } else { strProject = TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].AssignedProjectID; intProjectID = TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].ProjectID; } } else { intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID; } if (blnProjectNotFound == true) { blnFatalError = true; strErrorMessage += "Project Was Not Found\n"; } } if (MainWindow.gstrMenuSelection == "Receive") { strMSRNumber = txtMSRPONumber.Text; if (strMSRNumber == "") { blnFatalError = true; strErrorMessage += "MSR or PO Number Was Not Entered\n"; } else if (strMSRNumber == "NO MSR NUMBER PROVIDED") { blnFatalError = true; strErrorMessage += "NO MSR NUMBER PROVIDED Cannot Be Entered\n"; } } strPartNumber = txtPartNumber.Text; if (strPartNumber == "") { blnFatalError = true; strErrorMessage += "Part Number Was Not Entered\n"; } else { blnPartNotFound = true; blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strPartNumber); if (blnThereIsAProblem == false) { intPartID = Convert.ToInt32(strPartNumber); TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(intPartID); intRecordsFound = TheFindPartByPartIDDataSet.FindPartByPartID.Rows.Count; if (intRecordsFound == 1) { blnPartNotFound = false; strPartNumber = TheFindPartByPartIDDataSet.FindPartByPartID[0].PartNumber; strJDEPartNumber = TheFindPartByPartIDDataSet.FindPartByPartID[0].JDEPartNumber; } } if (blnPartNotFound == true) { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsFound = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsFound == 1) { blnPartNotFound = false; intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; } if (blnPartNotFound == true) { TheFindPartByJDEPartNumber = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsFound = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber.Rows.Count; if (intRecordsFound == 1) { blnPartNotFound = false; intPartID = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].PartID; strPartNumber = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].PartNumber; strJDEPartNumber = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].JDEPartNumber; } } } if (MainWindow.gstrWarehouseName != "TRAINING") { //checking to see if non charter number blnKeyWordNotFound = TheKeyWordClass.FindKeyWord("JH", MainWindow.gstrWarehouseName); if (blnKeyWordNotFound == true) { if (strJDEPartNumber == "NOT REQUIRED") { blnFatalError = true; strErrorMessage += "Using Non Charter Part Number for Charter Warehouse\n"; } if (strJDEPartNumber == "NOT PROVIDED") { blnFatalError = true; strErrorMessage += "Using Non Charter Part Number for Charter Warehouse\n"; } } } if (blnPartNotFound == true) { blnFatalError = true; strErrorMessage += "Part Number Not Found\n"; } } //validating the Quantity strValueForValidation = txtQuantity.Text; blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Quantity Entered is not an Integer\n"; } else { intQuantity = Convert.ToInt32(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } //checking quantity for issuing if (MainWindow.gstrMenuSelection == "Issue") { TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID); intRecordsFound = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsFound == 0) { intTotalQuantity = 0; } else { intTotalQuantity = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity; } intTotalQuantity = CalculateWIPCount(intPartID, MainWindow.gintWarehouseID, intTotalQuantity); if (intQuantity > intTotalQuantity) { TheMessagesClass.ErrorMessage("The Quantity Issued is greater than the Quantity On The Shelf"); return; } } if (MainWindow.gstrMenuSelection == "Issue") { intEmployeeID = gintSelectedEmployeeID; intEnterEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; } else { intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID; } blnFatalError = TheInventoryWIPClass.InsertDataEntryWIP(MainWindow.gintSessionID, intPartID, strPartNumber, intProjectID, strProject, strMSRNumber, MainWindow.gintWarehouseID, intQuantity, intEmployeeID, MainWindow.gstrMenuSelection.ToUpper()); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("There Has Been A Problem. Contact IT"); return; } ClearControls(); } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Enter Inventory \\ Enter Material \\ Add Button During Save " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expImportExcel_Expanded(object sender, RoutedEventArgs e) { Excel.Application xlDropOrder; Excel.Workbook xlDropBook; Excel.Worksheet xlDropSheet; Excel.Range range; int intColumnRange = 0; int intCounter; int intNumberOfRecords; string strPartNumber; string strPartLocation; string strJDEPartNumber; int intPartID; string strOldPartNumber; string strPartDescription; int intRecordsReturned; try { TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Clear(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".xlsx"; // Default file extension dlg.Filter = "Excel (.xlsx)|*.xlsx"; // Filter files by extension // Show open file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document string filename = dlg.FileName; } PleaseWait PleaseWait = new PleaseWait(); PleaseWait.Show(); xlDropOrder = new Excel.Application(); xlDropBook = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1); range = xlDropSheet.UsedRange; intNumberOfRecords = range.Rows.Count; intColumnRange = range.Columns.Count; for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++) { strPartNumber = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper(); strPartLocation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper(); TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID); intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count; strOldPartNumber = "NONE FOUND"; if (intRecordsReturned > 0) { strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber; } ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow(); NewPartRow.JDEPartNumber = strJDEPartNumber; NewPartRow.Location = strPartLocation; NewPartRow.OldPartNumber = strOldPartNumber; NewPartRow.PartDescription = strPartDescription; NewPartRow.PartID = intPartID; NewPartRow.PartNumber = strPartNumber; NewPartRow.ToBeImported = true; TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow); } else if (intRecordsReturned < 1) { strJDEPartNumber = strPartNumber; TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; strPartNumber = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber; strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID); intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count; strOldPartNumber = "NONE FOUND"; if (intRecordsReturned > 0) { strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber; } ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow(); NewPartRow.JDEPartNumber = strJDEPartNumber; NewPartRow.Location = strPartLocation; NewPartRow.OldPartNumber = strOldPartNumber; NewPartRow.PartDescription = strPartDescription; NewPartRow.PartID = intPartID; NewPartRow.PartNumber = strPartNumber; NewPartRow.ToBeImported = true; TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow); } } } PleaseWait.Close(); dgrImportedInformation.ItemsSource = TheImportInventoryLocationdDataSet.importinventorylocations; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Inventory Locations // Import Excel " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void mitSave_Click(object sender, RoutedEventArgs e) { //setting local variables bool blnFatalError = false; bool blnThereIsAProblem = false; string strErrorMessage = ""; string strValueForValidation; string strPartNumber; string strJDEPartNumber; string strDescription; string strCharterPart; double douPrice = 0; int intRecordsReturned; try { //beginning data validation strPartNumber = txtPartNumber.Text; if (strPartNumber == "") { strErrorMessage += "The Part Number Was Not Entered\n"; blnFatalError = true; } strJDEPartNumber = txtJDEPartNumber.Text; if (strJDEPartNumber == "") { strErrorMessage += "The JDE Part Number Was Not Entered\n"; blnFatalError = true; } strDescription = txtDescription.Text; if (strDescription == "") { blnFatalError = true; strErrorMessage += "The Description Was Not Entered\n"; } strCharterPart = txtCharter.Text; blnThereIsAProblem = TheDataValidationClass.VerifyYesNoData(strCharterPart); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Charter Part in not a Yes or No\n"; } strValueForValidation = txtPrice.Text; blnThereIsAProblem = TheDataValidationClass.VerifyDoubleData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Price is not a Valid Format\n"; } else { douPrice = Convert.ToDouble(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } //checking to see if the part number exists TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("Part Number Exists"); return; } if (strJDEPartNumber != "NOT REQUIRED") { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber); if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("JDE Part Number Exists"); return; } } //searching the master parts list TheFindPartFromMasterPartListByPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByPartNumber(strPartNumber); intRecordsReturned = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("Part Number Exists with the Master Part List Table"); return; } if (strJDEPartNumber != "NOT REQUIRED") { TheFindPartFromMasterPartLitByJDEPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByJDEPartNumber(strJDEPartNumber); if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("JDE Part Number Exists within the Master Part List"); return; } } //saving the record blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(-1, strPartNumber, strJDEPartNumber, strDescription, float.Parse(txtPrice.Text)); if (blnFatalError == true) { throw new Exception(); } ClearControls(); SetControlsReadOnly(true); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Part // Save Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void expImportExcel_Expanded(object sender, RoutedEventArgs e) { Excel.Application xlDropOrder; Excel.Workbook xlDropBook; Excel.Worksheet xlDropSheet; Excel.Range range; int intColumnRange = 0; int intCounter; int intNumberOfRecords; string strPartNumber; string strJDEPartNumber; int intPartID = 0; string strPartDescription; int intQuantity = 0; int intRecordsReturned; bool blnItemFound; bool blnItemInTable; bool blnFatalError = false; int intSecondCounter; string strOldPartNumber = ""; try { expImportExcel.IsExpanded = false; blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create Spectrum Report // Import Spectrum Count"); if (blnFatalError == true) { throw new Exception(); } if (cboSelectWarehouse.SelectedIndex < 1) { TheMessagesClass.ErrorMessage("The Warehouse Was Not Selected"); return; } TheSpectrumCountDataSet.spectrumcount.Rows.Clear(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".xlsx"; // Default file extension dlg.Filter = "Excel (.xlsx)|*.xlsx"; // Filter files by extension // Show open file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document string filename = dlg.FileName; } PleaseWait PleaseWait = new PleaseWait(); PleaseWait.Show(); xlDropOrder = new Excel.Application(); xlDropBook = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1); range = xlDropSheet.UsedRange; intNumberOfRecords = range.Rows.Count; intColumnRange = range.Columns.Count; gintCounter = 0; gintNumberOfRecords = 0; for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++) { blnItemFound = false; strPartNumber = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper(); strJDEPartNumber = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper(); strPartDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper(); TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; blnItemFound = true; } else if (intRecordsReturned < 1) { TheFindPartByJDEPartNUmberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber); intRecordsReturned = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { strPartNumber = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartNumber; intPartID = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartID; blnItemFound = true; } else if (intRecordsReturned < 1) { if (strPartNumber == "NONE") { SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow(); NewPartCount.ERPQuantity = 0; NewPartCount.JDEPartNumber = strPartNumber; NewPartCount.PartDescription = strPartDescription; NewPartCount.PartID = intCounter * -1; NewPartCount.PartNumber = strPartNumber; NewPartCount.OldPartNumber = "UNKNOWN"; TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount); } } } if (blnItemFound == true) { TheFindWarehouseInventoryByPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID); intRecordsReturned = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned > 0) { blnItemInTable = false; if (gintCounter > 0) { for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++) { if (intPartID == TheSpectrumCountDataSet.spectrumcount[intSecondCounter].PartID) { blnItemInTable = true; } } } if (blnItemInTable == false) { intQuantity = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart[0].Quantity; TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID); intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count; if (intRecordsReturned > 0) { strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber; } else { strOldPartNumber = "NOT FOUND"; } SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow(); NewPartCount.ERPQuantity = intQuantity; NewPartCount.JDEPartNumber = strJDEPartNumber; NewPartCount.PartDescription = strPartDescription; NewPartCount.PartID = intPartID; NewPartCount.PartNumber = strPartNumber; NewPartCount.OldPartNumber = strOldPartNumber; TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount); } } else if (intRecordsReturned < 1) { if (strPartDescription.Contains("CABLE RG6") == true) { SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow(); NewPartCount.ERPQuantity = 0; NewPartCount.JDEPartNumber = strJDEPartNumber; NewPartCount.PartDescription = strPartDescription; NewPartCount.PartID = intPartID; NewPartCount.PartNumber = strPartNumber; NewPartCount.OldPartNumber = strOldPartNumber; TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount); } else if (strPartDescription.Contains("CABLE RG11") == true) { SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow(); NewPartCount.ERPQuantity = 0; NewPartCount.JDEPartNumber = strJDEPartNumber; NewPartCount.PartDescription = strPartDescription; NewPartCount.PartID = intPartID; NewPartCount.PartNumber = strPartNumber; NewPartCount.OldPartNumber = strOldPartNumber; TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount); } else if (strPartDescription.Contains("CABLE 875") == true) { SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow(); NewPartCount.ERPQuantity = 0; NewPartCount.JDEPartNumber = strJDEPartNumber; NewPartCount.PartDescription = strPartDescription; NewPartCount.PartID = intPartID; NewPartCount.PartNumber = strPartNumber; NewPartCount.OldPartNumber = strOldPartNumber; TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount); } else if (strPartDescription.Contains("CABLE 625") == true) { SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow(); NewPartCount.ERPQuantity = 0; NewPartCount.JDEPartNumber = strJDEPartNumber; NewPartCount.PartDescription = strPartDescription; NewPartCount.PartID = intPartID; NewPartCount.PartNumber = strPartNumber; NewPartCount.OldPartNumber = strOldPartNumber; TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount); } } } } dgrResult.ItemsSource = TheSpectrumCountDataSet.spectrumcount; PleaseWait.Close(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Spectrum Report // Import Excel Expander " + 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()); } }
private void btnFind_Click(object sender, RoutedEventArgs e) { //this will load up the controls and search for the part number string strPartNumber; int intRecordsReturned; bool blnFatalError = false; int intPartID = 0; bool blnItemFound = false; try { strPartNumber = txtEnterPartNumber.Text; if (strPartNumber == "") { TheMessagesClass.ErrorMessage("Part Number Not Entered"); return; } blnFatalError = TheDataValidationClass.VerifyIntegerData(strPartNumber); if (blnFatalError == false) { intPartID = Convert.ToInt32(strPartNumber); TheFindPartByPartIDataSet = ThePartNumberClass.FindPartByPartID(intPartID); intRecordsReturned = TheFindPartByPartIDataSet.FindPartByPartID.Rows.Count; if (intRecordsReturned > 0) { blnItemFound = true; //loading the controls txtJDEPartNumber.Text = TheFindPartByPartIDataSet.FindPartByPartID[0].JDEPartNumber; txtPartDescription.Text = TheFindPartByPartIDataSet.FindPartByPartID[0].PartDescription; txtPartID.Text = Convert.ToString(intPartID); txtPartNumber.Text = TheFindPartByPartIDataSet.FindPartByPartID[0].PartNumber; blnItemFound = true; } } if (blnItemFound == false) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { txtJDEPartNumber.Text = strPartNumber; txtPartDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; txtPartID.Text = Convert.ToString(TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID); txtPartNumber.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber; } else { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { txtJDEPartNumber.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; txtPartDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; txtPartID.Text = Convert.ToString(TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID); txtPartNumber.Text = strPartNumber; } else { TheMessagesClass.ErrorMessage("Part Number Not Found"); return; } } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Part Number Lookup // Find Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnImportExcel_Click(object sender, RoutedEventArgs e) { Excel.Application xlDropOrder; Excel.Workbook xlDropBook; Excel.Worksheet xlDropSheet; Excel.Range range; int intColumnRange = 0; int intCounter; int intNumberOfRecords; int intPartID = 0; string strPartNumber; string strJDEPartNumber; string strPartDescription; int intNewQuantity; int intRecordsReturned; string strLocation; try { TheImportInventoryDataSet.importinventory.Rows.Clear(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".xlsx"; // Default file extension dlg.Filter = "Excel (.xlsx)|*.xlsx"; // Filter files by extension // Show open file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document string filename = dlg.FileName; } xlDropOrder = new Excel.Application(); xlDropBook = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1); range = xlDropSheet.UsedRange; intNumberOfRecords = range.Rows.Count; intColumnRange = range.Columns.Count; strLocation = txtEnterLocation.Text; if (strLocation.Length < 2) { TheMessagesClass.ErrorMessage("The Location is not Long Enough"); return; } for (intCounter = 2; intCounter < intNumberOfRecords; intCounter++) { strPartNumber = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper(); strJDEPartNumber = strPartNumber; strPartDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper(); intNewQuantity = Convert.ToInt32((range.Cells[intCounter, 3] as Excel.Range).Value2); TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; } else if (intRecordsReturned < 1) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { intPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; strPartNumber = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber; strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; } else if (intRecordsReturned < 1) { intPartID = intCounter * -1; } } ImportInventoryDataSet.importinventoryRow NewPartRow = TheImportInventoryDataSet.importinventory.NewimportinventoryRow(); NewPartRow.CurrentCount = intNewQuantity; NewPartRow.JDEPartNumber = strJDEPartNumber; NewPartRow.OldCount = 0; NewPartRow.OldPartNumber = "NO PART FOUND"; NewPartRow.PartDescription = strPartDescription; NewPartRow.PartID = intPartID; NewPartRow.PartNumber = strPartNumber; NewPartRow.Location = strLocation; TheImportInventoryDataSet.importinventory.Rows.Add(NewPartRow); } dgrInventory.ItemsSource = TheImportInventoryDataSet.importinventory; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Convert Inventoryt // Main Window // Import Excel " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnProcess_Click(object sender, RoutedEventArgs e) { bool blnThereIsAProblem = false; bool blnFatalError = false; string strErrorMessage = ""; string strProjectID; string strPartNumber; string strPONumber; string strAssignedReelID; int intReelFootage = 0; int intRecordsReturned; string strValueForValidation; DateTime datTransactionDate = DateTime.Now; int intPartID = 0; int intTransactionID; int intTotalFootage; try { blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Cable Reel "); if (blnFatalError == true) { throw new Exception(); } if (cboSelectWarehouse.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Warehouse Was Not Selected\n"; } strProjectID = txtProjectID.Text; if (strProjectID.Length < 3) { blnFatalError = true; strErrorMessage += "The Project ID is not Long Enough\n"; } else { TheFindProjectMatrixByCustomerIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Project ID Was Not Found\n"; } } else if (intRecordsReturned > 0) { MainWindow.gintProjectID = TheFindProjectMatrixByCustomerIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID; } } strPartNumber = txtPartNumber.Text; if (strPartNumber.Length < 3) { blnFatalError = true; strErrorMessage += "The Part Number is not Long Enough\n"; } else { TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned < 1) { blnFatalError = true; strErrorMessage += "The Part Number Was Not Found\n"; } else if (intRecordsReturned > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; } } if (cboSelectEmployee.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The Employee Was Not Selected\n"; } strPONumber = txtPONumber.Text; if (strPONumber.Length < 3) { blnFatalError = true; strErrorMessage += "The MSR/PO Number is not Long Enough\n"; } strAssignedReelID = txtAssignedReelID.Text; if (strAssignedReelID.Length < 3) { blnFatalError = true; strErrorMessage += "The Assigned Reel ID is not Long Enough\n"; } else { TheFindCableReelIDByAssignedCableReelIDDataSet = TheCableInventoryClass.FindCableReelIDByAssignedCableReelID(strAssignedReelID); intRecordsReturned = TheFindCableReelIDByAssignedCableReelIDDataSet.FindCableReelIDByAssignedCableReelID.Rows.Count; if (intRecordsReturned > 0) { blnFatalError = true; strErrorMessage += "The Assigned Reel ID has been Used\n"; } } strValueForValidation = txtReelFootage.Text; blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Reel Footage is not an Integer\n"; } else { intReelFootage = Convert.ToInt32(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } //adding cable reel if (gblnReelIDChecked == true) { blnFatalError = TheCableInventoryClass.UpdateCableAssignedReelID(gintReelID, strAssignedReelID); if (blnFatalError == true) { throw new Exception(); } } else if (gblnReelIDChecked == false) { blnFatalError = TheCableInventoryClass.InsertCableReelID(datTransactionDate, intPartID, MainWindow.gintEmployeeID, strAssignedReelID); if (blnFatalError == true) { throw new Exception(); } } TheFindCableReelIDByAssignedCableReelIDDataSet = TheCableInventoryClass.FindCableReelIDByAssignedCableReelID(strAssignedReelID); gintReelID = TheFindCableReelIDByAssignedCableReelIDDataSet.FindCableReelIDByAssignedCableReelID[0].CableReelID; //inserting the reel into the table blnFatalError = TheCableInventoryClass.InsertCableReelInventory(intPartID, MainWindow.gintWarehouseID, strAssignedReelID, intReelFootage); if (blnFatalError == true) { throw new Exception(); } //updating total footage TheFindCableTotalInventoryByPartWarehouseDataSet = TheCableInventoryClass.FindCableTotalInventoryByPartWarehouse(MainWindow.gintWarehouseID, intPartID); intRecordsReturned = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse.Rows.Count; if (intRecordsReturned > 0) { intTransactionID = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse[0].TransactionID; intTotalFootage = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse[0].TotalFootage; intTotalFootage = intTotalFootage + intReelFootage; blnFatalError = TheCableInventoryClass.UpdateCableIventoryTotalFootage(intTransactionID, intTotalFootage); if (blnFatalError == true) { throw new Exception(); } } else if (intRecordsReturned < 1) { blnFatalError = TheCableInventoryClass.InsertCableTotalInventory(intPartID, MainWindow.gintWarehouseID, intReelFootage); if (blnFatalError == true) { throw new Exception(); } } TheMessagesClass.InformationMessage("Cable Reel Has Been Received"); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Cable Reel // Process Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFind_Click(object sender, RoutedEventArgs e) { //setting local variables string strValueForValidation; string strErrorMessage = ""; bool blnThereIsAProblem = false; bool blnFatalError = false; int intSelectedIndex; int intRecordsReturned; string strPartDescription; try { intSelectedIndex = cboSendingWarehouse.SelectedIndex; if (intSelectedIndex < 1) { blnFatalError = true; strErrorMessage += "Sending Warehouse Not Selected\n"; } MainWindow.gstrPartNumber = txtEnterPartNumber.Text; if (MainWindow.gstrPartNumber == "") { blnFatalError = true; strErrorMessage += "Part Number Was Not Entered\n"; } strValueForValidation = txtEnterQuantity.Text; blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "Quantity is not an Integer\n"; } else { gintQuantity = Convert.ToInt32(strValueForValidation); } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(MainWindow.gstrPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(MainWindow.gstrPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.InformationMessage("Part Number Was Not Found"); return; } else { MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; } } else { MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; } TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(MainWindow.gintPartID, gintSendingWarehouseID); intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.InformationMessage("The Part in this Warehouse Does Not Exist"); return; } else if (gintQuantity > TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity) { TheMessagesClass.ErrorMessage("Quantity Transfered Cannot Be Greater that Warehouse Quantity"); return; } else { txtPartDescription.Text = strPartDescription; gintSendingTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID; gintSendingQuantity = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity; } cboReceivingWarehouse.IsEnabled = true; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Transfer Inventory // Find Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFindPart_Click(object sender, RoutedEventArgs e) { string strPartNumber; int intNumberOfRecords; int intCounter; int intPartID; bool blnFatalError = false; string strJDEPartNumber; string strPartDescription; int intRecordsReturned; string strOldPartNumber; try { blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Part Lookup"); if (blnFatalError == true) { throw new Exception(); } ThePartLookupDataSet.partlookup.Rows.Clear(); strPartNumber = txtEnterPartInformation.Text; if (strPartNumber.Length < 1) { TheMessagesClass.ErrorMessage("The Part Information Was Not Entered"); return; } //part number search TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intNumberOfRecords = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intNumberOfRecords > 0) { intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID; strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber; strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription; TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID); strOldPartNumber = "NONE FOUND"; intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count; if (intRecordsReturned > 0) { strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber; } PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow(); NewPartRow.JDEPartNumber = strJDEPartNumber; NewPartRow.OldPartNumber = strOldPartNumber; NewPartRow.PartDescription = strPartDescription; NewPartRow.PartID = intPartID; NewPartRow.PartNumber = strPartNumber; ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow); } else if (intNumberOfRecords < 1) { strJDEPartNumber = strPartNumber; TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber); intNumberOfRecords = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intNumberOfRecords > 0) { strPartNumber = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber; intPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID; strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription; TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID); strOldPartNumber = "NONE FOUND"; intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count; if (intRecordsReturned > 0) { strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber; } PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow(); NewPartRow.JDEPartNumber = strJDEPartNumber; NewPartRow.OldPartNumber = strOldPartNumber; NewPartRow.PartDescription = strPartDescription; NewPartRow.PartID = intPartID; NewPartRow.PartNumber = strPartNumber; ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow); } else if (intNumberOfRecords < 1) { strPartDescription = strPartNumber; TheFindPartByDescriptionKeyWordDataSet = ThePartNumberClass.FindPartByDescriptionKeyWord(strPartDescription); intNumberOfRecords = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord.Rows.Count; if (intNumberOfRecords < 1) { TheMessagesClass.ErrorMessage("The Part Was Not Found"); return; } else if (intNumberOfRecords > 1) { for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++) { intPartID = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartID; strPartNumber = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartNumber; strJDEPartNumber = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].JDEPartNumber; strPartDescription = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartDescription; TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID); strOldPartNumber = "NONE FOUND"; intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count; if (intRecordsReturned > 0) { strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber; } PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow(); NewPartRow.JDEPartNumber = strJDEPartNumber; NewPartRow.OldPartNumber = strOldPartNumber; NewPartRow.PartDescription = strPartDescription; NewPartRow.PartID = intPartID; NewPartRow.PartNumber = strPartNumber; ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow); } } } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Part Lookup // Find Part Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnFind_Click(object sender, RoutedEventArgs e) { //setting local variables string strPartNumber; int intRecordsReturned; try { //data validation strPartNumber = txtEnterPartNumber.Text; if (strPartNumber == "") { TheMessagesClass.ErrorMessage("Part Number Was Not Entered"); return; } //checking to see if the part number exists within the part table //checking JDE Part Number TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table"); return; } //checking part number TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber); intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table"); return; } TheFindPartFromMasterPartListByJDEPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByJDEPartNumber(strPartNumber); intRecordsReturned = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheFindPartFromMasterPartListByPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByPartNumber(strPartNumber); intRecordsReturned = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber.Rows.Count; if (intRecordsReturned == 0) { TheMessagesClass.ErrorMessage("The Part Number Entered is not in the Master Part List"); return; } else { txtDescription.Text = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].PartDescription; txtJDEPartNumber.Text = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].JDEPartNumber; txtPartID.Text = Convert.ToString(TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].PartID); txtPartNumber.Text = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].PartNumber; txtPrice.Text = Convert.ToString(TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].Price); } } else { txtDescription.Text = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].PartDescription; txtJDEPartNumber.Text = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].JDEPartNumber; txtPartID.Text = Convert.ToString(TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].PartID); txtPartNumber.Text = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].PartNumber; txtPrice.Text = Convert.ToString(TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].Price); } } catch (Exception Ex) { TheEventlogClass.InsertEventLogEntry(DateTime.Now, "Add Parts Part From Master List Find Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }