Example #1
0
        private void menuAgregarPersonas_Click_1(object sender, EventArgs e)
        {
            frmInsertarPersonas frm = new frmInsertarPersonas();

            frm.MdiParent   = this;
            frm.WindowState = FormWindowState.Maximized;
            frm.MaximizeBox = false;
            frm.Show();
            this.DisposeAllButThis(frm);
        }
Example #2
0
 public void tipoBotonClic(DataGridViewCellEventArgs e)
 {
     //si el click es en el boton actualizar
     if (e.RowIndex >= 0)
     {
         if (e.ColumnIndex == btnUpdate.Index)
         {
             frmInsertarPersonas frm = new frmInsertarPersonas();
             frm.MdiParent   = this.MdiParent;
             frm.WindowState = FormWindowState.Maximized;
             frm.Show();
             frm.BoxTipoPersona.SelectedItem = "Cliente";
             frm.BoxTipoPersona.Enabled      = false;
             frm.TipoInsercion       = 1;
             frm.TxtFkPersonas.Text  = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[0].Value);
             frm.TxtFkGlobal.Text    = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[1].Value);
             frm.TxtNit.Text         = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[2].Value);
             frm.TxtNombre.Text      = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[3].Value);
             frm.TxtDireccion.Text   = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[4].Value);
             frm.TxtTelefono.Text    = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[5].Value);
             frm.TxtCelular.Text     = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[6].Value);
             frm.TxtCorreo.Text      = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[7].Value);
             frm.BoxTipoCliente.Text = Convert.ToString(tblClientes.Rows[e.RowIndex].Cells[8].Value);
             this.Dispose();
         }
         //si el click es en el boton eliminar
         if (e.ColumnIndex == btnEliminar.Index)
         {
             if (MessageBox.Show("Esta seguro de eliminar este registro?", "Eliminar Registro", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 if (MessageBox.Show("Esta totalmente seguro?", "Eliminar Registro", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     int codigo = Convert.ToInt32(tblClientes.Rows[e.RowIndex].Cells[0].Value);
                     ClienteBLL.DeleteCliente(codigo);
                     MessageBox.Show("Registro eliminado");
                     this.cargarDatosClientes();
                 }
             }
         }
     }
 }