示例#1
0
        private void btn_aceptar_Click(object sender, EventArgs e)
        {
            ClaseMultiusos cm = new ClaseMultiusos();

            try
            {
                cm.EliminarDatos("tbl_cliente_has_tbl_cuenta", "FK_id_Cuenta", txt_CodigoACambiar.Text);
                cm.ModificarDatos("tbl_cuenta", "id_cuenta=" + txtIdCuenta.Text + ", numero_de_cuenta=" + txtNumeroCuenta.Text + ", fecha_creacion='" + DtpFechaCreacion.Value.ToString("yyyy-MM-dd") + "', FK_id_tipo_cuenta=" + txt_TipoCuenta.Text + ", FK_id_empleado=" + txt_Empleado.Text + ", FK_id_agencia=" + txt_Agencia.Text + ", FK_id_moneda=" + txt_Moneda.Text, "id_cuenta", txt_CodigoACambiar.Text);
                if (banderaTipoInsertCuenta == 0)
                {
                    foreach (DataGridViewRow row in dtg_Organizacion.Rows)
                    {
                        cm.InsertarDatosAplicaciones("tbl_cliente_has_tbl_cuenta", (Convert.ToString(row.Cells[0].Value)) + "," + txtIdCuenta.Text);
                    }
                }
                else if (banderaTipoInsertCuenta == 1)
                {
                    cm.InsertarDatosAplicaciones("tbl_cliente_has_tbl_cuenta", txt_CodCliente.Text + "," + txtIdCuenta.Text);
                }
                limpiar();
                regresarAEstadoInicial();
                MessageBox.Show("Datos Modificados Exitosamente");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void dtg_Clientes_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string         codigo = dtg_Clientes.Rows[e.RowIndex].Cells[0].Value.ToString();
            ClaseMultiusos cm     = new ClaseMultiusos();

            cm.EliminarDatos("tbl_cliente_has_tbl_organizacion_clientes", "FK_id_Cliente", codigo + " AND FK_id_Organizacion = " + txt_org.Text);
            cargarDTG();
        }