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.Marcas___Tecapro
{
    public partial class user_validate : Form
    {
        public static string user_log_into_sys;
        public static string user_pass_code;
        public static bool chk_ok;

        public user_validate()
        {
            InitializeComponent();
        }

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

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            this.Close();
          
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            int query;

            /*/VALIDA QUE LOS CAMP0S NO ESTEN VACIOS/*/
            if (textEdit1.Text == ""||textEdit2.Text == "")
            {
                GUI.CApp.ShowMessage("Debe de Ingresar el Usuario y Contraseņa, estos no pueden estar vacios", "Error - Acceso", true);
                return;
            }
            /*/FIN-EMANUEL CARVAJAL MARIN /*/

            Utils.QueryParams qp = new LLNet.Utils.QueryParams();
            qp.AddReplaceParam("Param1", textEdit1.Text);
            qp.AddReplaceParam("Param2", textEdit2.Text);
            query = Convert.ToInt32(GUI.CApp.bll.GetSingleValue("Valida_permisos_marcas", qp, "PDV"));

            if (query > 0)
            {
                user_log_into_sys = textEdit1.Text;
                user_pass_code = textEdit2.Text;
                
                chk_ok = true;
                this.Hide();
            }
            else
            {
                GUI.CApp.ShowMessage("Usuario y/o Contraseņa Incorrectos, valide e intente nuevamente", "Error en Acceso", true);
                user_log_into_sys = null;
                user_pass_code = null;
                return;

            }
        }

        private void textEdit2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                simpleButton1_Click(null, null);
            }
        }
    }
}