Exemple #1
0
        public static void RegistrarAsistenciaApi(int id = 0)
        {
            try
            {
                int empId = 0;

                if (id > 0)
                {
                    empId = id;
                }
                else if (Resultado.id != 0)
                {
                    empId = Resultado.id;
                }

                if (empId > 0)
                {
                    var coordenada = Huella.txtCoordenada.Text;
                    var terminal   = Utilidad <Empleado> .GetIp() + "::" + Utilidad <Empleado> .GetMacAddress().ToString();

                    var fecha = DateTime.Now;

                    RegistrarAsistenciaLocal(empId, fecha, 0, terminal, coordenada);
                }
                //asistencia sin enviar
                ProcesarDatosNoEnviados();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, Mensajes.Error, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #2
0
        private Empleado RegistrarHuellaApi()
        {
            if (Huella.huellaBase64 == null)
            {
                var auxImg = "TempRE.png";
                if (File.Exists(auxImg))
                {
                    File.Delete(auxImg);
                }

                pbImageFrame.Image.Save(auxImg, ImageFormat.Png);
                var bytes = File.ReadAllBytes(auxImg);
                Huella.huellaBase64 = Convert.ToBase64String(bytes);
            }

            var huella     = Convert.ToBase64String(Utilidad <Empleado> .ExtraerTemplate(Huella.huellaBase64).Template);
            var coordenada = Huella.txtCoordenada.Text;
            var terminal   = Utilidad <Empleado> .GetIp() + "::" + Utilidad <Empleado> .GetMacAddress().ToString();

            var param    = "empleadoId=" + Resultado.id + "&huella=" + huella + "&terminal=" + terminal + "&coordenadas=" + coordenada + "&clave=" + Huella.ApiKey;
            var empleado = Utilidad <Empleado> .GetJson(new Empleado(), Huella.Api + Constante.RegistrarHuellaApi + param);

            if (empleado.error)
            {
                throw new Exception(empleado.mensaje);
            }

            empleado.huella = huella;
            return(empleado);
        }
Exemple #3
0
        private string ActualizarHuellaApi(string codEmpleado, string huella)
        {
            try
            {
                var coordenada = Huella.txtCoordenada.Text;
                var terminal   = Utilidad <Empleado> .GetIp() + "::" + Utilidad <Empleado> .GetMacAddress().ToString();

                var param    = "codEmpleado=" + codEmpleado + "&huella=" + huella + "&terminal=" + terminal + "&coordenadas=" + coordenada + "&clave=" + Huella.ApiKey;
                var empleado = Utilidad <Empleado> .GetJson(new Empleado(), Huella.Api + Constante.ActualizarHuellaApi + param);

                if (empleado.error == true)
                {
                    throw new Exception(empleado.mensaje);
                }
                return(empleado.guiHuella);
            }
            catch (Exception ex) {
                throw ex;
            }
        }