private void buttonSavePublisher_Click(object sender, EventArgs e) { List <Publisher> listP = PublisherDA.ListPublisher(); if (IsValidPublisherData()) { if (!Validation.IsUniquePublisherName(listP, textBoxPublisherName.Text)) { MessageBox.Show("Duplicate", "DUPLICATE Publisher Name"); textBoxPublisherName.Clear(); textBoxPublisherName.Focus(); return; } else { Publisher aPublisher = new Publisher(); aPublisher.PublisherName = textBoxPublisherName.Text; aPublisher.PublisherEmail = textBoxPublisherEmail.Text; aPublisher.PublisherAddress = textBoxAddressPublisher.Text; aPublisher.PublisherCity = textBoxPublisherCity.Text; aPublisher.PublisherCountry = comboBoxPublisherCountry.Text; aPublisher.PublisherZipCode = textBoxPublisherZipCode.Text; PublisherDA.Save(aPublisher); listP.Add(aPublisher); buttonListAuthor.Enabled = true; ClearAll(); } } }
//===================================================================================================================================== //Book Management System=============================================================================================================== //===================================================================================================================================== //Add a new Publisher private void buttonAddPub_Click(object sender, EventArgs e) { Publisher apublisher = new Publisher(); apublisher.PubName = textBoxBkPublisher.Text; PublisherDA.Save(apublisher); UpdateComboBoxes(); return; }
private void buttonSavePublisher_Click(object sender, EventArgs e) { if ((textBoxNamePublisher.Text == "") || (textBoxEmailPublisher.Text == "") || (maskedTextBoxPhoneNumber.Text == "")) { MessageBox.Show("You have to fill out all the boxes, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Publisher publishe = new Publisher(); publishe.PUBname = textBoxNamePublisher.Text; publishe.PUbAddress = textBoxEmailPublisher.Text; publishe.PUBphone = maskedTextBoxPhoneNumber.Text; PublisherDA.Save(publishe); ClearAll(); } }