コード例 #1
0
        private void buttonListauthor_Click(object sender, EventArgs e)
        {
            listViewAuthor.Items.Clear();


            AuthorDA.ListAuthor(listViewAuthor);
        }
コード例 #2
0
        private void buttonUpdateauthor_Click(object sender, EventArgs e)
        {
            if ((textBoxFirstName.Text == "") || (textBoxLastName.Text == "") || (textBoxEmail.Text == ""))

            {
                MessageBox.Show("Please fill all the fields ", "Missing Data");
                textBoxNamePublisher.Clear();
                textBoxNamePublisher.Focus();
                return;
            }
            else
            {
                Author auth = new Author();
                auth.AuthorID = Convert.ToInt32(textBoxAuthorID.Text);
                auth.FName    = textBoxFirstName.Text;
                auth.LName    = textBoxLastName.Text;
                auth.Email    = textBoxEmail.Text;
                DialogResult ans = MessageBox.Show("Do you really want to update this author?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (ans == DialogResult.Yes)
                {
                    AuthorDA.Update(auth);
                    MessageBox.Show("author record has been updated successfully", "Confirmation");
                }
                textBoxAuthorID.Enabled = true;
                ClearAll3();
            }
        }
コード例 #3
0
        //Change the author ISBN after choosing an Author from the Combobox
        private void comboBoxBkAuthor_SelectedIndexChanged(object sender, EventArgs e)
        {
            string line = comboBoxBkAuthor.Text;

            string[] lName = line.Split(',');
            textBoxBkAuthorID.Text = AuthorDA.SearchLast(lName[0]).AutID.ToString();
        }
コード例 #4
0
        //Update
        private void buttonAutUpd_Click(object sender, EventArgs e)
        {
            AuthorDA.Update(createAuthor());
            AuthorDA.ListAuthors(listViewAuthor);

            UpdateComboBoxes();
        }
コード例 #5
0
        //Add
        private void buttonAutAdd_Click(object sender, EventArgs e)
        {
            Validator checker = new Validator();

            if (checker.isValidID(textBoxAutID, 5) && checker.isValidName(textBoxautFName, "First") && checker.isValidName(textBoxAutLName, "Last"))
            {
                AuthorDA.Save(createAuthor());
                UpdateComboBoxes();
            }
        }
コード例 #6
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;
            }
        }
コード例 #7
0
 private void buttonDeleteAuthor_Click(object sender, EventArgs e)
 {
     if (IsValidAuthorData())
     {
         DialogResult ans = MessageBox.Show("Do you really want to delete this Author?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (ans == DialogResult.Yes)
         {
             AuthorDA.Delete(Convert.ToInt32(textBoxAuthorID.Text));
             MessageBox.Show("Author record has been deleted successfully", "Confirmation");
             ClearAll();
             textBoxAuthorID.Enabled = true;
         }
     }
 }
コード例 #8
0
        //Create object Book
        private Book createBook()
        {
            Book abook = new Book();

            abook.BkISBN      = Convert.ToInt64(textBoxBkISBN.Text);
            abook.BkTitle     = textBoxBktitle.Text;
            abook.BkQOH       = Convert.ToInt32(textBoxBkQOH.Text);
            abook.BkDate      = dateTimePickerBook.Value;
            abook.BkAuthor    = AuthorDA.SearchID(Convert.ToInt32(textBoxBkAuthorID.Text));
            abook.BkCategory  = textBoxBkCategory.Text;
            abook.BkUnitPrice = Convert.ToDecimal(textBoxBkUP.Text);
            abook.BkPublisher = comboBoxBkPub.Text;

            return(abook);
        }
コード例 #9
0
        private void buttonAddAuthor_Click(object sender, EventArgs e)
        {
            if (Validator.IsValidID(textBoxAuthorId))
            {
                Author author = new Author();

                author.AuthorId  = Convert.ToInt32(textBoxAuthorId.Text);
                author.firstName = textBoxFirstName.Text;
                author.lastName  = textBoxLastName.Text;
                listAuthor.Add(author);
                AuthorDA.Save(author);
                buttonListAuthor.Enabled = true;
                ClearAll();
            }
        }
コード例 #10
0
ファイル: AuthorInfo.cs プロジェクト: Dwippatel-code/BookBiz
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if ((Validation.IsValidID(txt_AuID)))
            {
                Author auth = new Author();


                auth.AuthorID  = Convert.ToInt32(txt_AuID.Text);
                auth.FirstName = txt_fName.Text;
                auth.LastName  = txt_lName.Text;
                auth.Email     = txt_email.Text;
                AuthorDA.Save(auth);

                ClearAll();
            }
        }
コード例 #11
0
        //Delete
        private void buttonAutDel_Click(object sender, EventArgs e)
        {
            DialogResult ans = MessageBox.Show("Are you sure you want to delete the Author information?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (ans == DialogResult.Yes)
            {
                if (BookDA.SearchAuthor(Convert.ToInt32(textBoxAutID.Text)) != null)
                {
                    MessageBox.Show("This author has one or more books registered in the inventory, please be sure that there are no books by this author before deleting it!", "ALERT!");
                    return;
                }
                AuthorDA.Delete(Convert.ToInt32(textBoxAutID.Text));
                AuthorDA.ListAuthors(listViewAuthor);
                UpdateComboBoxes();
            }
        }
コード例 #12
0
 private void buttonSave2_Click(object sender, EventArgs e)
 {
     if ((textBoxAuthorID.Text == "") || (textBoxFirstName.Text == "") || (textBoxLastName.Text == "") || (textBoxEmail.Text == ""))
     {
         MessageBox.Show("You have to fill out all the boxes, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Author auth = new Author();
         auth.AuthorID = Convert.ToInt32(textBoxAuthorID.Text);
         auth.FName    = textBoxFirstName.Text;
         auth.LName    = textBoxLastName.Text;
         auth.Email    = textBoxEmail.Text;
         AuthorDA.Save(auth);
     }
     ClearAll3();
 }
コード例 #13
0
        //Enable the buttons delete and update in case of a valid entered ID

        private void textBoxAutID_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxAutID.Text))
            {
                buttonAutDel.Enabled = false;
                buttonAutUpd.Enabled = false;
                return;
            }
            if (AuthorDA.SearchID(Convert.ToInt32(textBoxAutID.Text)) != null)
            {
                buttonAutDel.Enabled = true;
                buttonAutUpd.Enabled = true;
                return;
            }
            buttonAutDel.Enabled = false;
            buttonAutUpd.Enabled = false;
        }
コード例 #14
0
        //Search
        private void buttonAutSearch_Click(object sender, EventArgs e)
        {
            Author aAuthor = new Author();

            if (!string.IsNullOrEmpty(textBoxAutSearch.Text))
            {
                switch (comboBoxAutSearch.SelectedIndex)
                {
                case -1:
                    MessageBox.Show("Please select a valid search option!");
                    return;

                case 0:
                    int tempId;
                    if (!int.TryParse(textBoxAutSearch.Text, out tempId))
                    {
                        MessageBox.Show("Please enter a valid term to be searched.", "No search information!");
                        return;
                    }
                    aAuthor = AuthorDA.SearchID(Convert.ToInt32(textBoxAutSearch.Text));
                    break;

                case 1:
                    aAuthor = AuthorDA.SearchFirst(textBoxAutSearch.Text);
                    break;

                case 2:
                    aAuthor = AuthorDA.SearchLast(textBoxAutSearch.Text);
                    break;
                }

                if (aAuthor == null)
                {
                    MessageBox.Show("Author not found!", "Not found!");
                    textBoxAutSearch.Clear();
                    textBoxAutSearch.Focus();
                    return;
                }

                AuthorDA.ListSearchResult(aAuthor, listViewAuthor);
                return;
            }
            MessageBox.Show("Please enter a valid term to be searched.", "No search information!");
            return;
        }
コード例 #15
0
ファイル: AuthorInfo.cs プロジェクト: Dwippatel-code/BookBiz
        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();
            }
        }
コード例 #16
0
 private void buttonUpdateAuthor_Click(object sender, EventArgs e)
 {
     if (IsValidAuthorData())
     {
         Author author = new Author();
         author.AuthorID  = Convert.ToInt32(textBoxAuthorID.Text);
         author.FirstName = textBoxFirstNameAuthor.Text;
         author.LastName  = textBoxLastNameAuthor.Text;
         DialogResult ans = MessageBox.Show("Do you really want to update this Employee?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (ans == DialogResult.Yes)
         {
             AuthorDA.Update(author);
             MessageBox.Show("Author record has been updated successfully", "Confirmation");
             ClearAll();
             textBoxAuthorID.Enabled = true;
         }
     }
 }
コード例 #17
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();
            }
        }
コード例 #18
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;
            }
        }
コード例 #19
0
        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;
                }
            }
        }
コード例 #20
0
        private void buttonSaveAuthor_Click(object sender, EventArgs e)
        {
            List <Author> listA = AuthorDA.ListAuthor();

            if (IsValidAuthorData())
            {
                if (!Validation.IsUniqueAuthorID(listA, Convert.ToInt32(textBoxAuthorID.Text)))
                {
                    MessageBox.Show("Duplicate", "DUPLICATE Author ID");
                    textBoxAuthorID.Clear();
                    textBoxAuthorID.Focus();
                    return;
                }
                Author aAuthor = new Author();
                aAuthor.AuthorID  = Convert.ToInt32(textBoxAuthorID.Text);
                aAuthor.FirstName = textBoxFirstNameAuthor.Text;
                aAuthor.LastName  = textBoxLastNameAuthor.Text;
                AuthorDA.Save(aAuthor);
                listA.Add(aAuthor);
                buttonListAuthor.Enabled = true;
                ClearAll();
            }
        }
コード例 #21
0
 private void buttonDeleteAuthor_Click(object sender, EventArgs e)
 {
     AuthorDA.Delete(Convert.ToInt32(textBoxAuthorId.Text));
     MessageBox.Show("Author has been deleted successfully from the database", "Confirmation");
 }
コード例 #22
0
 //List
 private void buttonAutList_Click(object sender, EventArgs e)
 {
     AuthorDA.ListAuthors(listViewAuthor);
 }
コード例 #23
0
ファイル: AuthorInfo.cs プロジェクト: Dwippatel-code/BookBiz
 private void btn_Delete_Click(object sender, EventArgs e)
 {
     AuthorDA.Delete(Convert.ToInt32(txt_input.Text));
     MessageBox.Show("Student data has beeen deleted", "DONE");
 }
コード例 #24
0
 private void buttonDeleteauthor_Click(object sender, EventArgs e)
 {
     AuthorDA.Delete(Convert.ToInt32(textBoxAuthorID.Text));
     MessageBox.Show(" Author record has been deleted successfully", "Confirmation");
     ClearAll3();
 }
コード例 #25
0
ファイル: AuthorInfo.cs プロジェクト: Dwippatel-code/BookBiz
 private void btn_List_Click(object sender, EventArgs e)
 {
     drp_Search.SelectedIndex = -1;
     AuthorDA.LstAuthor(View_Stud);
 }
コード例 #26
0
 private void Inventory_Control_Load(object sender, EventArgs e)
 {
     PublisherDA.Comboboxlist(comboBoxPublisherName);
     AuthorDA.Comboboxlist(comboBoxAuthorId);
 }