private void cbbLinea_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { Close(); } if (e.KeyCode != Keys.Enter) { return; } LineaLogica line = new LineaLogica(); line.Linea = cbbLinea.SelectedValue.ToString(); DataTable datos = LineaLogica.ConsultarLine(line); if (datos.Rows.Count != 0) { txtNombre.Text = datos.Rows[0]["nombre"].ToString(); cbbPlanta.SelectedValue = datos.Rows[0]["planta"].ToString(); AreaLogica area = new AreaLogica(); area.Planta = datos.Rows[0]["planta"].ToString(); DataTable dtA = AreaLogica.ListarPlanta(area); cbbArea.DataSource = dtA; cbbArea.ValueMember = "area"; cbbArea.DisplayMember = "area"; cbbArea.SelectedValue = datos.Rows[0]["area"].ToString(); cbbMaterial.SelectedValue = datos.Rows[0]["standar"].ToString(); LinestdLogica lin = new LinestdLogica(); lin.Linea = cbbLinea.SelectedValue.ToString(); lin.Turno = "1"; DataTable Lista = LinestdLogica.Listar(lin); dgwTurno1.DataSource = Lista; lin.Turno = "2"; DataTable Lista2 = LinestdLogica.Listar(lin); dgwTurno2.DataSource = Lista2; txtNombre.Focus(); } CargarStd(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void cbbPlanta_SelectionChangeCommitted(object sender, EventArgs e) { try { AreaLogica area = new AreaLogica(); area.Planta = cbbPlanta.SelectedValue.ToString(); DataTable dt = AreaLogica.ListarPlanta(area); cbbArea.DataSource = dt; cbbArea.ValueMember = "area"; cbbArea.DisplayMember = "area"; cbbArea.SelectedValue = -1; } catch (Exception ex) { MessageBox.Show("Favor de Notificar al Administrador" + Environment.NewLine + ex.ToString(), "Error..." + Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }