//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(); } }
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(); } }
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(); } }
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(); }
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(); } }