示例#1
0
 private void tsb_btn_modificar_Click(object sender, EventArgs e)
 {
     if (dtg_desplegar.SelectedRows.Count == 1)
     {
         Obj_marcaactivo_DAL = new Cls_marcaactivo_DAL();
         // Se obtinenen los datos del DataGridView
         Obj_marcaactivo_DAL.iId_MarcaActivo   = Convert.ToInt32(dtg_desplegar.SelectedRows[0].Cells[0].Value);
         Obj_marcaactivo_DAL.sDesc_MarcaActivo = dtg_desplegar.SelectedRows[0].Cells[1].Value.ToString();
         string sEstado = dtg_desplegar.SelectedRows[0].Cells[2].Value.ToString();
         // Se abre la ventana de modificación
         frm_editar_marcaactivo_PL frm_editar_marcaactivo = new frm_editar_marcaactivo_PL(ref Obj_marcaactivo_DAL, sEstado);
         frm_editar_marcaactivo.ShowDialog(this);
         // Se evalua el resultado de la operación y se muestra el mensaje de error o de operación realizada
         if (Obj_marcaactivo_DAL.bbandera)
         {
             MessageBox.Show("Se ha modificado correctamente", "Modificado correcto",
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
             listar();
         }
         else
         {
             if (Obj_marcaactivo_DAL.smsjError != null)
             {
                 MessageBox.Show("Ha un ocurrido un error.\n\nDetalle: " + Obj_marcaactivo_DAL.smsjError, "Error",
                                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Por favor selecciones una fila.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
 private void tsb_btn_agregar_Click(object sender, EventArgs e)
 {
     Obj_marcaactivo_DAL     = new Cls_marcaactivo_DAL();
     frm_agregar_marcaactivo = new frm_editar_marcaactivo_PL(ref Obj_marcaactivo_DAL, null);
     frm_agregar_marcaactivo.ShowDialog(this);
     if (Obj_marcaactivo_DAL.bbandera)
     {
         MessageBox.Show("Se ha agregado correctamente", "Agregado correcto",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
         listar();
     }
     else
     {
         if (Obj_marcaactivo_DAL.smsjError != null)
         {
             MessageBox.Show("Ha un ocurrido un error.\n\nDetalle: " + Obj_marcaactivo_DAL.smsjError, "Error",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }