Beispiel #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (EmptyChecker.TryTextFieldsEmpty(Controls))
     {
         MessageBox.Show("Please make sure you enter a value for all text fields", "Value empty error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     TextBoxParser.TextBoxChecker(Controls);
     if (typeSubCombo.Text == "")
     {
         MessageBox.Show("Please choose an subscription model before pressing save.", "Subscription model empty",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (!_subscriberRepo.AddSubscriber(nameTextBox.Text, surnameTextBox.Text, dateOfBirthPicker.Value,
                                        DateTime.Today,
                                        _subscriptionRepo.GetSubscriptionByCategory(typeSubCombo.Text)))
     {
         MessageBox.Show("This person is already an subscriber", "Subscriber exists error", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
         return;
     }
     NewForm();
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (EmptyChecker.TryTextFieldsEmpty(Controls))
     {
         MessageBox.Show("Please make sure you enter a value for all text fields", "Value empty error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     TextBoxParser.TextBoxChecker(Controls);
     if (!_subscriberRepo.EditSubscriber(_subscriberRepo.GetAllSubscriber()[_index].SubscriberId,
                                         nameTextBox.Text,
                                         surnameTextBox.Text, dateOfBirthPicker.Value, dateOfRenewalPicker.Value,
                                         _subscriptionRepo.GetSubscriptionByCategory(typeSubCombo.Text)))
     {
         MessageBox.Show("This person is already an subscriber", "Subscriber exists error", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
         return;
     }
     SetData();
 }