private void btnModificarConvenio_Click(object sender, EventArgs e) { convenios oConvenios = new convenios(); ConvenioImplement oConvenioImplement = new ConvenioImplement(); DataGridViewRow row = this.dgvConvenio.CurrentRow; if (btnModificarConvenio.Text == "&Modificar Convenio") { if (row != null) { row.ReadOnly = false; row.Cells[0].ReadOnly = true; row.Cells[1].ReadOnly = true; row.Cells[2].ReadOnly = true; row.Cells[3].ReadOnly = true; row.Cells[4].ReadOnly = true; row.Cells[5].ReadOnly = true; row.Cells[7].ReadOnly = true; _facturadasOriginal = Convert.ToInt32(row.Cells[6].Value); _idConvenio = Convert.ToInt32(row.Cells[1].Value); oConvenios = oConvenioImplement.Get(_idConvenio); btnModificarConvenio.Text="&Terminar Modificacion"; } } else { if (row != null) { int _facturadasNuevas=Convert.ToInt32(row.Cells[6].Value); int _cuotas = Convert.ToInt32(row.Cells[5].Value); if (_facturadasNuevas >= _facturadasOriginal && _facturadasNuevas <= _cuotas) { _idConvenio = Convert.ToInt32(row.Cells[1].Value); oConvenios = oConvenioImplement.Get(_idConvenio); oConvenios.fecha_convenio = Convert.ToDateTime(row.Cells[2].Value); oConvenios.importe_total = Convert.ToDecimal(row.Cells[3].Value); oConvenios.cuotas = Convert.ToInt32(row.Cells[5].Value); oConvenios.valor_cuota = Convert.ToDecimal(row.Cells[4].Value); oConvenios.facturadas = Convert.ToInt32(row.Cells[6].Value); if (oConvenios.cuotas == oConvenios.facturadas) { //if (row.Cells[7].Value == "Si") oConvenios.finalizado = true; } else oConvenios.finalizado = false; oConvenioImplement.Update(oConvenios); btnModificarConvenio.Text = "&Modificar Convenio"; frmConvenios_Load(sender, e); } else { frmVentanaInformativa f = new frmVentanaInformativa("Cantidad facturadas incorrecta."); f.ShowDialog(); } } } }
private void btnTransferir_Click(object sender, EventArgs e) { convenios oConvenios = new convenios(); ConvenioImplement oConvenioImplement = new ConvenioImplement(); DataGridViewRow row = this.dgvConvenio.CurrentRow; if (row != null) { int _idConvenio = Convert.ToInt32(row.Cells[1].Value); Buscadores.frmBuscarSocio f = new Buscadores.frmBuscarSocio(); f.Text = "Facturas Seleccion"; int _idSocioATransferir = 0; if (f.ShowDialog() == DialogResult.OK) { _idSocioATransferir = f.ValorIdRetorno; if (_idSocioATransferir > 0) { oConvenios = oConvenioImplement.Get(_idConvenio); oConvenios.id_socio = _idSocioATransferir; oConvenioImplement.Update(oConvenios); CargarConveniosBySocio(); } else { frmVentanaInformativa frmInfo = new frmVentanaInformativa("No se selecciono ningun socio."); frmInfo.ShowDialog(); } } } }