private void OFD_FileOk_1(object sender, CancelEventArgs e) { Stream input = null; dgvDatosBanco.DataSource = null; if (contExcel > 0) { string rutaArchivo = OFD.FileName; CapaLogica.Logica.ruta = rutaArchivo; CapaLogica.Logica n = new CapaLogica.Logica(); dgvDatosBanco.DataSource = n.retornoExcel(); dgvActual.DataSource = n.retornoExcel(); dgvEdicion.DataSource = n.retornoExcel(); contExcel = 0; }//fin del if de Excel else if (contXML > 0) { try { if ((input = OFD.OpenFile()) != null) { using (input) { XmlReader xmlFile = XmlReader.Create(input, new XmlReaderSettings()); DataSet dataSet = new DataSet(); dataSet.ReadXml(xmlFile); DataSet containers = new DataSet(); dgvDatosBanco.DataSource = dataSet.Tables[0]; dgvActual.DataSource = dataSet.Tables[0]; dgvEdicion.DataSource = dataSet.Tables[0]; xmlFile.Close(); } } } catch (Exception ex) { MessageBox.Show("ERROR"); } contXML = 0; }//fin del if XML else if (contTXT > 0) { contTXT = 0; } //fin del if de txt } //Fin de metodo ok de open file dialog
private void btnAgregarPago_Click(object sender, EventArgs e) { int idlote = 0; int idCredito = 0; int amortizacion = 0; int intereses = 0; string nombre = txtNombre.Text; string apellido1 = txtApellido1.Text; string apellido2 = txtApellido2.Text; try { if (nombre != "") { int idEmpleado = Convert.ToInt32(txtIdEmpleado.Text); foreach (DataGridViewRow dgvRenglon in dgvEdicion.Rows) { idlote = Convert.ToInt32(dgvRenglon.Cells[0].Value); idCredito = Convert.ToInt32(dgvRenglon.Cells[3].Value); amortizacion = Convert.ToInt32(dgvRenglon.Cells[7].Value); intereses = Convert.ToInt32(dgvRenglon.Cells[8].Value); } CapaLogica.Logica o = new CapaLogica.Logica(); if (o.pago(idlote, idEmpleado, idCredito, amortizacion, intereses, nombre, apellido1, apellido2) == true) { MessageBox.Show("Pago aplicado"); } else { MessageBox.Show(CapaLogica.Logica.error); } } else { MessageBox.Show("Debe seleccionar el Empleado para realizar el pago"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnConsultar_Click(object sender, EventArgs e) { txtNombre.Text = ""; txtApellido1.Text = ""; txtApellido2.Text = ""; int id = Convert.ToInt32(txtIdEmpleado.Text); CapaLogica.Logica m = new CapaLogica.Logica(); if (m.consultar(id) == true) { txtNombre.Text = CapaLogica.Logica.nom; txtApellido1.Text = CapaLogica.Logica.ape1; txtApellido2.Text = CapaLogica.Logica.ape2; } else { MessageBox.Show(CapaLogica.Logica.error); } }