public ro_EmpleadoAnticipoBeneficio_Info GetInfo(int IdEmpresa, decimal IdAnticipo)
        {
            try
            {
                ro_EmpleadoAnticipoBeneficio_Info info = new ro_EmpleadoAnticipoBeneficio_Info();

                using (Entities_rrhh db = new Entities_rrhh())
                {
                    var entity = db.ro_EmpleadoAnticipoBeneficio.Where(q => q.IdEmpresa == IdEmpresa && q.IdAnticipo == IdAnticipo).FirstOrDefault();
                    if (entity == null)
                    {
                        return(null);
                    }

                    info = new ro_EmpleadoAnticipoBeneficio_Info
                    {
                        IdEmpresa  = entity.IdEmpresa,
                        IdAnticipo = entity.IdAnticipo,
                        IdEmpleado = entity.IdEmpleado,
                        FechaDesde = entity.FechaDesde,
                        FechaHasta = entity.FechaHasta,
                        IdRubro    = entity.IdRubro,
                        Valor      = entity.Valor
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public bool AnularDB(ro_EmpleadoAnticipoBeneficio_Info info)
        {
            try
            {
                using (Entities_rrhh db = new Entities_rrhh())
                {
                    var entity = db.ro_EmpleadoAnticipoBeneficio.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdAnticipo == info.IdAnticipo).FirstOrDefault();
                    if (entity == null)
                    {
                        return(false);
                    }

                    entity.Estado             = false;
                    entity.IdUsuarioAnulacion = info.IdUsuarioCreacion;
                    entity.FechaAnulacion     = DateTime.Now;
                    entity.MotivoAnulacion    = info.MotivoAnulacion;

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public bool GuardarDB(ro_EmpleadoAnticipoBeneficio_Info info)
 {
     try
     {
         using (Entities_rrhh db = new Entities_rrhh())
         {
             db.ro_EmpleadoAnticipoBeneficio.Add(new ro_EmpleadoAnticipoBeneficio
             {
                 IdEmpresa         = info.IdEmpresa,
                 IdAnticipo        = info.IdAnticipo = GetId(info.IdEmpresa),
                 IdEmpleado        = info.IdEmpleado,
                 FechaDesde        = info.FechaDesde,
                 FechaHasta        = info.FechaHasta,
                 IdRubro           = info.IdRubro,
                 Valor             = info.Valor,
                 IdUsuarioCreacion = info.IdUsuarioCreacion,
                 FechaCreacion     = DateTime.Now,
                 Estado            = true
             });
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public bool ModificarDB(ro_EmpleadoAnticipoBeneficio_Info info)
        {
            try
            {
                using (Entities_rrhh db = new Entities_rrhh())
                {
                    var entity = db.ro_EmpleadoAnticipoBeneficio.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdAnticipo == info.IdAnticipo).FirstOrDefault();
                    if (entity == null)
                    {
                        return(false);
                    }

                    entity.IdEmpleado            = info.IdEmpleado;
                    entity.Valor                 = info.Valor;
                    entity.FechaDesde            = info.FechaDesde;
                    entity.FechaHasta            = info.FechaHasta;
                    entity.IdUsuarioModificacion = info.IdUsuarioCreacion;
                    entity.FechaModificacion     = DateTime.Now;

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
 public bool AnularDB(ro_EmpleadoAnticipoBeneficio_Info info)
 {
     try
     {
         return(odata.AnularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }