Exemple #1
0
        public fa_NivelDescuento_Info GetInfo(int IdEmpresa, int IdNivel)
        {
            try
            {
                fa_NivelDescuento_Info info = new fa_NivelDescuento_Info();
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_NivelDescuento Entity = Context.fa_NivelDescuento.Where(q => q.IdEmpresa == IdEmpresa && q.IdNivel == IdNivel).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new fa_NivelDescuento_Info
                    {
                        IdEmpresa   = Entity.IdEmpresa,
                        IdNivel     = Entity.IdNivel,
                        Estado      = Entity.Estado,
                        Descripcion = Entity.Descripcion,
                        Observacion = Entity.Observacion,
                        Porcentaje  = Entity.Porcentaje
                    };
                }
                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public bool AnularDB(fa_NivelDescuento_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_NivelDescuento Entity = Context.fa_NivelDescuento.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdNivel == info.IdNivel).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Estado = false;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        public bool ModificarDB(fa_NivelDescuento_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_NivelDescuento Entity = Context.fa_NivelDescuento.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdNivel == info.IdNivel).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Descripcion = info.Descripcion;
                    Entity.Observacion = info.Observacion;
                    Entity.Porcentaje  = info.Porcentaje;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }