Пример #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();
                }
            }
        }
Пример #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();
                }
            }
        }
Пример #3
0
        private void ChangedFullNameBtnOnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(FullNameTxtBox.Text))
            {
                FullNameTxtBox.Focus();
                return;
            }

            SourceMember.ChangedFullName(
                FullNameTxtBox.Text,
                SinceDateTimePicker.Value
                );

            UpdateFullNamesListBox();
            SinceDateTimePicker.Focus();
        }
Пример #4
0
 private void WithoutPartnerBtnOnClick(object sender, EventArgs e)
 {
     try
     {
         SourceMember.WithoutPartner(SinceDateTimePicker.Value);
         UpdatePartnersListBox();
         UpdateStatusesListBox();
         UpdatePartnersComboBox();
         UpdateButtons();
     }
     catch (Exception ex)
     {
         if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK)
         {
             SinceDateTimePicker.Focus();
         }
     }
 }