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();
                }
            }
        }
Exemplo n.º 2
0
 private void buttonUpdatePublisher_Click(object sender, EventArgs e)
 {
     if ((textBoxNamePublisher.Text == "") || (textBoxEmailPublisher.Text == "") || (maskedTextBoxPhoneNumber.Text == ""))
     {
         MessageBox.Show("Please fill all the fields ", "Missing Data");
         textBoxNamePublisher.Clear();
         textBoxNamePublisher.Focus();
         return;
     }
     else
     {
         Publisher publi = new Publisher();
         publi.PUBname    = textBoxNamePublisher.Text;
         publi.PUbAddress = textBoxEmailPublisher.Text;
         publi.PUBphone   = maskedTextBoxPhoneNumber.Text;
         DialogResult ans = MessageBox.Show("Do you really want to update this Publisher?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (ans == DialogResult.Yes)
         {
             PublisherDA.Update(publi);
             MessageBox.Show("Publisher record has been updated successfully", "Confirmation");
         }
         textBoxNamePublisher.Enabled = true;
         ClearAll();
     }
 }
Exemplo n.º 3
0
        private void buttonListPublisher_Click(object sender, EventArgs e)
        {
            listViewPublisher.Items.Clear();


            PublisherDA.ListPublisher(listViewPublisher);
        }
Exemplo n.º 4
0
        //=====================================================================================================================================
        //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 buttonDeletePublisher_Click(object sender, EventArgs e)
 {
     if (IsValidPublisherData())
     {
         DialogResult ans = MessageBox.Show("Do you really want to delete this Publisher?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (ans == DialogResult.Yes)
         {
             PublisherDA.Delete(textBoxPublisherName.Text);
             MessageBox.Show("Publisher record has been deleted successfully", "Confirmation");
             ClearAll();
             textBoxPublisherName.Enabled = true;
         }
     }
 }
Exemplo n.º 6
0
        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();
            }
        }
        private void buttonSearchPublisher_Click(object sender, EventArgs e)
        {
            {
                int choice = (comboBoxSearchPublisher.SelectedIndex);
                switch (choice)
                {
                case -1:     // The user didn't select any search option
                    MessageBox.Show("Please select the search option");
                    break;

                case 0:     //The user selected the search by Customer ID
                    if (textBoxInfoPublisher.Text == "")
                    {
                        MessageBox.Show("You have to enter Publisher Name, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        if (Validation.IsValidInformation(textBoxInfoPublisher))
                        {
                            Publisher publisher = PublisherDA.Search(textBoxInfoPublisher.Text);
                            if (publisher != null)
                            {
                                textBoxPublisherName.Text     = (publisher.PublisherName).ToString();
                                textBoxAddressPublisher.Text  = publisher.PublisherAddress;
                                textBoxPublisherEmail.Text    = publisher.PublisherEmail;
                                textBoxPublisherCity.Text     = publisher.PublisherCity;
                                comboBoxPublisherCountry.Text = publisher.PublisherCountry;
                                textBoxPublisherZipCode.Text  = publisher.PublisherZipCode;
                                textBoxInfoPublisher.Clear();
                                textBoxAuthorID.Enabled = false;
                            }
                            else
                            {
                                MessageBox.Show("Publisher not found, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                textBoxInfoPublisher.Clear();
                                textBoxInfoPublisher.Focus();
                            }
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 8
0
        private void buttonSearchPublisher_Click(object sender, EventArgs e)
        {
            Publisher publi = PublisherDA.Searchbyphonenumber(maskedTextBox1.Text);

            if (publi != null)
            {
                textBoxNamePublisher.Text     = publi.PUBname;
                textBoxEmailPublisher.Text    = publi.PUbAddress;
                maskedTextBoxPhoneNumber.Text = publi.PUBphone;

                textBoxNamePublisher.Enabled = false;
            }

            else
            {
                MessageBox.Show("User not Found!");
                maskedTextBox1.Clear();
                maskedTextBox1.Focus();
            }
        }
        private void buttonUpdatePublisher_Click(object sender, EventArgs e)
        {
            List <Publisher> listP = PublisherDA.ListPublisher();

            if (IsValidPublisherData())
            {
                Publisher publisher = new Publisher();
                publisher.PublisherName    = textBoxPublisherName.Text;
                publisher.PublisherEmail   = textBoxPublisherEmail.Text;
                publisher.PublisherAddress = textBoxAddressPublisher.Text;
                DialogResult ans = MessageBox.Show("Do you really want to update this Publisher?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (ans == DialogResult.Yes)
                {
                    PublisherDA.Update(publisher);
                    MessageBox.Show("Publisher record has been updated successfully", "Confirmation");
                    ClearAll();
                    textBoxPublisherName.Enabled = true;
                }
            }
        }
Exemplo n.º 10
0
 private void buttonDeletePublisher_Click(object sender, EventArgs e)
 {
     PublisherDA.Delete(textBoxNamePublisher.Text);
     MessageBox.Show(" Publisher record has been deleted successfully", "Confirmation");
     ClearAll();
 }
 private void Inventory_Control_Load(object sender, EventArgs e)
 {
     PublisherDA.Comboboxlist(comboBoxPublisherName);
     AuthorDA.Comboboxlist(comboBoxAuthorId);
 }