private void cbbClave_SelectedIndexChanged(object sender, EventArgs e) { if (cbbClave.SelectedIndex == -1) { return; } dgwHrs.DataSource = null; dgwLineas.DataSource = null; string sCve = cbbClave.SelectedValue.ToString(); LineaConfigLogica con = new LineaConfigLogica(); con.Clave = sCve; DataTable data = LineaConfigLogica.ConsultarClave(con); if (data.Rows.Count > 0) { txtDescrip.Text = data.Rows[0]["descrip"].ToString(); lblMeta.Text = data.Rows[0]["meta"].ToString(); cbbMetaum.SelectedValue = data.Rows[0]["meta_um"].ToString(); cbbTurno.SelectedValue = data.Rows[0]["turno"].ToString(); DataTable dtH = LineaConfigLogica.ConsultarVistaHorario(con); dgwHrs.DataSource = dtH; DataTable dtL = LineaConfigLogica.VistaClaveLine(con); dgwLineas.DataSource = dtL; CargarColumnasHr(); } }
// hora por hora private void cbbClave_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { Close(); } if (e.KeyCode != Keys.Enter) { return; } try { if (!string.IsNullOrEmpty(cbbClave.Text) && !string.IsNullOrWhiteSpace(cbbClave.Text)) { string sCodigo = cbbClave.Text.ToUpper().ToString(); LineaConfigLogica con = new LineaConfigLogica(); con.Clave = sCodigo; DataTable datos = LineaConfigLogica.ConsultarClave(con); if (datos.Rows.Count != 0) { txtDescrip.Text = datos.Rows[0]["descrip"].ToString(); lblMeta.Text = datos.Rows[0]["meta"].ToString(); cbbMetaum.SelectedValue = datos.Rows[0]["meta_um"].ToString(); cbbTurno.SelectedValue = datos.Rows[0]["turno"].ToString(); DataTable dtH = LineaConfigLogica.ConsultarVistaHorario(con); dgwHrs.DataSource = dtH; DataTable dtL = LineaConfigLogica.VistaClaveLine(con); dgwLineas.DataSource = dtL; CargarColumnasHr(); } else { // nuevo codigo InicioHr(); cbbClave.Text = sCodigo; } } } catch (Exception ex) { MessageBox.Show("Favor de notificar al Administrador." + Environment.NewLine + ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }