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 dlgDatosFactura : LLNet.GUI.FormBases.frmBase
    {
        public dlgDatosFactura()
        {
            InitializeComponent();

            GUI.CApp.TraducirForm(this);
        }

        private string serie;
        private string factura;

        public string Serie
        {
            get { return serie; }
        }

        public string Factura
        {
            get { return factura; }
        }

        public override void Init(object[] pArgs)
        {
            base.Init(pArgs);
            serie = Utils.Helpers.Nvl(pArgs[0], string.Empty).ToString();
            factura = Utils.Helpers.Nvl(pArgs[1], string.Empty).ToString();
            datosFactura.rowSerie.Properties.Value = serie;
            datosFactura.rowFactura.Properties.Value = factura;
            
        }

        private void dlgDatosFactura_Load(object sender, EventArgs e)
        {
            datosFactura.rowEmision.Visible = false;
        }

        private void btnAceptar_Click(object sender, EventArgs e)
        {
            datosFactura.Vgc.PostEditor();
            datosFactura.Vgc.UpdateFocusedRecord();
            datosFactura.Vgc.FocusFirst();
            serie = Utils.Helpers.Nvl(datosFactura.rowSerie.Properties.Value,string.Empty).ToString();
            factura = Utils.Helpers.Nvl(datosFactura.rowFactura.Properties.Value,string.Empty).ToString();
            DialogResult = DialogResult.OK;
        }

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

