예제 #1
0
        public override System.Linq.Expressions.Expression <Func <workflow, bool> > SatisfiedBy()
        {
            Specification <workflow> spec = new TrueSpecification <workflow>();

            spec &= new DirectSpecification <workflow>(c => c.procesoID == _Id && c.orden == _Order);

            return(spec.SatisfiedBy());
        }
        /// <summary>
        /// <see cref="Microsoft.Samples.NLayerApp.Domain.Core.Specification.Specification{TEntity}"/>
        /// </summary>
        /// <returns><see cref="Microsoft.Samples.NLayerApp.Domain.Core.Specification.Specification{TEntity}"/></returns>
        public override System.Linq.Expressions.Expression <Func <Order, bool> > SatisfiedBy()
        {
            Specification <Order> spec = new TrueSpecification <Order>();

            spec &= new DirectSpecification <Order>(order => order.CustomerId == _CustomerId);

            return(spec.SatisfiedBy());
        }
예제 #3
0
        public override System.Linq.Expressions.Expression <Func <Ubicacion, bool> > SatisfiedBy()
        {
            Specification <Ubicacion> spec = new TrueSpecification <Ubicacion>();

            spec &= new DirectSpecification <Ubicacion>(c => c.AseguradoID == _AseguradoID);

            return(spec.SatisfiedBy());
        }
        public override System.Linq.Expressions.Expression <Func <CotizacionCoberturaUbicacion, bool> > SatisfiedBy()
        {
            Specification <CotizacionCoberturaUbicacion> spec = new TrueSpecification <CotizacionCoberturaUbicacion>();

            spec &= new DirectSpecification <CotizacionCoberturaUbicacion>(c => c.bk_tr_CotizacionCobertura.CotizacionID == _CotizacionID);

            return(spec.SatisfiedBy());
        }
예제 #5
0
        public override System.Linq.Expressions.Expression <Func <Asegurado, bool> > SatisfiedBy()
        {
            Specification <Asegurado> spec = new TrueSpecification <Asegurado>();

            spec &= new DirectSpecification <Asegurado>(c => c.RFC.Equals(_RFC));

            return(spec.SatisfiedBy());
        }
        public override System.Linq.Expressions.Expression <Func <Usuario, bool> > SatisfiedBy()
        {
            Specification <Usuario> spec = new TrueSpecification <Usuario>();

            spec &= new DirectSpecification <Usuario>(c => c.NombreUsuario == _UserName);

            return(spec.SatisfiedBy());
        }
        /// <summary>
        /// <see cref=" Oporie.Dominio.Core.Specification.Specification{TEntity}"/>
        /// </summary>
        /// <returns><see cref=" Oporie.Dominio.Core.Specification.Specification{TEntity}"/></returns>
        public override System.Linq.Expressions.Expression <Func <ALUMNO, bool> > SatisfiedBy()
        {
            Specification <ALUMNO> spec = new TrueSpecification <ALUMNO>();

            //Alumnos activos solamente
            spec &= new DirectSpecification <ALUMNO>(a => a.ALU_ESTADO);

            //spec de Alumno es el campo ALU_LASTNAME
            spec &= new DirectSpecification <ALUMNO>(c => c.ALU_LASTNAME != null && (c.ALU_LASTNAME.ToUpper() == _StrCriterioAlumno.ToUpper()));

            return(spec.SatisfiedBy());
        }
예제 #8
0
        /// <summary>
        /// <see cref=" Microsoft.Samples.NLayerApp.Domain.Core.Specification.Specification{TEntity}"/>
        /// </summary>
        /// <returns><see cref=" Microsoft.Samples.NLayerApp.Domain.Core.Specification.Specification{TEntity}"/></returns>
        public override System.Linq.Expressions.Expression <Func <Customer, bool> > SatisfiedBy()
        {
            Specification <Customer> spec = new TrueSpecification <Customer>();

            //only enabled customers
            spec &= new DirectSpecification <Customer>(t => t.IsEnabled);

            //customer code spec
            spec &= new DirectSpecification <Customer>(c => c.CustomerCode != null && (c.CustomerCode.ToUpper() == _CustomerCode.ToUpper()));

            return(spec.SatisfiedBy());
        }
        public void Sepcification_OfType_And_Composite_Test()
        {
            //初始化
            var inheritSpec = new DirectSpecification<InheritEntity>(be => be.SampleProperty == "Test");
            var baseSpec = new DirectSpecification<BaseEntity>(be => be.Id == 1).OfType<InheritEntity>();

            //操作
            var result = inheritSpec & baseSpec.OfType<InheritEntity>();

            //验证
            Assert.IsNotNull(inheritSpec);
            Assert.IsTrue(inheritSpec.SatisfiedBy().Compile()(
                new InheritEntity() { Id = 1, SampleProperty = "Test" }));
        }
        public void Sepcification_OfType_And_Composite_Test()
        {
            //初始化
            var inheritSpec = new DirectSpecification <InheritEntity>(be => be.SampleProperty == "Test");
            var baseSpec    = new DirectSpecification <BaseEntity>(be => be.Id == 1).OfType <InheritEntity>();

            //操作
            var result = inheritSpec & baseSpec.OfType <InheritEntity>();

            //验证
            Assert.IsNotNull(inheritSpec);
            Assert.IsTrue(inheritSpec.SatisfiedBy().Compile()(
                              new InheritEntity()
            {
                Id = 1, SampleProperty = "Test"
            }));
        }
        public override System.Linq.Expressions.Expression <Func <Cotizacion, bool> > SatisfiedBy()
        {
            int nroPol;
            Specification <Cotizacion> spec = new TrueSpecification <Cotizacion>();

            if (_Desde != null)
            {
                spec &= new DirectSpecification <Cotizacion>(c => c.VigenciaInicio >= _Desde);
            }

            if (_Hasta != null)
            {
                spec &= new DirectSpecification <Cotizacion>(c => c.VigenciaFin <= _Hasta);
            }

            if (!string.IsNullOrEmpty(_NroPol))
            {
                if (int.TryParse(_NroPol, out nroPol))
                {
                    spec &= new DirectSpecification <Cotizacion>(c => c.nroPoliza == nroPol);
                }
            }

            if (!string.IsNullOrEmpty(_RFC))
            {
                spec &= new DirectSpecification <Cotizacion>(c => c.bk_tc_Asegurado.RFC.Equals(_RFC));
            }

            if (!string.IsNullOrEmpty(_Nombre))
            {
                spec &= new DirectSpecification <Cotizacion>(c => c.bk_tc_Asegurado.Nombres.Contains(_Nombre) ||
                                                             c.bk_tc_Asegurado.Apellido1.Contains(_Nombre) || c.bk_tc_Asegurado.Apellido2.Contains(_Nombre) ||
                                                             c.bk_tc_Asegurado.RazonSocial.Contains(_Nombre));
            }

            spec &= new DirectSpecification <Cotizacion>(c => c.usuarioid == _Usuario);

            return(spec.SatisfiedBy());
        }