-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddBook.aspx.cs
93 lines (84 loc) · 2.59 KB
/
AddBook.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
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 AddBook : System.Web.UI.Page
{
private OracleConnection oc;
private OracleCommand com;
private OracleDataAdapter adap;
private DataSet ds;
private DataTable db;
int flag;
public String shopid;
public String isbn;
protected void Page_Load(object sender, EventArgs e)
{
Session["backto"] = "flasebackto";
if (!Convert.ToString(Session["ShopLoggedin"]).Equals("TrueShop"))
{
flag = 0;
Session["backto"] = "truebackto";
Session["takemeto"] = Request.CurrentExecutionFilePath.ToString();
Response.Redirect("Signin.aspx");
}
shopid = Session["shopuser"].ToString();
try
{
oc = new OracleConnection("Data Source=MYDB; User ID=scott; Password=tiger");
oc.Open();
com = oc.CreateCommand();
}
catch (Exception ee) { }
int k = 0;
String q = "(select title,isbn from book) minus (select title,book.isbn from book,available_at where shop_id='" + shopid + "' and book.isbn=available_at.isbn)";
try
{
com.CommandText = q;
com.CommandType = CommandType.Text;
adap = new OracleDataAdapter(com);
db = new DataTable();
adap.Fill(db);
k = db.Rows.Count;
}
catch (Exception ef) { }
foreach (DataRow row in this.db.Rows)
{
DropDownList1.Items.Add(row[0].ToString() + "(ISBN: " + row[1].ToString() + ")");
}
flag = 1;
}
protected void Next_Click(object sender, EventArgs e)
{
String t = DropDownList1.SelectedValue;
foreach (DataRow row in this.db.Rows)
{
if (t.Equals(row[0].ToString() + "(ISBN: " + row[1].ToString() + ")"))
{
isbn = row[1].ToString();
break;
}
}
Session["seeisbnno"] = isbn;
Response.Redirect("AddExistingBook.aspx");
}
protected void newbook_button_Click(object sender, EventArgs e)
{
Response.Redirect("AddNewBook.aspx");
}
private void Page_Unload()
{
if (flag == 1)
{
oc.Close();
}
}
}