Example #1
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();
                }
            }
        }
Example #2
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();
                }
            }
        }