예제 #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;
            }
        }
예제 #2
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;
            }
        }