-
Notifications
You must be signed in to change notification settings - Fork 0
/
Site.Master.cs
154 lines (141 loc) · 5.74 KB
/
Site.Master.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ShoppingHotspot
{
public partial class SiteMaster : MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
BindOffer();
BindCategory();
BindSubCat1();
BindSubCat2();
BindSubCat3();
BindSubCat4();
//BindProducts();
}
public void BindOffer()
{
string con = "";
con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
SqlConnection sqlconn = new SqlConnection(con);
sqlconn.Open();
String id = Convert.ToString(Session["id"]);
SqlCommand cmdd = new SqlCommand("Select * from tblOffer where status='true'", sqlconn);
SqlDataAdapter daa = new SqlDataAdapter(cmdd);
DataTable dtt = new DataTable();
daa.Fill(dtt);
Repeater1.DataSource = dtt;
Repeater1.DataBind();
}
public void BindSubCat1()
{
string con = "";
con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
SqlConnection sqlconn = new SqlConnection(con);
sqlconn.Open();
SqlCommand cmdd = new SqlCommand("Select * from tblSubCategory where mainCategoryId='1'", sqlconn);
SqlDataAdapter daa = new SqlDataAdapter(cmdd);
DataTable dtt = new DataTable();
daa.Fill(dtt);
Repeater2.DataSource = dtt;
Repeater2.DataBind();
}
public void BindSubCat2()
{
string con = "";
con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
SqlConnection sqlconn = new SqlConnection(con);
sqlconn.Open();
SqlCommand cmdd = new SqlCommand("Select * from tblSubCategory where mainCategoryId='2'", sqlconn);
SqlDataAdapter daa = new SqlDataAdapter(cmdd);
DataTable dtt = new DataTable();
daa.Fill(dtt);
Repeater3.DataSource = dtt;
Repeater3.DataBind();
}
public void BindSubCat3()
{
string con = "";
con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
SqlConnection sqlconn = new SqlConnection(con);
sqlconn.Open();
SqlCommand cmdd = new SqlCommand("Select * from tblSubCategory where mainCategoryId='3'", sqlconn);
SqlDataAdapter daa = new SqlDataAdapter(cmdd);
DataTable dtt = new DataTable();
daa.Fill(dtt);
Repeater4.DataSource = dtt;
Repeater4.DataBind();
}
public void BindSubCat4()
{
string con = "";
con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
SqlConnection sqlconn = new SqlConnection(con);
sqlconn.Open();
SqlCommand cmdd = new SqlCommand("Select * from tblSubCategory where mainCategoryId='4'", sqlconn);
SqlDataAdapter daa = new SqlDataAdapter(cmdd);
DataTable dtt = new DataTable();
daa.Fill(dtt);
Repeater5.DataSource = dtt;
Repeater5.DataBind();
}
//public void BindProducts()
//{
// string con = "";
// con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
// SqlConnection sqlconn = new SqlConnection(con);
// sqlconn.Open();
// SqlCommand cmdd = new SqlCommand("SELECT * FROM tblCartProduct ", sqlconn);
// SqlDataAdapter daa = new SqlDataAdapter(cmdd);
// DataTable dtt = new DataTable();
// daa.Fill(dtt);
// RepeaterCartProducts.DataSource = dtt;
// RepeaterCartProducts.DataBind();
//}
public void BindCategory()
{
for (int i = 1; i <= 4; i++)
{
string con = "";
con = @"Data Source=DESKTOP-536RKL2;Initial Catalog=DBshoppingHotspot;Integrated Security=True";
SqlConnection sqlconn = new SqlConnection(con);
sqlconn.Open();
SqlCommand cmdd = new SqlCommand("Select * from tblCategory where pos='" + i + "'", sqlconn);
SqlDataAdapter daa = new SqlDataAdapter(cmdd);
DataTable dtt = new DataTable();
daa.Fill(dtt);
if (dtt.Rows.Count > 0)
{
if (i == 1)
{
lblCategoryname1.Text = dtt.Rows[0][1].ToString();
}
if (i == 2)
{
lblCategoryName2.Text = dtt.Rows[0][1].ToString();
}
if (i == 3)
{
lblCategoryName3.Text = dtt.Rows[0][1].ToString();
}
if (i == 4)
{
lblCategoryName4.Text = dtt.Rows[0][1].ToString();
}
}
}
}
protected void btnviewcart_Click(object sender, EventArgs e)
{
Session["ViewCart"] = "ViewCart";
Response.Redirect("Login.aspx");
}
}
}