-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult_type.aspx.cs
98 lines (92 loc) · 3.08 KB
/
result_type.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Data.OracleClient;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.SessionState;
public partial class result_type : System.Web.UI.Page
{
private OracleConnection oc;
private OracleCommand com;
private OracleDataAdapter adap;
private DataSet ds;
String qq;
String s;
String t;
protected void Page_Load(object sender, EventArgs e)
{
try
{
oc = new OracleConnection("Data Source=MYDB; User ID=scott; Password=tiger");
oc.Open();
com = oc.CreateCommand();
}
catch (Exception ee) { }
String n = Session["browsetype"].ToString();
String c = Session["bname"].ToString();
int k = 0;
if (n.Equals("Author"))
{
qq = "select title,front_cover_image,book.isbn,publisher from book,author,written_by where name='" + c + "' and book.isbn=written_by.isbn and author.author_id=written_by.author_id";
}
else if (n.Equals("Bookshop"))
{
qq = "select title,front_cover_image,book.isbn,publisher from book,shop,available_at where shop.shop_id='"+c+"' and book.isbn=available_at.isbn and shop.shop_id=available_at.shop_id";
}
else if (n.Equals("Publisher"))
{
qq = "select title,front_cover_image,isbn,publisher from book where publisher='" + c + "'";
}
else if (n.Equals("Title"))
{
qq = "select title,front_cover_image,isbn,publisher from book where isbn='" + c + "'";
}
else
{
qq = "select title,front_cover_image,isbn,publisher from book where category_='" + c + "'";
}
try
{
com.CommandText = qq;
com.CommandType = CommandType.Text;
adap = new OracleDataAdapter(com);
ds = new DataSet();
adap.Fill(ds);
k = ds.Tables[0].Rows.Count;
typelist.DataSource = ds;
typelist.DataBind();
}
catch (Exception eee)
{
Console.Out.Write(eee.StackTrace);
}
if (k == 0)
{
Label1.Text = "No search result found";
}
String curpath = Request.CurrentExecutionFilePath.ToString();
Session["returnpath"] = curpath;
}
protected void typelist_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "more" || e.CommandName=="view" || e.CommandName=="cart")
{
DataSet ds1 = (DataSet)typelist.DataSource;
s = ds1.Tables[0].Rows[e.Item.ItemIndex]["title"].ToString();
t = ds1.Tables[0].Rows[e.Item.ItemIndex]["isbn"].ToString();
Session["bookname"] = s;
Session["bookisbn"] = t;
Response.Redirect("Book_details.aspx");
}
}
private void Page_Unload()
{
oc.Close();
}
}