private void UpdateListOfAircraftsOfDetail(AbstractDetail detail) { List <Aircraft> aircrafts; if (detail is BaseDetail) { aircrafts = ((Operator)detail.Parent.Parent).Aircrafts; } else { aircrafts = ((Operator)detail.Parent.Parent.Parent).Aircrafts; } comboBoxBaseDetailContainer.Items.Clear(); TransferRecord transferRecord = detail.GetPreLastTransferRecord(); int aircraftID = transferRecord != null ? transferRecord.TransferContainer != null ? transferRecord.TransferContainer.Id : -1 : -1; int selectedIndex = 0; for (int i = 0; i < aircrafts.Count; i++) { comboBoxBaseDetailContainer.Items.Add(aircrafts[i]); if (aircrafts[i].ID == aircraftID) { selectedIndex = i; } } if (comboBoxBaseDetailContainer.Items.Count > 0) { comboBoxBaseDetailContainer.SelectedIndex = selectedIndex; } }
private void UpdateListOfStoresOfDetail(AbstractDetail detail) { List <Store> stores; if (detail is BaseDetail) { stores = ((Operator)detail.Parent.Parent).Stores; } else { stores = ((Operator)detail.Parent.Parent.Parent).Stores; } comboBoxBaseDetailContainer.Items.Clear(); TransferRecord transferRecord = detail.GetPreLastTransferRecord(); int storeID = transferRecord != null ? transferRecord.TransferContainer != null ? transferRecord.TransferContainer.Id : -1 : -1; int selectedIndex = 0; for (int i = 0; i < stores.Count; i++) { if (currentContainer == null || stores[i].ID != currentContainer.ID) { comboBoxBaseDetailContainer.Items.Add(stores[i]); } if (stores[i].ID == storeID) { selectedIndex = i; } } if (comboBoxBaseDetailContainer.Items.Count > 0) { comboBoxBaseDetailContainer.SelectedIndex = selectedIndex; } }
private void UpdateListOfBaseDetailsOfDetail(AbstractDetail detail) { comboBoxBaseDetails.Items.Clear(); TransferRecord transferRecord = detail.GetPreLastTransferRecord(); int baseDetailID = transferRecord != null ? transferRecord.TransferContainer != null ? transferRecord.TransferContainerId : -1: -1; int selectedIndex = 0; for (int i = 0; i < checkedBaseDetailContainer.BaseDetails.Length; i++) { comboBoxBaseDetails.Items.Add(checkedBaseDetailContainer.BaseDetails[i]); if (checkedBaseDetailContainer.BaseDetails[i].ID == baseDetailID) { selectedIndex = i; } } if (comboBoxBaseDetails.Items.Count > 0) { comboBoxBaseDetails.SelectedIndex = selectedIndex; } }
private void UpdateInformation() { textBoxSerialNumber.Text = "S/N " + currentDetail.SerialNumber; textBoxPartNumber.Text = "P/N " + currentDetail.PartNumber; TransferRecord preRecord = currentDetail.GetPreLastTransferRecord(); if (preRecord != null) { if (preRecord.TransferContainer is Aircraft || preRecord.TransferContainer is BaseDetail) { Aircraft aircraft; Store store = null; if (preRecord.TransferContainer is Aircraft) { aircraft = (Aircraft)preRecord.TransferContainer; } else { BaseDetail baseDetail = (BaseDetail)preRecord.TransferContainer; aircraft = baseDetail.ParentAircraft; if (aircraft.Type == AircraftType.Store) { store = baseDetail.Store; } } if (store != null) { textBoxFrom.Text = store.Name; labelFromAdditional.Text = "Location:"; textBoxFromAdditional.Text = preRecord.Position; } else { textBoxFrom.Text = aircraft.RegistrationNumber; labelFromAdditional.Text = "Position:"; textBoxFromAdditional.Text = preRecord.Position; } } } textBoxDate.Text = currentRecord.RecordDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()); if (currentRecord.TransferContainer is Aircraft || currentRecord.TransferContainer is BaseDetail) { Aircraft aircraft; Store store = null; if (currentRecord.TransferContainer is Aircraft) { aircraft = (Aircraft)currentRecord.TransferContainer; } else { BaseDetail baseDetail = (BaseDetail)currentRecord.TransferContainer; aircraft = baseDetail.ParentAircraft; if (aircraft.Type == AircraftType.Store) { store = baseDetail.Store; } } if (store != null) { textBoxTo.Text = store.Name; labelToAdditional.Text = "Location:"; textBoxToAdditional.Text = currentRecord.Position; } else { textBoxTo.Text = aircraft.RegistrationNumber; labelToAdditional.Text = "Position:"; textBoxToAdditional.Text = currentRecord.Position; } } textBoxRemarks.Text = currentRecord.Description; }