-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCinemasOfferingFood.aspx.cs
60 lines (57 loc) · 1.81 KB
/
CinemasOfferingFood.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
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DBProject.DAL;
namespace DBProject
{
public partial class CinemasOfferingFood : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//fill drop down
string Temp = DropDownList1.SelectedValue.ToString();
if (Temp == "")
{
FillDropDown(sender, e);
}
}
protected void FillDropDown(object sender, EventArgs e)
{
myDAL objmyDal = new myDAL();
DataTable GetData = new DataTable();
objmyDal.GetAllCinemas(ref GetData);
DropDownList1.DataSource = GetData;
GetData.Columns.Add("Cinema", typeof(string), "CinemaName + ' ' + Locations");
DropDownList1.DataTextField = "Cinema";
DropDownList1.DataValueField = "CinemaID";
if (GetData.Rows.Count > 0)
{
DropDownList1.DataBind();
ListItems(sender, e);
}
}
protected void ListItems(object sender, EventArgs e)
{
myDAL objmyDal = new myDAL();
DataTable GetData = new DataTable();
string CinemaID = DropDownList1.Text.ToString();
int found= objmyDal.FoodItemsAvailable(CinemaID, ref GetData);
if (found != 1)
{
Message.Text = "There was some error!";
}
else
{
Message.Text = "Following items are found:";
CinemaGrid.DataSource = GetData;
if (GetData.Rows.Count > 0)
{
CinemaGrid.DataBind();
}
}
}
}
}