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 frmArqueoJornada : LLNet.GUI.FormBases.frmBase
    {
        private decimal Jornada;
        private decimal TipoPago;

        public frmArqueoJornada()
        {
            InitializeComponent();

            GUI.CApp.TraducirForm(this);
        }

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

            if (pArgs != null)
            {
                Jornada = (decimal)pArgs[0];
                TipoPago = (decimal)pArgs[1];
            }

            Utils.QueryParams qp = new LLNet.Utils.QueryParams();
            qp.AddReplaceParam("RV_DOMAIN", "SUBTIPO PAGO");
            Utils.Helpers.Merge(GUI.CApp.bll.getTypedDataSet(dsGeneral1.GetType(), dsGeneral1.CG_REF_CODES.TableName, qp), dsGeneral1);

            qp.Clear();
            qp.AddReplaceParam("JORNADA",Jornada.ToString());
            qp.AddReplaceParam("TIPO_PAGO", TipoPago.ToString());
            GUI.CApp.bll.ExecuteSql("AgregarSubtiposPago",qp, "PDV");
            Utils.Helpers.Merge(GUI.CApp.bll.getTypedDataSet(dsPDV1.GetType(), dsPDV1.WMS_ARQUEO_JORNADAS.TableName, qp), dsPDV1);

        }

        private void btnAceptar_Click(object sender, EventArgs e)
        {
            gridView1.PostEditor();
            gridView1.UpdateCurrentRow();
            GUI.CApp.bll.updateDataSet(dsPDV1, dsPDV1.WMS_ARQUEO_JORNADAS.TableName);
            DialogResult = DialogResult.OK;
        }

        private void btnSalir_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

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

        private void gridControl1_Click(object sender, EventArgs e)
        {
        }
    }
}