private void Form_Load(object sender, EventArgs e) { try { this.lbOperador.Text = lu.NomEmpleado; this.lbPuesto.Text = lu.DesPuesto; this.lbPlanta.Text = lu.DesPlanta; this.lbProceso.Text = "Configuración Inicial"; // this.dtpFecha.Value = DateTime.Today; // //DataAccess.DA da = new DataAccess.DA(); clsConfigInicial oConfigInicial = new clsConfigInicial(); DataTable dtObj = null; DataRow dr = null; ComboBox cbxObj = null; dtObj = oConfigInicial.getObtenerTurnos().Tables[0]; //dtObj = da.ObtenerTurnos(); dr = dtObj.NewRow(); dr["CodTurno"] = -1; dr["DesTurno"] = "Seleccionar..."; dtObj.Rows.InsertAt(dr, 0); cbxObj = this.cbxTurno; cbxObj.DataSource = dtObj; cbxObj.ValueMember = "CodTurno"; cbxObj.DisplayMember = "DesTurno"; cbxObj.SelectedValue = -1; dtObj = null; cbxObj = null; dtObj = oConfigInicial.getObtenerProcesos().Tables[0]; //dtObj = da.ObtenerProcesos(); dr = dtObj.NewRow(); dr["CodProceso"] = "-1"; dr["DesProceso"] = "Seleccionar..."; dtObj.Rows.InsertAt(dr, 0); cbxObj = this.cbxProcesos; cbxObj.ValueMember = "CodProceso"; cbxObj.DisplayMember = "DesProceso"; cbxObj.DataSource = dtObj; this.cbxProcesos.SelectedIndexChanged += new EventHandler(this.cbxProceso_SelectedIndexChanged); cbxObj.SelectedValue = -1; // this.dtpFecha.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } }
private void cbxProceso_SelectedIndexChanged(object sender, EventArgs e) { try { DataTable dtObj = null; DataRow dr = null; ComboBox cbxObj = null; ComboBox cbxProceso = (ComboBox)sender; int iCodProceso = Convert.ToInt32(cbxProceso.SelectedValue); clsConfigInicial oConfigInicial = new clsConfigInicial(); dtObj = oConfigInicial.getObtenerPantallaProcesos(iCodProceso).Tables[0]; //dtObj = da.ObtenerPantallasProceso(iCodProceso); dr = dtObj.NewRow(); dr["CodPantalla"] = -1; dr["DesPantalla"] = "Seleccionar..."; dtObj.Rows.InsertAt(dr, 0); cbxObj = this.cbxOpcion; cbxObj.DataSource = dtObj; cbxObj.ValueMember = "CodPantalla"; cbxObj.DisplayMember = "DesPantalla"; cbxObj.SelectedValue = -1; if (iCodProceso != -1) { this.cbxOpcion.Focus(); } else { this.cbxProcesos.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } }