private void tsb_btn_modificar_Click(object sender, EventArgs e) { if (dtg_desplegar.Rows.Count == 0) { MessageBox.Show("No hay registros para eliminar", "Eliminar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { frm_ModificaOperador_PL frm_Modificar = new frm_ModificaOperador_PL (ref Obj_Operadores_DAL, null, "Modificar", Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[0].Value)); #region Cargar combobox Obj_estados_BLL.listar_estados(ref Obj_estados_DAL); if (Obj_estados_DAL.smsjError == string.Empty) { frm_Modificar.cmb_Estado.DisplayMember = "Descripción"; frm_Modificar.cmb_Estado.ValueMember = "Código"; frm_Modificar.cmb_Estado.DataSource = Obj_estados_DAL.Ds.Tables[0]; } else { MessageBox.Show(" Se presento el siguiente error " + Obj_estados_DAL.smsjError, "Error", MessageBoxButtons.OK); } Obj_turnos_BLL.listar_turnos(ref Obj_turnos_DAL); if (Obj_estados_DAL.smsjError == string.Empty) { frm_Modificar.cmb_Turno.DisplayMember = "Descripción"; frm_Modificar.cmb_Turno.ValueMember = "Código"; frm_Modificar.cmb_Turno.DataSource = Obj_turnos_DAL.Ds.Tables[0]; } else { MessageBox.Show(" Se presento el siguiente error " + Obj_turnos_DAL.smsjError, "Error", MessageBoxButtons.OK); } #endregion Obj_turnos_BLL.listar_turnos(ref Obj_turnos_DAL); Obj_estados_BLL.listar_estados(ref Obj_estados_DAL); frm_Modificar.txt_Nombre.Text = Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[1].Value); frm_Modificar.txt_Apellido.Text = Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[2].Value); frm_Modificar.txt_Nick.Text = Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[3].Value); frm_Modificar.cmb_Nivel.Text = Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[5].Value); frm_Modificar.cmb_Turno.Text = Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[4].Value); frm_Modificar.cmb_Estado.Text = Convert.ToString(dtg_desplegar.Rows[i16Fila].Cells[6].Value); frm_Modificar.ShowDialog(this); listar(); } }
private void tsb_btn_agregar_Click(object sender, EventArgs e) { Obj_Operadores_DAL = new Cls_operadores_DAL(); frm_ModificaOperador_PL frm_InsertUpdate_PL = new frm_ModificaOperador_PL(ref Obj_Operadores_DAL, null, "Insertar"); frm_InsertUpdate_PL.ShowDialog(this); if (Obj_Operadores_DAL.bbandera) { MessageBox.Show("Se ha agregado correctamente", "Agregado correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); listar(); } else { if (Obj_Operadores_DAL.smsjError != null) { MessageBox.Show("Ha un ocurrido un error.\n\nDetalle: " + Obj_Operadores_DAL.smsjError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }