protected void buttonRegister_Click(object sender, EventArgs e) { if (validTitle(textTitle.Text, 2)) { errorTitle(); } else { if (validIsbn(textIsbn.Text, 2)) { errorIsbn(); } else { if (validCode(textCode.Text)) { errorCode(); } else { int itemSelec = (ddlCategory.SelectedIndex) + 1; bsn_book.insertBook(textTitle.Text, textCode.Text, textIsbn.Text, textDate.Text, Convert.ToInt32(textStock.Text), itemSelec, idEditorial, "Disponible", 1); bsn_write.insertWrite(idAuthor, textCode.Text); Session.Add("succe", 1); Response.Redirect("BookList.aspx"); } } } }
protected EntClsAuthor registerBook() { int itemSelec = (ddlCategory.SelectedIndex) + 1; BsnClsBook bsn_book = new BsnClsBook(); BsnClsEditorial bsn_edit = new BsnClsEditorial(); EntClsEditorial obj_edit = bsn_edit.checkEditorial(textNameEdit.Text); int idedit = obj_edit.Id; int stock = Convert.ToInt16(textStock.Text); EntClsAuthor obj_author = new EntClsAuthor(); BsnClsAuthor bsn_author = new BsnClsAuthor(); obj_author = bsn_author.checkAuthor(textNameAuth.Text, textLastName.Text); bsn_book.insertBook(textTitle.Text, textCode.Text, textIsbn.Text, textDate.Text, Convert.ToInt16(textStock.Text), itemSelec, idedit, "Disponible", 1); return(obj_author); }