public void checkSwap() { bool needsSwap = false; PalletGroup swappedPallet = new PalletGroup(this.Length, this.Width, this.Height, this.NumPiece); swappedPallet.SwapDims(); if (this.Length <= 96) { if (this.NumPiece == 1 && this.Width < this.Length) { needsSwap = true; } else if (this.Width > 48 && this.Length <= 48) { needsSwap = true; } else if (this.Length <= 48 && this.Width < this.Length) { needsSwap = true; } else if (PalletCalc.calcLinFeet(swappedPallet, false) < PalletCalc.calcLinFeet(this, false)) { needsSwap = true; } } if (needsSwap) { this.SwapDims(); } }
//calculates the linear feet of the group selected private void calcButton_Click(object sender, EventArgs e) { PalletGroup calcOnePallet; int linearFeet; calcOnePallet = getPalletAtIndex(boxListBox.SelectedIndex); linearFeet = PalletCalc.calcLinFeet(calcOnePallet, true); resultTextBox.Text = linearFeet.ToString(); cubicFeetResult.Text = (linearFeet * 64).ToString(); calcFreighClass(); }
//calculates the linear feet of all groups in the listbox private int calcAllLinFeet() { int linFeetTotal = 0; int totalWeight = 0; for (int i = 0; i < boxListBox.Items.Count; i++) { PalletGroup j = getPalletAtIndex(i); linFeetTotal += PalletCalc.calcLinFeet(j, false); totalWeight += j.Weight; } if (linFeetTotal < totalWeight / 1000) { return(totalWeight / 1000); } return(linFeetTotal); }