private void GenerateNewPanels() { for (int i = 0; i < temporaryDepartments.Count; i++) { DepartmentSettingPanel panel = null; if (temporaryDepartments[i] is ProcessingDepartment) { ProcessingDepartment pDp = (ProcessingDepartment)temporaryDepartments[i]; //Keep the higher sorter set the same if (pDp.SortsHigherWeights) { panel = new DepartmentSettingPanel( pDp, this, DepartmentSettingPanel.SettingPanelType.highestProcessingDp); } else { panel = new DepartmentSettingPanel( pDp, this, DepartmentSettingPanel.SettingPanelType.ProcessingDp); } } //Set the insurance panel if (temporaryDepartments[i] is InsuranceDepartment) { InsuranceDepartment iDp = (InsuranceDepartment)temporaryDepartments[i]; panel = new DepartmentSettingPanel( iDp, this, DepartmentSettingPanel.SettingPanelType.InsuranceDp); } DSPanels.Add(panel); } }
private void GenerateDepartmentButtons() { List <DepartmentPanel> parcelPanels = new List <DepartmentPanel>(); for (int i = 0; i < ObjectInstances.departments.Length; i++) { DepartmentPanel parcelPanel = new DepartmentPanel(i, this); string text = ObjectInstances.departments[i].Name; if (ObjectInstances.departments[i] is ProcessingDepartment) { ProcessingDepartment PD = (ProcessingDepartment)ObjectInstances.departments[i]; if (PD.SortsHigherWeights) { text += WeightHighSepText + PD.WeightClass + WeightText; } else { text += WeightLowSepText + PD.WeightClass + WeightText; } } parcelPanel.Departmentbutton.Text = text; parcelPanels.Add(parcelPanel); } DepartmentLayoutPanel.Controls.AddRange(parcelPanels.ToArray()); }
private void WeightNumericBox_ValueChanged(object sender, EventArgs e) { if (dep is ProcessingDepartment) { ProcessingDepartment pD = (ProcessingDepartment)dep; pD.SetWeight((int)WeightNumericBox.Value); dep = pD; } else if (dep is InsuranceDepartment) { InsuranceDepartment iD = (InsuranceDepartment)dep; iD.setSigningPrice((float)WeightNumericBox.Value); dep = iD; } }
private void NewDepButton_Click(object sender, EventArgs e) { List <Department> deps = new List <Department>(); deps.AddRange(temporaryDepartments); ProcessingDepartment pDp = new ProcessingDepartment("New department", 1, false); deps.Add(pDp); temporaryDepartments = deps; ReOrderList(); RefreshList(); }
public void TransferParcelToAnotherDepartment() { // Arrange Parcel parcelLight = new Parcel(); ProcessingDepartment dep1 = new ProcessingDepartment("", 2, false); ProcessingDepartment dep2 = new ProcessingDepartment("", 2, false); // Act dep1.AddParcel(parcelLight); dep2.TransferOut(parcelLight, dep1); //Should not transfer anything dep1.TransferOut(parcelLight, dep2); // Assert Assert.AreEqual(0, dep1.Parcels.Count, "Transfer to Dep1 went wrong"); Assert.AreEqual(1, dep2.Parcels.Count, "Transfer to Dep2 went wrong"); }
public DepartmentSettingPanel(Department dep, SettingsScreen settingsScreen, SettingPanelType type) { InitializeComponent(); this.dep = dep; this.settingsScreen = settingsScreen; panelType = type; NameTextBox.Text = dep.Name; if (dep is ProcessingDepartment) { ProcessingDepartment pD = (ProcessingDepartment)dep; depWeightClass = pD.WeightClass; WeightNumericBox.Value = (decimal)depWeightClass; } else if (dep is InsuranceDepartment) { InsuranceDepartment iD = (InsuranceDepartment)dep; depPriceInsuranceClass = iD.MinSigningPrice; WeightNumericBox.Value = (decimal)depPriceInsuranceClass; } SetTypeChanges(); }