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 (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 (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 CleanOldStaffTest() { OldStaffCleaner oldStaffCleaner = new OldStaffCleaner("name=StaffContextTests"); var AllStaff = getStaffListTest(); oldStaffCleaner.CleanOldStaff(AllStaff); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(true == emptyChecker.IsTableEmpty("Pupils")); }
public void clearTableDbTest() { MsDbCleaner msDbCleaner = new MsDbCleaner("name=StaffContextTests"); msDbCleaner.clearTableDb("Schedules"); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(true == emptyChecker.IsTableEmpty("Schedules")); }
public void FillOnlySchedulesTest() { MsDbFiller msDbFiller = new MsDbFiller("name=StaffContextTests"); var AllClasses = getClassesListTest(); msDbFiller.FillOnlySchedules(AllClasses); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Schedules")); }
public void FillSchedulesDbTest() { ScheduleFiller scheduleFiller = new ScheduleFiller("name=StaffContextTests"); var AllClasses = getClassesListTest(); scheduleFiller.FillSchedulesDb(AllClasses); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Schedules")); }
public void UpdateMsDbTest() { MsDbUpdater msDbUpdater = new MsDbUpdater("name=StaffContextTests"); var AllStaff = getStaffListTest(); var AllClasses = getClassesListTest(); msDbUpdater.UpdateMsDb(AllStaff, AllClasses); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Schedules")); }
public void IsTableEmptyTest() { PrepareTestEvent(); EmptyChecker EmptyChecker = new EmptyChecker("StaffContextTests"); Boolean IsTableEmpty = EmptyChecker.IsTableEmpty("Events"); Assert.IsTrue(IsTableEmpty == false); MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests"); msDbSetter.SetDelAllEventsForTesting(); IsTableEmpty = EmptyChecker.IsTableEmpty("Events"); Assert.IsTrue(IsTableEmpty == true); }
public void FillMsDbTest() { PrepareTest(); MsDbFiller msDbFiller = new MsDbFiller("name=StaffContextTests"); var AllStaff = getStaffListTest(); var AllClasses = getClassesListTest(); msDbFiller.FillMsDb(AllStaff, AllClasses); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Schedules")); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Pupils")); }
public void clearAllTablesBesidesPupilsTest() { PrepareTest(); MsDbCleaner msDbCleaner = new MsDbCleaner("name=StaffContextTests"); msDbCleaner.clearTableDb("Schedules"); msDbCleaner.clearTableDb("Events"); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(true == emptyChecker.IsTableEmpty("Schedules")); Assert.IsTrue(true == emptyChecker.IsTableEmpty("Events")); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Pupils")); }
// public override void Accept(IExpressionDescriptionVisitor expressionDescriptionVisitor) // { // expressionDescriptionVisitor.Visit(this); // } public override LiquidExpressionResult Eval(ITemplateContext templateContext, IEnumerable <Option <ILiquidValue> > expressions) { //Console.WriteLine("** ISEMPTY EXPRESSION"); var list = expressions.ToList(); if (list.Count != 1) { return(LiquidExpressionResult.Error("Expected one variable to compare with \"empty\"")); } if (!list[0].HasValue) { return(LiquidExpressionResult.Success(new LiquidBoolean(true))); // nulls are empty. } return(LiquidExpressionResult.Success(new LiquidBoolean(EmptyChecker.IsEmpty(list[0].Value)))); }
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.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 (!_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 (!_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.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 (!_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 (!_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(); }
public void UpdateStaffDbTest() { MsDbUpdater msDbUpdater = new MsDbUpdater("name=StaffContextTests"); var AllStaff = getStaffListTest(); msDbUpdater.UpdateStaffDb(AllStaff); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO1 = msDbRequester.getFullFIOByPupilIdOld(5000); String FullFIO2 = msDbRequester.getFullFIOByPupilIdOld(5001); String FullFIO3 = msDbRequester.getFullFIOByPupilIdOld(5002); Assert.IsTrue(FullFIO1 == "Иванов Иван Иванович"); Assert.IsTrue(FullFIO2 == "Петров Петр Петрович"); Assert.IsTrue(FullFIO3 == "Сидоров Сидор Сидорович"); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Schedules")); }
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 (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 (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(); }