private void btnGarantiaVehiculo_Click(object sender, EventArgs e) { FormSolicitudGarantiaVehiculo frmGVehiculo = new FormSolicitudGarantiaVehiculo(); try { this.Cursor = Cursors.WaitCursor; frmGVehiculo.nombreUsuario = nombreUsuario; frmGVehiculo.solicitudId = solicitudId; frmGVehiculo.OFICINA_ID = oficinaID; frmGVehiculo.VALOR_ID = "0"; frmGVehiculo.DTVariablesSYS = DTVariablesSYS; frmGVehiculo.DSGlobal = DSGlobal; frmGVehiculo.EnEjecusion = true; frmGVehiculo.ShowDialog(); if (frmGVehiculo.lOK) { this.GetData(); } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } finally { this.Cursor = Cursors.Default; frmGVehiculo.Dispose(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { string valorUnico = "0"; int entidadId = 0; string documentoId = "0"; string tipoGarantiaId = ""; string temporalId = ""; DialogResult resp; int resultado = 0, index = 0; List <DataDB_ELR_NET.Parametro> parametros = new List <DataDB_ELR_NET.Parametro>(); DataRow MyFila = null; FormSolicitudCreditoR frmGPersonal = new FormSolicitudCreditoR(); FormSolicitudGarantiaVehiculo frmGVehiculo = new FormSolicitudGarantiaVehiculo(); WinControl_ELR_NET.ELRFormMensajeErrores frmMensajeErrores = new WinControl_ELR_NET.ELRFormMensajeErrores(); try { this.Cursor = Cursors.WaitCursor; temporalId = objUtil.GetTemporalID(); var senderGrid = (DataGridView)sender; if (MyData == null) { return; } if (MyData.Rows.Count <= 0) { return; } if (e.RowIndex < 0) { return; } valorUnico = senderGrid["unico", senderGrid.CurrentRow.Index].Value.ToString(); index = senderGrid.CurrentRow.Index; //ELIMINAMOS UN REGISTRO DE GARANTIA if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { resp = objUtil.MostrarMensajePregunta("Esta Seguro que desea Eliminar el Registro de Esta Garantia?"); if (resp == System.Windows.Forms.DialogResult.Yes) { parametros.Add(new DataDB_ELR_NET.Parametro("IdentificadorTemp", temporalId)); parametros.Add(new DataDB_ELR_NET.Parametro("Unico", valorUnico)); parametros.Add(new DataDB_ELR_NET.Parametro("Autor", nombreUsuario)); objDB.iniciarTransaccion(); resultado = objDB.EjecutarSP("SP_PRESTAMOS_ELIMINA_GARANTIA", parametros); if (resultado > 0) { objDB.confirmarTransaccion(); RealizarBusquedaSencilla(); } else { frmMensajeErrores.TemporalId = temporalId; frmMensajeErrores.objDB = objDB; frmMensajeErrores.ShowDialog(); } } } if (senderGrid.Columns[e.ColumnIndex] is DataGridViewLinkColumn && e.RowIndex >= 0) { //TODO - Button Clicked - Execute Code Here valorUnico = senderGrid["unico", senderGrid.CurrentRow.Index].Value.ToString(); //BUSCO LA FILA SELECCIONADA POS SU UNICO MyFila = MyData.Select("Unico = " + valorUnico.ToString())[0]; entidadId = objUtil.GetAsInt("Entidad_Id", MyFila); documentoId = objUtil.GetAsString("Documento_Id", MyFila); tipoGarantiaId = objUtil.GetAsString("Tipo_Garantia_Id", MyFila).Trim().ToUpper(); parametros.Clear(); if (tipoGarantiaId == "P") { parametros.Add(new DataDB_ELR_NET.Parametro("Id", entidadId)); parametros.Add(new DataDB_ELR_NET.Parametro("IdentificadorTemp", temporalId)); parametros.Add(new DataDB_ELR_NET.Parametro("autor", nombreUsuario)); objDB.iniciarTransaccion(); resultado = objDB.EjecutarSP("SP_TEMPORAL_CLASIFICADOR_ENTIDADES", parametros); if (resultado < 0) { MostrarErrorTemporal(temporalId); objDB.cancelarTransaccion(); } else { objDB.confirmarTransaccion(); frmGPersonal.nombreUsuario = nombreUsuario; frmGPersonal.solicitudId = solicitudId; frmGPersonal.entidadId = entidadId; frmGPersonal.VALOR_ID = entidadId.ToString(); frmGPersonal.DTVariablesSYS = DTVariablesSYS; frmGPersonal.DSGlobal = DSGlobal; frmGPersonal.EnEjecusion = true; frmGPersonal.temporalID = temporalId; frmGPersonal.EMPRESA_ID = empresaID; frmGPersonal.OFICINA_ID = oficinaID; frmGPersonal.esGarantiaPersonal = true; frmGPersonal.ShowDialog(); if (frmGPersonal.lOK) { this.GetData(); } } } if (tipoGarantiaId == "V") { parametros.Add(new DataDB_ELR_NET.Parametro("Id", valorUnico)); parametros.Add(new DataDB_ELR_NET.Parametro("IdentificadorTemp", temporalId)); parametros.Add(new DataDB_ELR_NET.Parametro("autor", nombreUsuario)); objDB.iniciarTransaccion(); resultado = objDB.EjecutarSP("SP_TEMPORAL_GARANTIA_VEHICULO", parametros); if (resultado < 0) { MostrarErrorTemporal(temporalId); objDB.cancelarTransaccion(); } else { objDB.confirmarTransaccion(); frmGVehiculo.nombreUsuario = nombreUsuario; frmGVehiculo.solicitudId = solicitudId; frmGVehiculo.VALOR_ID = valorUnico; frmGVehiculo.DTVariablesSYS = DTVariablesSYS; frmGVehiculo.DSGlobal = DSGlobal; frmGVehiculo.EnEjecusion = true; frmGVehiculo.temporalID = temporalId; frmGVehiculo.EMPRESA_ID = empresaID; frmGVehiculo.OFICINA_ID = oficinaID; frmGVehiculo.ShowDialog(); if (frmGVehiculo.lOK) { RealizarBusquedaSencilla(); } } } //Buscamos el Unico Para Ubicar sobre la fila senderGrid.CurrentCell = senderGrid["btnEliminar", index]; senderGrid.CurrentCell.Selected = true; } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } finally { this.Cursor = Cursors.Default; frmGPersonal.Dispose(); frmGVehiculo.Dispose(); frmMensajeErrores.Dispose(); objDB.cancelarTransaccion(); } }