private void btnPagar_Click(object sender, EventArgs e) { if (formularioValido()) { FormaPago fp = (FormaPago)cmbFormaPago.Items[cmbFormaPago.SelectedIndex]; long idFactura = Facturas.guardar(Session.usuario.id, Session.fechaAhora(), int.Parse(fp.id.ToString())); for (int i = 0; i < int.Parse(cmbCantPub.Text); i++) { ItemFactura unItem = (ItemFactura)dgvPublicaciones.Rows[i].DataBoundItem; unItem.idFactura = idFactura; ItemsFactura.Guardar(unItem); } if (fp.id == 2) { Tarjetas.Guardar(idFactura, txtNroTarjeta.Text, txtTitular.Text, txtCodigo.Text); } MessageBox.Show("Items pagados!"); this.Close(); } }