-
Notifications
You must be signed in to change notification settings - Fork 0
/
WomanSarees.aspx.cs
142 lines (123 loc) · 4.36 KB
/
WomanSarees.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
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 WomanSarees : 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("procBindAllProducts6", 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";
}
}
}
}
}
protected void txtFilterGrid1Record_TextChanged(object sender, EventArgs e)
{
if (txtFilterGrid1Record.Text != string.Empty)
{
}
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='SAREES' 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
{
}
}
}