using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LLNet.Tienda.MainForms.Forms
{
    public partial class dlgSeleccionFactura : LLNet.GUI.FormBases.frmBase
    {
        public dlgSeleccionFactura()
        {
            InitializeComponent();

            GUI.CApp.TraducirForm(this);
        }

        private string factura;

        public string Factura
        {
            get { return factura; }
        }

        public override void Init(object[] pArgs)
        {
            base.Init(pArgs);
        }

        private void dlgSeleccionFactura_Load(object sender, EventArgs e)
        {
            Utils.QueryParams qp = new LLNet.Utils.QueryParams();
            qp.AddReplaceParam("RV_DOMAIN", "DOCUMENTOS POS' AND RV_DESCRIPTION = 'XRFactura");
            Utils.Helpers.Merge(GUI.CApp.bll.getTypedDataSet(dsDonadores.GetType(), dsDonadores.DOMAINS.TableName, qp), dsDonadores);
        }

        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (lbcReporte.SelectedValue != null)
            {
                factura = lbcReporte.SelectedValue.ToString();
                DialogResult = DialogResult.OK;
            }
            else
                GUI.CApp.ShowMessage("Seleccione un formato de impresión de factura", "Donaciones", true);
        }

        private void dlgSeleccionFactura_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            { 
                case Keys.Enter:
                case Keys.F12:
                    btnAceptar_Click(null, null);
                    break;
                case Keys.Escape:
                    btnCancelar.PerformClick();
                    break;
            }
        }
    }
}

