private void button2_Click(object sender, EventArgs e) { if (ErrorControls.EmptyTextBox(tbName)) // add in db { Genre genre = new Genre(); genre.name = tbName.Text; dbCatalog.Genre.Add(genre); dbCatalog.SaveChanges(); this.Close(); } }
private void btnOK_Click(object sender, EventArgs e) { if (ErrorControls.EmptyTextBox(tbName)) // add in db { Publishing pb = new Publishing(); pb.name = tbName.Text; pb.year = (int)nudYear.Value; dbCatalog.Publishing.Add(pb); dbCatalog.SaveChanges(); this.Close(); } }
private int CheckUser() // get back quantity of errors { bool check; int i = 0; check = ErrorControls.EmptyTextBox(tbName); ErrorControls.CountErrors(ref i, check); check = ErrorControls.EmptyTextBox(tbAuthor); ErrorControls.CountErrors(ref i, check); check = ErrorControls.EmptyComboBox(cmbGenre); ErrorControls.CountErrors(ref i, check); check = ErrorControls.EmptyComboBox(cmbPublishing); ErrorControls.CountErrors(ref i, check); return(i); }