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); }
/*************************** * Volume Quote Helper Calculations * *************************/ private void linearToCubicEntry(object sender, EventArgs e) { int input; TextBox inputBox = (TextBox)sender; if (int.TryParse(inputBox.Text, out input)) { if (inputBox == linInchBox) { input /= 12; } cubeOutputLabel.Text = PalletCalc.linearToCubicCalc(input).ToString(); } else { cubeOutputLabel.Text = ""; } }
public static string calcClass(PalletGroup current) { double poundsPer = PalletCalc.getPCF(current); if (poundsPer >= 50) { return(50.ToString()); } else if (poundsPer < 50 && poundsPer >= 35) { return(55.ToString()); } else if (poundsPer < 35 && poundsPer >= 30) { return(60.ToString()); } else if (poundsPer < 30 && poundsPer >= 22.5) { return(65.ToString()); } else if (poundsPer < 22.5 && poundsPer >= 15) { return(70.ToString()); } else if (poundsPer < 15 && poundsPer >= 13.5) { return(77.5.ToString()); } else if (poundsPer < 13.5 && poundsPer >= 12) { return(85.ToString()); } else if (poundsPer < 12 && poundsPer >= 10.5) { return(92.5.ToString()); } else if (poundsPer < 10.5 && poundsPer >= 9) { return(100.ToString()); } else if (poundsPer < 9 && poundsPer >= 8) { return(110.ToString()); } else if (poundsPer < 8 && poundsPer >= 7) { return(125.ToString()); } else if (poundsPer < 7 && poundsPer >= 6) { return(150.ToString()); } else if (poundsPer < 6 && poundsPer >= 5) { return(175.ToString()); } else if (poundsPer < 5 && poundsPer >= 4) { return(200.ToString()); } else if (poundsPer < 4 && poundsPer >= 3) { return(250.ToString()); } else if (poundsPer < 3 && poundsPer >= 2) { return(300.ToString()); } else if (poundsPer < 2 && poundsPer >= 1) { return(400.ToString()); } else { return(500.ToString()); } }
private void calcFreighClass() { PalletGroup current = getPalletAtIndex(boxListBox.SelectedIndex); calcDensityLabel.Text = PalletCalc.calcClass(current); }