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 (genreCombo.Text == "" || authorCombo.Text == "" || publisherCombo.Text == "") { MessageBox.Show("Please choose an value for all drop down menus before clicking save", "Combobox empty error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!_typeBookRepo.AddBooks(titleTextBox.Text, numberTextBox.Text, _genreRepo.GetGenreByText(genreCombo.Text), _authorRepo.GetAuthorByName(authorCombo.Text), _publisherRepo.GetPublisherByName(publisherCombo.Text), int.Parse(copiesTextBox.Text))) { MessageBox.Show("There is already an book with this title from this publisher.", "Type of book exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } StartingPoint(); }
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 (institutionComboBox.Text == "") { MessageBox.Show("Please pick an institution before trying to save", "Institution empty error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!_memberRepo.AddMember(nameTextBox.Text, surnameTextBox.Text, dateOfBirthPicker.Value, isProfessorCheckBox.Checked, _institutionRepo.GetInstitutionByName(institutionComboBox.Text))) { MessageBox.Show("This person is already an member.", "Member 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 (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(); }
public void GetInstanceTest() { TextBoxParser parser1 = TextBoxParser.GetInstance; TextBoxParser parser2 = TextBoxParser.GetInstance; Assert.AreSame(parser1, parser2); }
public Main() { InitializeComponent(); InitialiseCommandTypes(); SetupTextBoxValidationClearDown(tlpGoto.Controls, Color.White, Color.Black); SetupTextBoxValidationClearDown(tlpHome.Controls, Color.White, Color.Black); _rtbLogger = new RichTextBoxLogger(rtbLog); _textBoxParser = new TextBoxParser(); _checkSummer = new ModCheckSummer(); _sender = new MultiSender(new List <ISender> { new TestSender(_rtbLogger) }); btnSend.Click += (s, e) => SendButtonClicked(); }
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 (!_publisherRepo.AddPublisher(nameTextBox.Text, countryTextBox.Text)) { MessageBox.Show("There's already an publisher with this name.", "Publisher exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } nameTextBox.Text = ""; countryTextBox.Text = ""; }
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 (!_authorRepo.EditAuthor(_authorRepo.GetAllAuthors()[_index].AuthorId, nameTextBox.Text, surnameTextBox.Text)) { MessageBox.Show("Error editing Author, publisher with name and surname already exists", "Author exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SetData(); }
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 (!_institutionRepo.EditInstitution(_institutionRepo.GetAllInstitutions()[_index].InstitutionId, nameTextBox.Text, addressTextBox.Text)) { MessageBox.Show("Institution with that name already exists", "Institution exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SetData(); }
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 (!_staffRepo.EditStaff(_staffRepo.GetAllStaff()[_index].StaffId, nameTextBox.Text, surnameTextBox.Text, dateOfBirthPicker.Value, (StaffPosition)Enum.Parse(typeof(StaffPosition), comboPosition.Text))) { MessageBox.Show("This person already exists", "Person exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SetData(); }
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 (!_subscriptionRepo.EditSubscription(_subscriptionRepo.GetAllSubscriptionTypes()[_index].SubscriptionId, catNameTextBox.Text, int.Parse(bookLimitTextBox.Text), int.Parse(priceTextBox.Text))) { MessageBox.Show("Subscription category with this name already exists", "Subscription model exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SetData(); }
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 (!_institutionRepo.AddInstitution(nameTextBox.Text, addressTextBox.Text)) { MessageBox.Show("There's already an institution called like this", "Institution exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } nameTextBox.Text = ""; addressTextBox.Text = ""; }
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 (!_publisherRepo.EditPublisher(_publisherRepo.GetAllPublisher()[_index].PublisherId, nameTextBox.Text, countryTextBox.Text)) { MessageBox.Show("Publisher with this name already exists", "Publisher exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SetData(); }
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 (!_subscriptionRepo.AddSubscription(catNameTextBox.Text, int.Parse(bookLimitTextBox.Text), int.Parse(priceTextBox.Text))) { MessageBox.Show("Subscription category has been already added", "Subscription 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 (!_memberRepo.EditMember(_memberRepo.GetAllMembers()[_index].MemberId, nameTextBox.Text, surnameTextBox.Text, dateOfBirthPicker.Value, isProfessorCheckBox.Checked, _institutionRepo.GetInstitutionByName(institutionComboBox.Text))) { MessageBox.Show("This person is already an member", "Member exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SetData(); }
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(); }
private void btnSave_Click(object sender, EventArgs e) { if (descriptionTextBox.Text == "") { descriptionTextBox.Text = "-"; } 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 (!_genreRepo.EditGenre(_genreRepo.GetAllGenres()[_index].GenreId, genreTextBox.Text, descriptionTextBox.Text)) { MessageBox.Show("Genre with this name already exists", "Genre exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); } SetData(); }
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); var returnValue = _typeBook.EditBook(_typeBook.GetAllBookTypes()[_index].TypeBookId, titleTextBox.Text, numberTextBox.Text, _genreRepo.GetGenreByText(genreCombo.Text), _authorRepo.GetAuthorByName(authorCombo.Text), _publisherRepo.GetPublisherByName(publisherCombo.Text), int.Parse(copiesTextBox.Text)); switch (returnValue) { case -1: MessageBox.Show("Book with same title and publisher already exists", "Book exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; case -2: MessageBox.Show("Number of copies cannot be negative", "Book copies negative error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; case -4: MessageBox.Show("There's no available copies to remove they're rented or in an different state.", "Book unavailable to remove error", MessageBoxButtons.OK, MessageBoxIcon.Error); copiesTextBox.Text = _typeBook.GetAllBookTypes()[_index].PhysicalBooks .Count(bk => bk.BookInfo.TypeBookId == _typeBook.GetAllBookTypes()[_index].TypeBookId).ToString(); return; default: SetData(); return; } }
private void btnSave_Click(object sender, EventArgs e) { if (descriptionTextBox.Text == "") { descriptionTextBox.Text = "-"; } 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 (!_genreRepo.AddGenre(genreTextBox.Text, descriptionTextBox.Text)) { MessageBox.Show("There's already a genre called like this", "Genre exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } genreTextBox.Text = ""; descriptionTextBox.Text = ""; }
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 (comboPosition.Text == "") { MessageBox.Show("Please choose an position for this person before clicking save", "Position empty error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!_staffRepo.AddStaff(nameTextBox.Text, surnameTextBox.Text, dateOfBirthPicker.Value, (StaffPosition)Enum.Parse(typeof(StaffPosition), comboPosition.Text))) { MessageBox.Show("There's person is already a staff member", "Staff member exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NewForm(); }