private void cb_floor_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = (ComboBox)sender; if (int.TryParse(cb_floor.SelectedValue.ToString(), out int number)) { this.floor_id = cb_floor.SelectedValue.ToString(); this.floor_name = cb.Text; tableZone = new TableZone(); DataTable dataZone = tableZone.getZoneByFloorId(this.floor_id); if (dataZone.Rows.Count > 0) { cb_zone.DataSource = dataZone; cb_zone.ValueMember = "id"; cb_zone.DisplayMember = "name"; } else { FLP_tables.Controls.Clear(); this.cb_zone.SelectedIndexChanged -= new EventHandler(cb_zone_SelectedIndexChanged); cb_zone.DataSource = null; cb_zone.Items.Clear(); this.cb_zone.SelectedIndexChanged += new EventHandler(cb_zone_SelectedIndexChanged); } } }
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); } }
public ZoneED(string tableZoneId) { InitializeComponent(); is_edit = true; btn_addZone.Text = "UPDATE"; btn_cancelZone.Text = "DELETE"; try { Floor floor = new Floor(); cb_floor.DataSource = floor.getFloor(); cb_floor.ValueMember = "id"; cb_floor.DisplayMember = "name"; TableZone tableZone = new TableZone(tableZoneId); DataTable data = tableZone.getTableZoneById(); this.Text = data.Rows[0]["name"].ToString(); txt_zonename.Text = data.Rows[0]["name"].ToString(); cb_floor.SelectedValue = data.Rows[0]["floor_id"].ToString(); tablezone_id = data.Rows[0]["id"].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public TableForm() { InitializeComponent(); txtz_search.KeyPress += ZoneSearchEnterEventOccure; txtt_search.KeyPress += TableSearchEnterEventOccure; floor = new Floor(); tableZone = new TableZone(); tables = new Tables(); }
private void cb_floor_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = (ComboBox)sender; if (int.TryParse(cb.SelectedValue.ToString(), out int number)) { TableZone tableZone = new TableZone(); cb_zone.DataSource = tableZone.getZoneByFloorId(number.ToString()); cb_zone.ValueMember = "id"; cb_zone.DisplayMember = "name"; } }
private void Txt_zonename_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { string floor_id = cb_floor.SelectedValue.ToString(); string zone_name = Encrption.trim(txt_zonename.Text.ToString()); if (zone_name.Length > 0) { if (zone_name.Length > 191) { MessageBox.Show("Zone name is too long", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (int.TryParse(zone_name, out int result)) { MessageBox.Show("Zone name must be alphabetic", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (is_edit.Equals(true)) { TableZone tableZone = new TableZone(tablezone_id, floor_id, zone_name); if (Convert.ToBoolean(tableZone.updateTableZone()).Equals(true)) { MessageBox.Show("Table zone updated successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { TableZone tableZone = new TableZone(floor_id, zone_name); if (Convert.ToBoolean(tableZone.addTableZone()).Equals(true)) { MessageBox.Show("Table zone created successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } } } else { MessageBox.Show("Please enter zone name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//can I place this object at this position on screen? //TODO detect if object would collide with other balls private bool canPlaceHeld() { int player_num = TurnManager.instance.currentPlayerIndex; Vector2 mousePos = mouseWorldPos(); RaycastHit2D[] hits = Physics2D.RaycastAll(mousePos, mousePos); foreach (RaycastHit2D hit in hits) { TableZone tableZone = hit.collider.gameObject.GetComponent <TableZone>(); if (tableZone && tableZone.ownerNumber == player_num) { return(true); } } return(false); }
private void btn_cancelZone_Click(object sender, EventArgs e) { if (is_edit.Equals(true)) { var confirm = MessageBox.Show("Are you sure..", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirm == DialogResult.Yes) { TableZone tableZone = new TableZone(tablezone_id); if (Convert.ToBoolean(tableZone.deleteTableZone()).Equals(true)) { MessageBox.Show("Table zone has been deleted successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } else { this.Close(); } }