Free Essay

Asp.Net Application for Book Doisplay

In:

Submitted By akfu123
Words 773
Pages 4
Display using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; public class Book1
{
private string isbn;

public string Isbn { get { return isbn; } set { isbn = value; } } private string title;

public string Title { get { return title; } set { title = value; } } private string author;

public string Author { get { return author; } set { author = value; } } private double buyprice;

public double Buyprice { get { return buyprice; } set { buyprice = value; } } public Book1(string p1,string p2,string p3,double p4) { // TODO: Complete member initialization this.isbn = p1; this.title = p2; this.author = p3; this.buyprice = p4; }

} public partial class display : System.Web.UI.Page
{
private ArrayList books; String txt; String bookname; String bookauthor; double price;

protected void Page_Load(object sender, EventArgs e) { books = new ArrayList(); BookDetails(); } private void BookDetails() { Book1 b1 = new Book1("978-1449311520", "adoop: The Definitive Guide", "Tom White", 15.99); Book1 b2 = new Book1("978-0735667044", "Microsoft Visual Basic 2013 Step by Step", "Michael Halvoson", 9.50); Book1 b3 = new Book1("978-0993088100", "Fifty Quick Ideas to Improve Your User Stories", "David Evens/Gojko Adzick", 33.00); Book1 b4 = new Book1("978-1428336117", "The Medical Manager Student Edition", "David Fitzpatrick", 99.00); Book1 b5 = new Book1("978-0769302652", "Introduction to Language Development", "Scott McLaughlin", 55.00); Book1 b6 = new Book1("978-0354242452", "Basic Plumbing, The Complete Beginner's Guide", "Maning Gibralta", 29.99); Book1 b7 = new Book1("978-0071457743", "Engineering Formulas", "George Geick", 11.50); Book1 b8 = new Book1("978-1885071293", "Handyman In-Your-Pocket", "Richard Allen Young", 5.99); Book1 b9 = new Book1("978-1591260905", "Chemical Engineering Solved Problems", "NS Nandagopal", 45.00); Book1 b10 = new Book1("978-1491950357", "Building Microservices", "Sam Newman", 19.99); books.Add(b1); books.Add(b2); books.Add(b3); books.Add(b4); books.Add(b5); books.Add(b6); books.Add(b7); books.Add(b8); books.Add(b9); books.Add(b10);

}

public void Button2_OnClick(Object sender, EventArgs e) { txt = Text2.Text;

for (int i = 0; i < books.Count; i++) { Book1 b = (Book1)books[i]; Book1 b1 = (Book1)books[i+1]; Book1 b2 = (Book1)books[i+2]; Book1 b3 = (Book1)books[i+3]; if (txt.Equals(b)) { // ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true); //String

ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "ChangeContents();", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true); }

} }

public void Button3_OnClick(Object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage1", "alertMessage1();", true); }

public void Button4_OnClick(Object sender, EventArgs e) { Response.Redirect("Default.aspx", true); }
}

Regis public void back_OnClick(Object sender, EventArgs e) { Response.Redirect("Default.aspx", true); }

public void regis_OnClick(Object sender, EventArgs e) {

}

Default using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Collections;

public class Books
{
private string isbn;

public string Isbn { get { return isbn; } set { isbn = value; } } private string title;

public string Title { get { return title; } set { title = value; } } private string author;

public string Author { get { return author; } set { author = value; } } private double buyprice;

public double Buyprice { get { return buyprice; } set { buyprice = value; } } public Books(string p1,string p2,string p3,double p4) { // TODO: Complete member initialization this.isbn = p1; this.title = p2; this.author = p3; this.buyprice = p4; }

} public partial class _Default : System.Web.UI.Page
{
private ArrayList books; protected void Page_Load(object sender, EventArgs e) { books = new ArrayList(); BookDetails(); } private void BookDetails() { Books b1 = new Books("978-1449311520", "adoop: The Definitive Guide", "Tom White", 15.99); Books b2 = new Books("978-0735667044", "Microsoft Visual Basic 2013 Step by Step", "Michael Halvoson", 9.50); Books b3 = new Books("978-0993088100", "Fifty Quick Ideas to Improve Your User Stories", "David Evens/Gojko Adzick", 33.00); Books b4 = new Books("978-1428336117", "The Medical Manager Student Edition", "David Fitzpatrick", 99.00); Books b5 = new Books("978-0769302652", "Introduction to Language Development", "Scott McLaughlin", 55.00); Books b6 = new Books("978-0354242452", "Basic Plumbing, The Complete Beginner's Guide", "Maning Gibralta", 29.99); Books b7 = new Books("978-0071457743", "Engineering Formulas", "George Geick", 11.50); Books b8 = new Books("978-1885071293", "Handyman In-Your-Pocket", "Richard Allen Young", 5.99); Books b9 = new Books("978-1591260905", "Chemical Engineering Solved Problems", "NS Nandagopal", 45.00); Books b10 = new Books("978-1491950357", "Building Microservices", "Sam Newman", 19.99); books.Add(b1); books.Add(b2); books.Add(b3); books.Add(b4); books.Add(b5); books.Add(b6); books.Add(b7); books.Add(b8); books.Add(b9); books.Add(b10); }

public void Button1_OnClick(Object sender, EventArgs e) { String txt = Text1.Text;

foreach (Books obj in books) { if(txt.Equals(obj.Isbn)) { // ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true) Response.Redirect("display.aspx", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true); }

} }
}

Similar Documents