using Generator_Class_BD.Clases.Consultas;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Generator_Class_BD
{
    public partial class FrmVisorConsulta : Form
    {
        private FormSelector form { get; set; }
        private int indiceModificar { get; set; }

        public FrmVisorConsulta(FormSelector form, int indiceModificar)
        {
            InitializeComponent();
            this.form = form;
            this.indiceModificar = indiceModificar;
            txtScript.Text = form.listaConsultas[indiceModificar].ScriptLINQ;
        }

        private void btnSalir_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnCopiar_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
            Clipboard.SetText(txtScript.Text);
            txtScript.SelectAll();
            txtScript.Select();
            lblInformacion.Text = "Copiado.";
        }

        private void txtScript_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar.Equals(Keys.Tab))
            {
                txtScript.AppendText(@"\t");
            }
        }

        private void btnGuardar_Click(object sender, EventArgs e)
        {
            form.listaConsultas[indiceModificar].ScriptLINQ = txtScript.Text;
            lblInformacion.Text = "Guardado.";
        }
    }
}
