-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCatalog.aspx.cs
50 lines (47 loc) · 1.86 KB
/
Catalog.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Catalog : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// don't reload data during postbacks
if (!IsPostBack)
{
PopulateControls();
}
}
// Fill the page with data
private void PopulateControls()
{
// Retrieve DepartmentID from the query string
string departmentId = Request.QueryString["DepartmentID"];
// Retrieve CategoryID from the query string
string categoryId = Request.QueryString["CategoryID"];
// If browsing a category...
if (categoryId != null)
{
// Retrieve category and department details and display them
CategoryDetails cd = CatalogAccess.GetCategoryDetails(categoryId);
catalogTitleLabel.Text = HttpUtility.HtmlEncode(cd.Name);
DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId);
catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(cd.Description);
// Set the title of the page
this.Title = HttpUtility.HtmlEncode(BalloonShopConfiguration.SiteName +
": " + dd.Name + ": " + cd.Name);
}
// If browsing a department...
else if (departmentId != null)
{
// Retrieve department details and display them
DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId);
catalogTitleLabel.Text = HttpUtility.HtmlEncode(dd.Name);
catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(dd.Description);
// Set the title of the page
this.Title = HttpUtility.HtmlEncode(BalloonShopConfiguration.SiteName + ": " + dd.Name);
}
}
}