private void checkBox1_Click(object sender, EventArgs e) { CheckBox cb = sender as CheckBox; frmTableConfig configForm = new frmTableConfig(); configForm.mesaID = cb.Tag.ToString(); configForm.enableMesa = "NO"; if (cb.Checked) { configForm.enableMesa = "SI"; } DialogResult result = configForm.ShowDialog(); if (result == DialogResult.OK) { DataSet dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(cb.Tag)), "mesa"); cb.Text = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion"); cb.Checked = DataUtil.GetBool(dsMesaInfo.Tables[0].Rows[0], "Mesa_habilitado"); } else { if (cb.Checked) { cb.Checked = false; } else { cb.Checked = true; } } }
private void frmChangeTable_Load(object sender, EventArgs e) { foreach (Control button in this.Controls) { if (button is Button) { Button mesa = button as Button; if (mesa.Tag != null) { DataSet dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(mesa.Tag)), "mesa"); mesa.Text = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion"); mesa.Visible = DataUtil.GetBool(dsMesaInfo.Tables[0].Rows[0], "Mesa_habilitado"); if (DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_estado").Equals("LIBRE")) { mesa.Image = RestautantResource.Mesa; } else { mesa.Visible = false; } } } } }
private void frmTable_Load(object sender, EventArgs e) { DataSet dsMesaInfo = null; foreach (Control mesa in gbSalon.Controls) { CheckBox cb = mesa as CheckBox; dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(cb.Tag)), "mesa"); cb.Text = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion"); cb.Checked = DataUtil.GetBool(dsMesaInfo.Tables[0].Rows[0], "Mesa_habilitado"); } foreach (Control bar in gbBar.Controls) { CheckBox cb = bar as CheckBox; dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(cb.Tag)), "mesa"); cb.Text = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion"); cb.Checked = DataUtil.GetBool(dsMesaInfo.Tables[0].Rows[0], "Mesa_habilitado"); } }