Beispiel #1
0
        private void WithPartnerBtnOnClick(object sender, EventArgs e)
        {
            if (PartnersComboBox.SelectedIndex < 1)
            {
                PartnersComboBox.Focus();
                return;
            }

            try
            {
                SourceMember.WithPartner(
                    EnumerablePartners.ElementAt(PartnersComboBox.SelectedIndex - 1),
                    SinceDateTimePicker.Value
                    );
                UpdatePartnersListBox();
                UpdatePartnersComboBox();
                UpdateButtons();
                SinceDateTimePicker.Focus();
            }
            catch (Exception ex)
            {
                if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK)
                {
                    PartnersComboBox.Focus();
                }
            }
        }
Beispiel #2
0
        private void GotMarriedBtnOnClick(object sender, EventArgs e)
        {
            if (PartnersComboBox.SelectedIndex == -1 || (
                    PartnersComboBox.SelectedIndex == 0 &&
                    !SourceMember.HadPartner(SinceDateTime)
                    ))
            {
                PartnersComboBox.Focus();
                return;
            }

            try
            {
                SourceMember.GotMarried(
                    SinceDateTimePicker.Value,
                    PartnersComboBox.SelectedIndex > 0 ?
                    EnumerablePartners.ElementAt(PartnersComboBox.SelectedIndex - 1)
                        :
                    null
                    );

                UpdatePartnersListBox();
                UpdateStatusesListBox();
                UpdatePartnersComboBox();
                UpdateButtons();
                SinceDateTimePicker.Focus();
            }
            catch (Exception ex)
            {
                if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK)
                {
                    PartnersComboBox.Focus();
                }
            }
        }
Beispiel #3
0
 private void UpdateButtons()
 {
     WithoutPartnerBtn.Enabled = SourceMember.HadPartner(SinceDateTime);
     GotUnmarriedBtn.Enabled   = SourceMember.WasMarried(SinceDateTime);
     GotMarriedBtn.Enabled     = !GotUnmarriedBtn.Enabled && (
         EnumerablePartners.Any() || SourceMember.HadPartner(SinceDateTime)
         );
     WithPartnerBtn.Enabled            = !WithoutPartnerBtn.Enabled && EnumerablePartners.Any();
     ClearPartnersHistoryBtn.Enabled   = EnumerablePartnersHistory.Count() > 1;
     RemoveSelectedFullNameBtn.Enabled = FullNamesListBox.SelectedIndex > 0;
 }