public TableED(string table_id) { InitializeComponent(); txt_tablename.KeyPress += Txt_tablename_KeyPress; txt_numOfSeat.KeyPress += Txt_numOfSeat_KeyPress; this.is_edit = true; btn_addTable.Text = "UPDATE"; btn_cancelTable.Text = "DELETE"; try { TableZone tableZone = new TableZone(); cb_floor.DataSource = tableZone.getTableZone(); cb_floor.ValueMember = "f_id"; cb_floor.DisplayMember = "f_name"; cb_zone.DataSource = tableZone.getTableZone(); cb_zone.ValueMember = "t_id"; cb_zone.DisplayMember = "t_name"; Tables tables = new Tables(table_id); DataTable data = tables.getTableById(); this.table_id = data.Rows[0]["id"].ToString(); this.Text = data.Rows[0]["name"].ToString(); txt_tablename.Text = data.Rows[0]["name"].ToString(); txt_numOfSeat.Text = data.Rows[0]["num_seats"].ToString(); cb_floor.SelectedValue = data.Rows[0]["floor_id"].ToString(); cb_zone.SelectedValue = data.Rows[0]["zone_id"].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void tabZone_Enter(object sender, EventArgs e) { cbz_search.Items.Clear(); cbz_search.Items.Add("Floor"); cbz_search.Items.Add("Zone"); cbz_search.SelectedIndex = 0; btn_clear.Hide(); txtz_search.Clear(); txtz_search.Focus(); refreshZone(tableZone.getTableZone()); }