예제 #1
0
 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();
     }
 }
예제 #2
0
 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();
     }
 }
예제 #3
0
        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);
        }