示例#1
0
 private void Fill_Banco()
 {
     using (nb = new NBanco())
     {
         dgvbanco.DataSource = nb.Getall();
         lbltotal.Text       = "Total registro: " + dgvbanco.Rows.Count;
     }
 }
示例#2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         string rpta = "";
         if (txtCodigo.Text == string.Empty | txtNombre.Text == string.Empty)
         {
             if (txtCodigo.Text == string.Empty)
             {
                 MensajeError("Falta ingresar algunos datos, serán remarcados");
                 errorIcono.SetError(txtCodigo, "Ingrese el código del banco");
             }
             if (txtNombre.Text == string.Empty)
             {
                 MensajeError("Falta ingresar algunos datos, serán remarcados");
                 errorIcono.SetError(txtNombre, "Ingrese el nombre del banco");
             }
         }
         else
         {
             if (IsNuevo)
             {
                 rpta = NBanco.Insertar(Convert.ToInt32(txtCodigo.Text),
                     Convert.ToString(txtNombre.Text));
             }
             else
             {
                 rpta = NBanco.Editar(Convert.ToInt32(txtCodigo.Text), 
                     Convert.ToString(txtNombre.Text));
             }
             if (rpta.Equals("OK"))
             {
                 if (IsNuevo)
                 {
                     MensajeOk("El registro fue ingresado con exito");
                 }
                 else
                 {
                     MensajeOk("El registro fue modificado con exito");
                 }
             }
             else
             {
                 MensajeError(rpta);
             }
             IsNuevo = false;
             IsEditar = false;
             Botones();
             LimpiarFrm();
             Mostrar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#3
0
 //MOSTRAR PARA CONTRATO
 private void Mostar_banco()
 {
     using (NBanco nb = new NBanco())
     {
         cbobanco.DataSource    = nb.Getall();
         cbobanco.DisplayMember = "Nom_banco";
         cbobanco.ValueMember   = "IdBanco";
     }
 }
示例#4
0
        private void dgvbanco_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                if (dgvbanco.Rows[e.RowIndex].Cells["bmodificar"].Selected)
                {
                    mensaje = "";
                    using (nb = new NBanco())
                    {
                        nb.state     = EntityState.Modificar;
                        nb.IdBanco   = Convert.ToInt32(dgvbanco.Rows[e.RowIndex].Cells["bid"].Value);
                        nb.Nom_banco = dgvbanco.Rows[e.RowIndex].Cells["bnombre"].Value.ToString().ToUpper();
                        mensaje      = nb.GuardarCambios();
                        Fill_Banco();

                        Messages.M_info(mensaje);
                        nb.state = EntityState.Guardar;
                    }
                }
                else if (dgvbanco.Rows[e.RowIndex].Cells["beliminar"].Selected)
                {
                    mensaje = "";
                    using (nb = new NBanco())
                    {
                        string       nombre_ban = dgvbanco.CurrentRow.Cells["bnombre"].Value.ToString();
                        DialogResult result     = Messages.M_question("¿Está seguro de eliminar  " + nombre_ban + "?");
                        if (result == DialogResult.Yes)
                        {
                            nb.state   = EntityState.Remover;
                            nb.IdBanco = Convert.ToInt32(dgvbanco.Rows[e.RowIndex].Cells["bid"].Value);

                            mensaje = nb.GuardarCambios();
                            if (mensaje.Contains("esta  asignado."))
                            {
                                Messages.M_error(mensaje);
                            }
                            else
                            {
                                Messages.M_info(mensaje);
                                Fill_Banco();
                            }
                            nb.state = EntityState.Guardar;
                        }
                    }
                }
            }
        }
示例#5
0
        private void btnguardar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(txtBanco.Text))
            {
                ValidateChildren();
                return;
            }
            mensaje = "";
            using (nb = new NBanco())
            {
                nb.Nom_banco = txtBanco.Text.Trim().ToUpper();
                mensaje      = nb.GuardarCambios();
            }

            txtBanco.Text = string.Empty;
            txtBanco.Focus();
            Fill_Banco();
        }
示例#6
0
 private void cmdEliminar_Click(object sender, EventArgs e)
 {
     if (chkEliminar.Checked == false)
     {
         return;
     }
     try
     {
         DialogResult Opcion;
         Opcion = MessageBox.Show("Desea Eliminar estos registros", "Sistema S&B", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (Opcion == DialogResult.Yes)
         {
             string Codigo;
             string Rpta = "";
             for (int i = 0; i < lvwBanco.Items.Count; i++)
             {
                 if (lvwBanco.Items[i].Checked == true)
                 {
                     Codigo = Convert.ToString(lvwBanco.Items[i].SubItems[1].Text);
                     Rpta = NBanco.Eliminar(Convert.ToInt32(Codigo));
                     if (Rpta.Equals("OK"))
                     {
                         MensajeOk("El Registro se Eliminó con Exito");
                     }
                     else
                     {
                         MensajeError(Rpta);
                     }
                 }
             }
             Mostrar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#7
0
 //Método buscarnombre
 private void BuscarNombre()
 {
     LlenarListView(NBanco.BuscarNombre(Convert.ToString(txtBuscar.Text)));
     lblTotal.Text = "Cantidad de Registros: " + Convert.ToString(lvwBanco.Items.Count);
 }
示例#8
0
 // Metodo ocultar columnas
 private void Mostrar()
 {
     LlenarListView(NBanco.mostrar());
     lblTotal.Text = "Cantidad de Registros: " + Convert.ToString(lvwBanco.Items.Count);
 }
示例#9
0
 private void LlenarBanco()
 {
     cmbBanco.DataSource    = NBanco.mostrar();
     cmbBanco.ValueMember   = "IdBanco";
     cmbBanco.DisplayMember = "Descripcion";
 }