Пример #1
0
 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);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
 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);
     }
 }
Пример #6
0
 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);
     }
 }
Пример #7
0
 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);
     }
 }