public List <Empleado> GetEmpleadosWithTemplates() { List <Empleado> empleados = new List <Empleado>(); dataEmpleado = new DataEmpleado(); try { if (VerificarSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); empleados = dataEmpleadoSaftime.Empleados(); } else { empleados = dataEmpleado.Empleados(); } empleados = dataEmpleado.SetHuellas(empleados); } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error desconocido al consultar los empleados", "Fatal", ex); } return(empleados); }
public void BajaEmpleado(List <Empleado> empleados) { dataTemplates = new DataTemplates(); try { if (VerificarSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); dataEmpleadoSaftime.Eliminar(empleados); } else { dataEmpleado = new DataEmpleado(); dataEmpleado.Eliminar(empleados); } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error desconocido durante la baja.", "Fatal", ex); } }
public Form1() { InitializeComponent(); tableEmpleados = new DataTable(); tableEmpleados.Columns.Add("Id"); tableEmpleados.Columns.Add("Nombre"); tableEmpleados.Columns.Add("Apellido"); tableVisitas = new DataTable(); tableVisitas.Columns.Add("Id"); tableVisitas.Columns.Add("NombreVisita"); tableVisitas.Columns.Add("Vendor"); tableVisitas.Columns.Add("Fecha"); tableVisitas.Columns.Add("Descripcion"); tableVisitas.Columns.Add("Empleado"); tablecbxEmpleados = new DataTable(); tablecbxEmpleados.Columns.Add("Id"); tablecbxEmpleados.Columns.Add("Nombre"); EmpleadosManager = new DataEmpleado(); VisitasManager = new DataVisita(); LoadEmpleados(); LoadcbxEmpleados(); LoadVisita(); }
public int AgregarHuella(Empleado emp, Reloj reloj) { /*Recibo todos los legajos seleccionados en el dgv junto con el reloj. * Por cada legajo obtengo una list con todas las huellas que tenga en el equipo. * Por cada legajo, consulto el empid. --> El legajo existe SI O SI en la BD ya que anteriormente descargué y guardé los datos del equipo. * Por cada huella guardo el empid, template, fingerindex, largo de la huella. * */ dataTemplates = new DataTemplates(); int total = 0; try { reloj.LeerTodasLasHuellas(); List <Huella> huellas = new List <Huella>(); huellas = reloj.ObtenerHuella(emp); total = huellas.Count; foreach (Huella h in huellas) { if (IsSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); h.Empleado = dataEmpleadoSaftime.GetDataByLegajo(h.Empleado); } else { dataEmpleado = new DataEmpleado(); h.Empleado = dataEmpleado.GetDataByLegajo(h.Empleado); } if (!dataTemplates.Existe(h)) { dataTemplates.InsertarHuella(h); } else { dataTemplates.ActualizarHuella(h); } } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error no controlado durante la actualización de huellas", "Fatal", ex); } return(total); }
public List <string> AgregarRegis(List <Fichada> fichadas, FormatoExport formato) { Writer writer = new Writer(formato); List <string> desconocidos = new List <string>(); DataEmpleado dataEmpleado = new DataEmpleado(); try { writer.EscribirRegistros(fichadas); foreach (Fichada f in fichadas) { // VALIDAR SI LO TENGO QUE BUSCAR EN SAFTIME O EN SAFCOM // if (VerificarSaftime()) { DataEmpleadoSaftime dataEmpleadoSaftime = new DataEmpleadoSaftime(); f.Empleado = dataEmpleadoSaftime.GetIdByLegajo(f.Empleado); } else { f.Empleado = dataEmpleado.GetIdByLegajo(f.Empleado); } // SI NO LO ENCONTRÓ AGREGO EL LEGAJO A DESCONOCIDOS // if (f.Empleado.Id < 1) { desconocidos.Add(f.Empleado.Legajo); continue; } dataEmpleado.InsertarRegis(f); } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error desconocido durante la descarga de registros.", "Fatal", ex); } return(desconocidos); }
public void ActualizarInfo(Empleado emp) { try { if (IsSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); emp = dataEmpleadoSaftime.GetIdByLegajo(emp); if (emp.Id > 0) { dataEmpleadoSaftime.Actualizar(emp); } else { dataEmpleadoSaftime.Agregar(emp); } } else { dataEmpleado = new DataEmpleado(); emp = dataEmpleado.GetIdByLegajo(emp); if (emp.Id > 0) { dataEmpleado.Actualizar(emp); } else { dataEmpleado.Agregar(emp); } } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error no controlado durante la actualización del empleado.", "Fatal", ex); } }
public void ActualizarEmpleado(Empleado emp) { try { if (VerificarSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); dataEmpleadoSaftime.Actualizar(emp); } else { dataEmpleado = new DataEmpleado(); dataEmpleado.Actualizar(emp); } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error desconocido durante la actualización del empleado.", "Fatal", ex); } }
public void AgregarEmpleado(Empleado emp) { try { if (VerificarSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); dataEmpleadoSaftime.Agregar(emp); } else { dataEmpleado = new DataEmpleado(); dataEmpleado.Agregar(emp); } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error desconocido al intentar agregar el empleado", "Fatal", ex); } }