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

namespace LLNet.Tienda.MainForms.Forms
{
    public partial class FrmOpcionesTrans : Form
    {
        public string Opcion = "";

        public FrmOpcionesTrans()
        {
            InitializeComponent();

            string result = Helpers.Nvl(CApp.GetParam("HBP"), "").ToString();
            if (result == "1")
                sbtnPosware.Enabled = true;
            else
                sbtnPosware.Enabled = false;
        }

        #region btnAceptar_Click
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if ((this.rbtnCierreTrans.Checked || this.rbtnRepTrans.Checked || this.rbtnRevTrans.Checked ) == false) // || this.rbtnEcho.Checked) == false)
                CApp.ShowMessage("Seleccione una opción", "Cobros y Facturación", true);
            else
            {
                if (this.rbtnRepTrans.Checked)
                    this.Opcion = "R";
                else if (this.rbtnCierreTrans.Checked)
                    this.Opcion = "C";
                else if (this.rbtnRevTrans.Checked)
                    this.Opcion = "Rv";
                //else if (this.rbtnEcho.Checked)
                //    this.Opcion = "E";

                DialogResult = DialogResult.Cancel;
            }
        }
        #endregion

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

        #region FrmOpcionesTrans_KeyDown
        private void FrmOpcionesTrans_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.F11:
                    if(sbtnPosware.Enabled)
                        sbtnPosware_Click(null, null);
                    break;
                case Keys.F12:
                    btnAceptar_Click(null, null);
                    break;
                case Keys.Escape:
                    btnSalir_Click(null, null);
                    break;
            }
        }
        #endregion

        #region sbtnPosware_Click
        private void sbtnPosware_Click(object sender, EventArgs e)
        {
            try
            {
                //System.Diagnostics.Process.Start(@"C:\POSWareRMS\POSWareVPOS.exe");
                System.Diagnostics.Process.Start(@"C:\POSWareRMS\POSWareVPOS.exe");
            }
            catch (Exception ex)
            {
                CApp.ShowMessage(ex.Message, "Cierre Jornada", true);
            }
        }
        #endregion
    }
}