// Copyright (c) 2017 schick Informatik // Description: // using System.Windows; using ENI2.Controls; using bsmd.database; namespace ENI2.EditControls { /// /// Interaction logic for EditPortOfCallLast30Days.xaml /// public partial class EditPortOfCallLast30DaysDialog : EditWindowBase { public EditPortOfCallLast30DaysDialog() { InitializeComponent(); Loaded += EditPortOfCallLast30DaysDialog_Loaded; AddClicked += () => { this.locodeControlPortName.Focus(); }; this.checkBoxCrewMembersJoined.Checked += CheckBoxCrewMembersJoined_Checked; this.checkBoxCrewMembersJoined.Unchecked += CheckBoxCrewMembersJoined_Checked; } private void CheckBoxCrewMembersJoined_Checked(object sender, RoutedEventArgs e) { this.textBoxCrewMemberNames.IsEnabled = this.checkBoxCrewMembersJoined.IsChecked ?? false; } public PortOfCallLast30Days PocLast30Days { get; set; } private void EditPortOfCallLast30DaysDialog_Loaded(object sender, RoutedEventArgs e) { this.OKClicked += EditPortOfCallLast30DaysDialog_OKClicked; // copy into fields this.locodeControlPortName.LocodeValue = this.PocLast30Days.PortOfCallLast30DaysLocode; this.datePickerATAPortOfCall.SelectedDate = this.PocLast30Days.PortOfCallLast30DaysDateOfDeparture; this.checkBoxCrewMembersJoined.IsChecked = this.PocLast30Days.PortOfCallLast30DaysCrewMembersJoined; this.textBoxCrewMemberNames.Text = this.PocLast30Days.CrewMembersJoinedText; this.textBoxCrewMemberNames.IsEnabled = this.PocLast30Days.PortOfCallLast30DaysCrewMembersJoined ?? false; this.AddVisible = true; } public void CopyValuesToEntity() { // copy back this.PocLast30Days.PortOfCallLast30DaysLocode = this.locodeControlPortName.LocodeValue; this.PocLast30Days.PortOfCallLast30DaysDateOfDeparture = this.datePickerATAPortOfCall.SelectedDate; this.PocLast30Days.PortOfCallLast30DaysCrewMembersJoined = this.checkBoxCrewMembersJoined.IsChecked; this.PocLast30Days.CrewMembersJoinedText = this.textBoxCrewMemberNames.Text; } private void EditPortOfCallLast30DaysDialog_OKClicked() { this.CopyValuesToEntity(); } } }