fixed init when Port has been preselected but no berth
This commit is contained in:
parent
74b15e4b64
commit
4acf8d7c29
@ -50,7 +50,6 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
|
|
||||||
|
|
||||||
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
|
||||||
Array types = Enum.GetValues(typeof(ShipcallType));
|
Array types = Enum.GetValues(typeof(ShipcallType));
|
||||||
@ -62,9 +61,6 @@ namespace BreCalClient
|
|||||||
else first = false;
|
else first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
|
|
||||||
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;
|
|
||||||
|
|
||||||
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
|
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
|
||||||
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports.Where(x => App.Participant.Ports.Contains(x.Id));
|
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports.Where(x => App.Participant.Ports.Contains(x.Id));
|
||||||
|
|
||||||
@ -327,7 +323,7 @@ namespace BreCalClient
|
|||||||
this.comboBoxCategories.SelectedItem = new EnumToStringConverter().Convert(this.ShipcallModel.Shipcall.Type, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
|
this.comboBoxCategories.SelectedItem = new EnumToStringConverter().Convert(this.ShipcallModel.Shipcall.Type, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
|
||||||
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
|
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
|
||||||
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
|
||||||
// this.textBoxVoyage.Text = this.ShipcallModel.Shipcall.Voyage;
|
|
||||||
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
|
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
|
||||||
if (BreCalLists.Ships.Find(x => x.Ship.Id == this.ShipcallModel.Shipcall.ShipId) != null)
|
if (BreCalLists.Ships.Find(x => x.Ship.Id == this.ShipcallModel.Shipcall.ShipId) != null)
|
||||||
{
|
{
|
||||||
@ -338,6 +334,16 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
|
||||||
|
|
||||||
|
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
|
||||||
|
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
|
||||||
|
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
|
||||||
|
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
|
||||||
|
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
|
||||||
|
|
||||||
|
// Filter agency combobox by port
|
||||||
|
List<Participant> availableAgencies = BreCalLists.GetParticipants(this.ShipcallModel.Shipcall.PortId, ParticipantType.AGENCY);
|
||||||
|
this.comboBoxAgency.ItemsSource = availableAgencies;
|
||||||
|
|
||||||
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
|
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
|
||||||
{
|
{
|
||||||
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
|
||||||
@ -359,8 +365,6 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
|
|
||||||
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
|
|
||||||
this.comboBoxHarbour.SelectionChanged += this.comboBoxHarbour_SelectionChanged;
|
this.comboBoxHarbour.SelectionChanged += this.comboBoxHarbour_SelectionChanged;
|
||||||
|
|
||||||
this.comboBoxHarbour.IsEnabled = this.ShipcallModel.AllowPortChange;
|
this.comboBoxHarbour.IsEnabled = this.ShipcallModel.AllowPortChange;
|
||||||
|
|||||||
Reference in New Issue
Block a user