-
Notifications
You must be signed in to change notification settings - Fork 0
/
ManDenims.aspx.cs
169 lines (150 loc) · 5.43 KB
/
ManDenims.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Globalization;
using System.Threading;
public partial class ManDenims : System.Web.UI.Page
{
public static String CS = ConfigurationManager.ConnectionStrings["EasyBuy123"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Username"] != null)
{
if (!IsPostBack)
{
if (Request.QueryString["BuyNow"] == "YES")
{
}
BindProductRepeater();
BindCartNumber();
}
}
else
{
if (Request.QueryString["BuyNow"] == "YES")
{
Response.Redirect("SignIn.aspx");
}
else
{
Response.Redirect("~/Default.aspx");
}
}
}
private void BindProductRepeater()
{
using (SqlConnection con = new SqlConnection(CS))
{
using (SqlCommand cmd = new SqlCommand("procBindAllProducts4", con))
{
cmd.CommandType = CommandType.StoredProcedure;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
rptrProducts.DataSource = dt;
rptrProducts.DataBind();
if (dt.Rows.Count <= 0)
{
// Label1.Text = "Sorry! Currently no products in this category.";
}
else
{
//Label1.Text = "Showing All Products";
}
}
}
}
}
protected override void InitializeCulture()
{
CultureInfo ci = new CultureInfo("en-IN");
ci.NumberFormat.CurrencySymbol = "₹";
Thread.CurrentThread.CurrentCulture = ci;
base.InitializeCulture();
}
public void BindCartNumber()
{
if (Session["USERID"] != null)
{
string UserIDD = Session["USERID"].ToString();
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("SP_BindCartNumberz", con)
{
CommandType = CommandType.StoredProcedure
};
cmd.Parameters.AddWithValue("@UserID", UserIDD);
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
string CartQuantity = dt.Compute("Sum(Qty)", "").ToString();
//CartBadge.InnerText = CartQuantity;
}
else
{
// _ = CartBadge.InnerText == 0.ToString();
//CartBadge.InnerText = "0";
}
}
}
}
}
private void SearchProductByTextbox()
{
using (SqlConnection con = new SqlConnection(CS))
{
using (SqlCommand cmd = new SqlCommand("procBindAllProductsMasShirtFilter", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@TXT", txtFilterGrid1Record.Text);
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
rptrProducts.DataSource = dt;
rptrProducts.DataBind();
if (dt.Rows.Count <= 0)
{
// Label1.Text = "Sorry! Currently no products in this category.";
}
else
{
//Label1.Text = "Showing All Products";
}
}
}
}
}
protected void txtFilterGrid1Record_TextChanged(object sender, EventArgs e)
{
if (txtFilterGrid1Record.Text != string.Empty)
{
// SearchProductByTextbox();
}
SqlConnection con = new SqlConnection(CS);
con.Open();
string qr = "select A.*,B.*,C.Name ,A.PPrice-A.PSelPrice as DiscAmount,B.Name as ImageName, C.Name as BrandName from tblProducts A inner join tblBrands C on C.BrandID =A.PBrandID inner join tblCategory as t2 on t2.CatID=A.PCategoryID cross apply( select top 1 * from tblProductImages B where B.PID= A.PID order by B.PID desc )B where t2.CatName='Denim' or t2.CatName='Jeans' AND A.PName like '" + txtFilterGrid1Record.Text + "%' order by A.PID desc";
SqlDataAdapter da = new SqlDataAdapter(qr, con);
string text = ((TextBox)sender).Text;
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
rptrProducts.DataSource = ds.Tables[0];
rptrProducts.DataBind();
}
else
{
}
}
}