protected void ddlBook_SelectedIndexChanged(object sender, EventArgs e) { string valor = ddlBook.SelectedValue; textAuthor.Text = valor; foreach (EntClsBook book in listBook) { if (book.Code == valor) { ent_book = book; } } ShowBook(ent_book); }
protected void btnSearchBook_Click(object sender, EventArgs e) { string search = txtSearchBook.Text; EntClsBook book = bsn_book.checkBook2(search); showBook(book); txtTitle.Enabled = true; txtStock.Enabled = true; txtCode.Enabled = true; txtAuthor.Enabled = true; txtStateB.Enabled = true; btnNextLoan.Enabled = true; }
protected void ShowBook(EntClsBook book) { textTitle.Text = book.Name; textIsbn.Text = book.Isbn; textDatePublish.Text = book.DatePublish; textStock.Text = Convert.ToString(book.Stock); textState.Text = book.StateB; EntClsCategory ent_categ = bsn_cate.listCategoryForid(book.IdCateg); textCategory.Text = ent_categ.Name; EntClsEditorial ent_edit = bsn_edit.checkEditorialForId(book.IdEdit); textEdit.Text = ent_edit.Name; EntClsWrite ent_write = bsn_write.listWriteForCode(book.Code); EntClsAuthor ent_author = bsn_auth.checkAuthorForId(ent_write.IdAuthor); textAuthor.Text = ent_author.Name + ' ' + ent_author.LastName; }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("Login.aspx"); } if (Session["edit"] == null || Session["author"] == null) { Response.Redirect("Autor.aspx"); } if (Session["book"] != null) { btnUpdate.Visible = true; btnRegister.Visible = false; btnUpdate.Enabled = true; ent_book = bsn_book.SearchBook(Session["book"].ToString()); textTitle.Text = ent_book.Name; textCode.Text = ent_book.Code; textCode.Enabled = false; textDate.Text = ent_book.DatePublish; textIsbn.Text = ent_book.Isbn; textStock.Text = Convert.ToString(ent_book.Stock); ent_category = bsn_category.listCategoryForid(ent_book.IdCateg); Session["book"] = null; } else { if (Session["regis"] != null) { btnRegister.Enabled = true; btnUpdate.Visible = false; } } idEditorial = Convert.ToInt32(Session["edit"].ToString()); idAuthor = Convert.ToInt32(Session["author".ToString()]); if (!IsPostBack) { loadDropDownList(); ddlCategory.AutoPostBack = true; ddlState.AutoPostBack = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("Login.aspx"); } if (Session["author"] == null) { Response.Redirect("Autor.aspx"); } if (Session["book"] != null) { ent_book = bsn_book.SearchEditorialOfBook(Session["book"].ToString()); obj_edit = bsn_edit.checkEditorialForId(ent_book.IdEdit); textName.Text = obj_edit.Name; textCity.Text = obj_edit.City; textCountry.Text = obj_edit.Country; btnNextBook.Visible = false; btnUpdateCont.Visible = true; btnUpdateCont.Enabled = true; code = Session["book"].ToString(); insert = 3; Session["book"] = null; } else { if (Session["regis"] != null) { btnNextBook.Visible = true; btnUpdateCont.Visible = false; } } if (!IsPostBack) { rblEditorial.AutoPostBack = true; } }
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(); } }