Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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";
            }
        }