public static void ProcesarDatosNoEnviadosAux() { List <Empleado> RegSinEnviar = ObtenerResgistrosSinEnviar(); try { if (RegSinEnviar.Count > 0) { foreach (Empleado emp in RegSinEnviar) { var param = "empleadoId=" + emp.idEmpleado + "&terminal=" + emp.terminal + "&coordenadas=" + emp.coordenadas + "&fecha=" + emp.fecha + "&clave=" + Huella.ApiKey; string Url = Huella.Api + Constante.RegAsistenciaApi + param; Empleado empleado = Utilidad <Empleado> .GetJson(new Empleado(), Url); if (empleado.resultado) { ActualizarRegistroLocalEnviado(int.Parse(emp.ids)); } } } } catch (Exception ex) { throw ex; } }
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); }
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; } }
private void ConsultarApi() { try { Resultado = Utilidad <Empleado> .GetJson(new Empleado(), Huella.Api + Constante.ConsultarApi + txtCodEmpleado.Text + "&clave=" + Huella.ApiKey); if (Resultado != null) { txtNombres.Text = Resultado.nombres; txtDoc.Text = Resultado.tipoDoc; txtNroDoc.Text = Resultado.nroDoc; txtCodEmp.Text = Resultado.codigo; if (Resultado.huella != null) { /*string dummyData = Resultado.huella.Trim().Replace(" ", "+"); * if (dummyData.Length % 4 > 0) * dummyData = dummyData.PadRight(dummyData.Length + 4 - dummyData.Length % 4, '='); * byte[] huellaByte = Convert.FromBase64String(dummyData);*/ Resultado.huellaByte = new byte[1024];//huellaByte; pbImageFrame.Image = Image.FromFile(pathBienImg); btnRegistrar.Enabled = true; btnEliminarHuella.Visible = true; } else { pbImageFrame.Image = Image.FromFile(pathMalImg); btnRegistrar.Enabled = false; btnEliminarHuella.Visible = false; } } else { Resultado = null; MessageBox.Show(Mensajes.CodigoEmpleadoNoEncontrado, Mensajes.RegistroNoEncontrado, MessageBoxButtons.OK, MessageBoxIcon.Information); } }catch (Exception ex) { throw ex; } }