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); }
protected void btnUpdateAuthor_Click(object sender, EventArgs e) { BsnClsAuthor bsn_author = new BsnClsAuthor(); if ((bsn_author.updateAuthor(Convert.ToInt16(ddlAuthor.SelectedValue), textName.Text, textLastName.Text, textNationality.Text) > 0)) { clean(); listAdd(); string script = @"<script type='text/javascript'> alert('El Autor ha sido Modificado'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false); } }
protected void buttonCheckAuthor_Click(object sender, EventArgs e) { BsnClsAuthor bsn_author = new BsnClsAuthor(); EntClsAuthor authorFind = bsn_author.checkAuthor(textNameAuth.Text, textLastName.Text); if (authorFind.Name == null) { textNationality.Enabled = true; change1 = 1; } else { textNameAuth.Text = authorFind.Name; textLastName.Text = authorFind.LastName; textNationality.Text = authorFind.Nationality; } buttonCheckAuthor.Enabled = false; }
protected void buttonRegister_Click(object sender, EventArgs e) { BsnClsBook bsn_Libro = new BsnClsBook(); EntClsBook bookFind = bsn_Libro.checkBook(textTitle.Text); if (bookFind.Code == null) { if (change1 == 1) { BsnClsAuthor bsn_author = new BsnClsAuthor(); bsn_author.insertAuthor(textNameAuth.Text, textLastName.Text, textNationality.Text); } if (change2 == 1) { BsnClsEditorial bsn_editorial = new BsnClsEditorial(); bsn_editorial.insertEditorial(textNameEdit.Text, textCountry.Text, textCity.Text); } EntClsSearch consulExist = new EntClsSearch(); BsnClsSearch bsn_search = new BsnClsSearch(); consulExist = bsn_search.ForCodeBook(textCode.Text); if (consulExist.Book == null) { //verificar que no se repita el isbn consulExist = bsn_search.ForIsbnBook(textIsbn.Text); if (consulExist.Book == null) { //verificar que no se repita el titulo consulExist = bsn_search.ForNameBook(textTitle.Text); if (consulExist.Book == null) { EntClsAuthor obj_Author = registerBook(); BsnClsWrite bsn_write = new BsnClsWrite(); bsn_write.insertWrite(obj_Author.Id, textCode.Text); registerSucces(); clear(); } else { string script = @"<script type='text/javascript'> alert('Ya existe este libro ingrese otro'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false); } } else { string script = @"<script type='text/javascript'> alert('Ya existe ese ISBN ingrese otro'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false); } } else { string script = @"<script type='text/javascript'> alert('Ya existe ese codigo ingrese otro'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false); } } else { registerFail(); } }