Esempio n. 1
0
        private void buttonSearcherAuthor_Click(object sender, EventArgs e)
        {
            int choice = comboBoxAuthor.SelectedIndex;

            switch (choice)
            {
            case -1:
                MessageBox.Show("Please select the search option");
                break;

            case 0:
                Author autho = AuthorDA.Search(Convert.ToInt32(textBoxInformationauthor.Text));
                if (autho != null)
                {
                    textBoxAuthorID.Text  = (autho.AuthorID).ToString();
                    textBoxFirstName.Text = autho.FName;
                    textBoxLastName.Text  = autho.LName;
                    textBoxEmail.Text     = autho.Email;

                    textBoxAuthorID.Enabled = false;
                }

                else
                {
                    MessageBox.Show("Author not Found!");
                    textBoxInformationauthor.Clear();
                    textBoxInformationauthor.Focus();
                }
                break;

            case 1:
                Author auth = AuthorDA.Searchemail(textBoxInformationauthor.Text);
                if (auth != null)
                {
                    textBoxAuthorID.Text  = (auth.AuthorID).ToString();
                    textBoxFirstName.Text = auth.FName;
                    textBoxLastName.Text  = auth.LName;
                    textBoxEmail.Text     = auth.Email;

                    textBoxAuthorID.Enabled = false;
                }

                else
                {
                    MessageBox.Show("Email not Found!");
                    textBoxInformationauthor.Clear();
                    textBoxInformationauthor.Focus();
                }
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        private void buttonSearchAuthor_Click(object sender, EventArgs e)
        {
            Author author = AuthorDA.Search(Convert.ToInt32(textBoxSearch.Text));

            if (author != null)
            {
                textBoxAuthorId.Text  = (author.AuthorId).ToString();
                textBoxFirstName.Text = author.firstName;
                textBoxLastName.Text  = author.lastName;
            }

            else
            {
                MessageBox.Show("Author not Found!");
                textBoxSearch.Clear();
                textBoxSearch.Focus();
            }
        }
Esempio n. 3
0
        private void btn_Search_Click(object sender, EventArgs e)
        {
            Author cust = AuthorDA.Search(Convert.ToInt32(txt_input.Text));

            if (cust != null)
            {
                txt_AuID.Text  = (cust.AuthorID).ToString();
                txt_fName.Text = (cust.FirstName);
                txt_lName.Text = cust.LastName;
                txt_email.Text = cust.Email;
            }
            else
            {
                MessageBox.Show("Author not Found");
                txt_input.Clear();
                txt_input.Focus();
            }
        }
Esempio n. 4
0
        private void buttonSearchAuthorsoftware_Click(object sender, EventArgs e)
        {
            int choice = comboBoxsearchauthor.SelectedIndex;

            switch (choice)
            {
            case -1:
                MessageBox.Show("Please select the search option");
                break;

            case 0:
                Author autho = AuthorDA.Search(Convert.ToInt32(textBoxInformationauthor.Text));
                if (autho != null)
                {
                    textBoxAuthor.Text = autho.FName;
                }

                else
                {
                    MessageBox.Show("Author not Found!");
                    textBox1.Clear();
                    textBox1.Focus();
                }
                break;

            case 1:
                Author auth = AuthorDA.Searchemail(textBoxInformationauthor.Text);
                if (auth != null)
                {
                    textBoxAuthor.Text = auth.FName;
                }

                else
                {
                    MessageBox.Show("Email not Found!");
                    textBox1.Clear();
                    textBox1.Focus();
                }
                break;

            default:
                break;
            }
        }
        private void buttonSearchAuthor_Click(object sender, EventArgs e)
        {
            {
                int choice = comboBoxAuthorInfo.SelectedIndex;
                switch (choice)
                {
                case -1:     // The user didn't select any search option
                    MessageBox.Show("Please select the search option");
                    break;

                case 0:
                    if (textBoxAuthorInfo.Text == "")
                    {
                        MessageBox.Show("You have to enter Author ID, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        if (Validation.IsInteger(textBoxAuthorInfo))
                        {
                            Author author = AuthorDA.Search(Convert.ToInt32(textBoxAuthorInfo.Text));
                            if (author != null)
                            {
                                textBoxAuthorID.Text        = (author.AuthorID).ToString();
                                textBoxFirstNameAuthor.Text = author.FirstName;
                                textBoxLastNameAuthor.Text  = author.LastName;
                                textBoxAuthorInfo.Clear();
                                textBoxAuthorID.Enabled = false;
                            }
                            else
                            {
                                MessageBox.Show("Author not found, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                textBoxInfoPublisher.Clear();
                                textBoxInfoPublisher.Focus();
                            }
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }