protected void Page_Load(object sender, EventArgs e) { DgBan.DataSource = dsBan(); DgBan.DataBind(); DgBan.HeaderRow.Cells[0].Text = "Mã Bàn "; DgBan.HeaderRow.Cells[1].Text = "Số Người "; }
protected void BntThem_Click(object sender, EventArgs e) { if ((TxtMaBan.Text != "") && (TxtSoNguoi.Text != "")) { try { ThemBan(TxtMaBan.Text, TxtSoNguoi.Text); lblTB.Text = "Đã thêm vào thành công."; DgBan.DataSource = dsBan(); DgBan.DataBind(); DgBan.HeaderRow.Cells[0].Text = "Mã Bàn "; DgBan.HeaderRow.Cells[1].Text = "Số Người "; TxtMaBan.Text = ""; TxtSoNguoi.Text = ""; } catch { lblTB.Text = "Không thể thêm thông tin này. Vui lòng kiểm tra lại."; } } else { lblTB.Text = "Không thể thêm thông tin này. Vui lòng kiểm tra lại."; } }
protected void BntXoa_Click(object sender, EventArgs e) { if ((TxtMaBan.Text == "") || (TxtSoNguoi.Text == "")) { lblTB.Text = "Không thể xóa thông tin này. Vui lòng kiểm tra lại."; } else { Xoa_Ban(TxtMaBan.Text); DgBan.DataSource = dsBan(); DgBan.DataBind(); DgBan.HeaderRow.Cells[0].Text = "Mã Bàn "; DgBan.HeaderRow.Cells[1].Text = "Số Người "; lblTB.Text = "Xóa thành công !"; TxtMaBan.Text = ""; TxtSoNguoi.Text = ""; } }