private void cbSala_SelectedValueChanged(object sender, EventArgs e) { string id_sala; if (cbSala.SelectedValue != null) { id_sala = cbSala.SelectedValue.ToString(); //.ToString(); logSalas objlogSalas = new logSalas(); DataTable gruposSalas = new DataTable(); gruposSalas = objlogSalas.traerSalasCupo(); DataRow[] rows = gruposSalas.Select("SAL_ID = " + id_sala); int CANTIDAD = Convert.ToInt16(rows[0]["CANTIDAD"].ToString()); int MAXIMO = Convert.ToInt16(rows[0]["MAXIMO"].ToString()); int VACANTES = MAXIMO - CANTIDAD; txtVacantes.Text = VACANTES.ToString(); if (VACANTES > 0) { lbl_panelSala.Visible = false; panelDatos.Visible = true; panelContacto.Visible = true; btnGuardar.Visible = true; btnCancelar.Visible = true; txtDocumento.Focus(); } else { txtVacantes.Style = MetroFramework.MetroColorStyle.Red; txtVacantes.Focus(); MessageBox.Show("No existen vacantes para el turno y sala elegida. Por favor elija otro turno.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void cbSala_SelectedValueChanged(object sender, EventArgs e) { string id_sala; if (cbSala.SelectedValue != null) { id_sala = cbSala.SelectedValue.ToString(); //.ToString(); logSalas objlogSalas = new logSalas(); DataTable gruposSalas = new DataTable(); gruposSalas = objlogSalas.traerSalasCupo(); DataRow[] rows = gruposSalas.Select("SAL_ID = " + id_sala); int CANTIDAD = Convert.ToInt16(rows[0]["CANTIDAD"].ToString()); int MAXIMO = Convert.ToInt16(rows[0]["MAXIMO"].ToString()); int VACANTES = MAXIMO - CANTIDAD; txtLegajo.Text = VACANTES.ToString(); string color = cbSala.SelectedIndex.ToString(); if (color == "0") { lblSala.Visible = true; lblSala.Font = new Font(lblSala.Font.Name, 12); lblSala.ForeColor = Color.Gainsboro; lblSala.Text = " 1 a 2 años "; } else if (color == "1") { lblSala.Visible = true; lblSala.Font = new Font(lblSala.Font.Name, 12); lblSala.ForeColor = Color.Gainsboro; lblSala.Text = "3 a 4 años"; } else if (color == "2") { lblSala.Visible = true; lblSala.Font = new Font(lblSala.Font.Name, 12); lblSala.ForeColor = Color.Gainsboro; lblSala.Text = " 4 a 5 años "; } else { lblSala.Visible = false; } } else { cbSala.Style = MetroFramework.MetroColorStyle.Red; cbSala.Focus(); lblSala.Text = "Por favor, seleccione una sala"; lblSala.ForeColor = Color.Red; } }
private void cbSala_SelectedValueChanged(object sender, EventArgs e) { string id_sala; id_sala = cbSala.SelectedValue.ToString(); //.ToString(); logSalas objlogSalas = new logSalas(); DataTable gruposSalas = new DataTable(); gruposSalas = objlogSalas.traerSalasCupo(); DataRow[] rows = gruposSalas.Select("SAL_ID = " + id_sala); int CANTIDAD = Convert.ToInt16(rows[0]["CANTIDAD"].ToString()); int MAXIMO = Convert.ToInt16(rows[0]["MAXIMO"].ToString()); int VACANTES = MAXIMO - CANTIDAD; txtLegajo.Text = VACANTES.ToString(); }