コード例 #1
0
        private void AppendPublisher()
        {
            if (Page.IsValid)
            {
                string publisherName = txtPublisherName.Text;
                string country       = ddlCountries.SelectedValue;
                string description   = txtDescription.Text;

                //Creates an instance of Genre class
                Publisher publisher = new Publisher(publisherName, country, description);

                if (!publisher.CheckIfPublisherExists(publisherName))
                {
                    //Appends a new Genre into database
                    publisher.AddPublisher(publisher);
                    lblNewPublisher.Text = publisherName;
                    divSuccess.Visible   = true;
                    ClearTextFields();
                    txtPublisherName.Focus();
                }
                else
                {
                    publisher       = null;
                    divFail.Visible = true;
                }
            }
        }