-
Notifications
You must be signed in to change notification settings - Fork 0
/
MasterProductDisplay.master.cs
70 lines (55 loc) · 2.3 KB
/
MasterProductDisplay.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
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class MasterProductDisplay : System.Web.UI.MasterPage
{
dsProductTableAdapters.ProductTableAdapter taProduct = new dsProductTableAdapters.ProductTableAdapter();
dsProduct.ProductDataTable dtProduct;
protected void Page_Load(object sender, EventArgs e)
{
SetProductCategories();
SetProductQuantity();
}
public void setQtyValue(int qty)
{
lblTotalItems.Text = qty.ToString();
}
private void SetProductQuantity()
{
int TotalQty =0;
if (Session["NewGuid"] !=null)
TotalQty = Convert.ToInt16(taProduct.SelectProductCountUsingVisitorId(Session["NewGuid"].ToString()));
lblTotalItems.Text = "Your Shopping Cart contains (" + TotalQty.ToString() + ") items";
if (Convert.ToInt16( TotalQty) == 0)
btnGoToCart.Enabled = false;
else
btnGoToCart.Enabled = true;
}
private void SetProductCategories()
{
SqlConnection conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["MBCConnectionString"].ToString());
conn.Open();
DataTable dtDB = new DataTable("category");
SqlDataAdapter adpDB = new SqlDataAdapter("select 'productviewgallery.aspx?dispid=idPrdDipCategoryWiseSpecificCategory&catQty='+categoryname+'&categoryid=' + cast(categoryid as varchar(2)) as categoryid,categoryname + '(' + cast(dbo.TotalProductsOfThisCategory(categoryid) as varchar(4)) + ')' as categoryname from category where companyid=16", conn);
adpDB.Fill(dtDB);
BulletedList2.DataSource = dtDB;
BulletedList2.DataMember = "category";
BulletedList2.DataValueField = "categoryid";
BulletedList2.DataTextField = "categoryname";
BulletedList2.DataBind();
BulletedList1.DataSource = dtDB;
BulletedList1.DataMember = "category";
BulletedList1.DataValueField = "categoryid";
BulletedList1.DataTextField = "categoryname";
BulletedList1.DataBind();
}
protected void GoToCart(object sender, EventArgs e)
{
Response.Redirect("cart.aspx");
}
}