当前位置: 首页>>代码示例>>C#>>正文


C# Factory.Execute方法代码示例

本文整理汇总了C#中Factory.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.Execute方法的具体用法?C# Factory.Execute怎么用?C# Factory.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory的用法示例。


在下文中一共展示了Factory.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public static Response<RolePermission> Get(this RolePermission request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{

				long? totalCount=null;

				var paginador= new Paginador(httpRequest);

				var visitor = ReadExtensions.CreateExpression<RolePermission>();
				var predicate = PredicateBuilder.True<RolePermission>();

				predicate= q=>q.AuthRoleId==request.AuthRoleId;
												                
				visitor.Where(predicate).OrderBy(f=>f.Name) ;
                if(paginador.PageNumber.HasValue)
                {
					visitor.Select(r=> Sql.Count(r.Id));
					totalCount= proxy.Count(visitor);
					visitor.Select();
                    int rows= paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize;
                    visitor.Limit(paginador.PageNumber.Value*rows, rows);
                }
                                
                
				return new Response<RolePermission>(){
                	Data=proxy.Get(visitor),
                	TotalCount=totalCount
            	};
            });
  
        }
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:33,代码来源:BL.RolePermission.cs

示例2: Get

        public static InfanteInfoResponse Get(this InfanteInfo request, Factory factory, IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{

				var padres = proxy.Get<InfantePadre>(q=>q.IdInfante==request.Id);
				var acudientes =proxy.Get<InfanteAcudiente>(q=>q.IdInfante==request.Id);
				var matriculas = proxy.Get<Matricula>(
					ev=>ev.Where(q=>q.IdInfante==request.Id).OrderByDescending(q=>q.FechaInicio));

				var predicate= PredicateBuilder.False<Pension>();

				foreach( Matricula m in matriculas)
				{
					var idMatricula= m.Id;
					predicate= predicate.OrElse(q=>q.IdMatricula==idMatricula);
				}

				var pensiones = proxy.Get<Pension>(ev=> ev.Where(predicate).OrderByDescending(q=>q.Periodo));

                return new InfanteInfoResponse{
					InfantePadreList= padres,
					InfanteAcudienteList=acudientes,
					MatriculaList=matriculas,
					PensionList= pensiones
                };
            });
        }
开发者ID:aicl,项目名称:Aicl.Galapago,代码行数:27,代码来源:BL.InfanteInfo.cs

示例3: Get

        public static Response<Servicio> Get(this Servicio request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{

				long? totalCount=null;

				var paginador= new Paginador(httpRequest);
            	
                var predicate = PredicateBuilder.True<Servicio>();

                var visitor = ReadExtensions.CreateExpression<Servicio>();

				if(!request.Nombre.IsNullOrEmpty()){
					predicate = predicate.AndAlso(q=> q.Nombre.Contains(request.Nombre));
				}

				visitor.Where(predicate).OrderBy(f=>f.Nombre);
                if(paginador.PageNumber.HasValue)
                {
					visitor.Select(r=> Sql.Count(r.Id));
					totalCount= proxy.Count(visitor);
					visitor.Select();
                    int rows= paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize;
                    visitor.Limit(paginador.PageNumber.Value*rows, rows);
                }
                
				return new Response<Servicio>(){
                	Data=proxy.Get(visitor),
                	TotalCount=totalCount
            	};
            });
  
        }
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:35,代码来源:BL.Servicio.cs

示例4: Get

        public static Response<User> Get(this User request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{

				var userSession = httpRequest.GetSession();

				//if(!( userSession.HasRole(RoleNames.Admin) ||
				//   userSession.HasPermission("User.read") ))
				//	throw HttpError.Unauthorized("Usuario no autorizado para leer listado de usuarios");

				long? totalCount=null;

				var paginador= new Paginador(httpRequest);

				var visitor = ReadExtensions.CreateExpression<User>();
				var predicate = PredicateBuilder.True<User>();

				if (userSession.HasRole(RoleNames.Admin))
				{
					if(request.Id!=default(int))
					predicate= q=>q.Id==request.Id;

					if(!request.UserName.IsNullOrEmpty()) 
	                	predicate= q=>q.UserName.StartsWith(request.UserName) ;

					if(userSession.UserName!=BL.AdminUser)
						predicate=predicate.AndAlso(q=>q.UserName!=BL.AdminUser);

				}
				else
				{
					var id = int.Parse(userSession.UserAuthId);
					predicate= q=>q.Id==id;
				}
				                
				visitor.Where(predicate).OrderBy(r=>r.UserName);;
                if(paginador.PageNumber.HasValue)
                {
					visitor.Select(r=> Sql.Count(r.Id));
					totalCount= proxy.Count(visitor);
					visitor.Select();
                    int rows= paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize;
                    visitor.Limit(paginador.PageNumber.Value*rows, rows);
                }
                                
                
				return new Response<User>(){
                	Data=proxy.Get(visitor),
                	TotalCount=totalCount
            	};
            });
  
        }
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:55,代码来源:BL.User.cs

示例5: Get

		public static Response<ComprobanteEgresoRetencion> Get(this ComprobanteEgresoRetencion request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
			return factory.Execute(proxy=>
			{
				return new Response<ComprobanteEgresoRetencion>(){
                	Data=proxy.Get<ComprobanteEgresoRetencion>(q=> q.IdComprobanteEgreso ==request.IdComprobanteEgreso),   	
            	};
			});
		}
开发者ID:aicl,项目名称:Aicl.Galapago,代码行数:11,代码来源:BL.ComprobanteEgresoRetencion.cs

示例6: Post

        public static Response<IngresoItem> Post(this IngresoItem request,
                                            Factory factory,
                                            IAuthSession authSession)
        {


            request.ValidateAndThrowHttpError(Operaciones.Create);

            factory.Execute(proxy=>{

                PresupuestoItem pi= Check1(proxy,request, int.Parse(authSession.UserAuthId));

                // bloquear el Ingreso parent para evitar actualizaciones....
                using(proxy.AcquireLock(request.IdIngreso.GetLockKey<Ingreso>(), Definiciones.LockSeconds))
                {
                    Ingreso ingreso=proxy.FirstOrDefaultById<Ingreso>(request.IdIngreso);
                    ingreso.AssertExists(request.IdIngreso);
                    ingreso.ValidateAndThrowHttpError(Operaciones.Update);
                    ingreso.CheckPeriodo(proxy);
                    request.CheckCentro(proxy, ingreso.IdSucursal,int.Parse(authSession.UserAuthId));

                    CodigoDocumento cd = proxy.GetCodigoDocumento(ingreso.CodigoDocumento);
                    cd.AssertExists(ingreso.CodigoDocumento); 
                    cd.AssertEstaActivo();

                    if(request.TipoPartida==1)
                    {
                        cd.CheckDebitos(pi.Codigo);
                        ingreso.Saldo=ingreso.Saldo-request.Valor;
                    }
                    else
                    {
						cd.CheckCreditos(pi.Codigo);
                        ingreso.Valor= ingreso.Valor+request.Valor;
                        ingreso.Saldo=ingreso.Saldo+request.Valor;
                    }

                    proxy.BeginDbTransaction();
                    ingreso.ActualizarValorSaldo(proxy);
                    proxy.Create(request);
                    proxy.CommitDbTransaction();


                }
            });

            List<IngresoItem> data = new List<IngresoItem>();
            data.Add(request);
            
            return new Response<IngresoItem>(){
                Data=data
            };  
            
        }
开发者ID:aicl,项目名称:Aicl.Galapago,代码行数:54,代码来源:BL.IngresoItem.cs

示例7: Get

        public static Response<Empresa> Get(this Empresa request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{
				                
				request = proxy.GetEmpresa();
				var response =new Response<Empresa>();
				response.Data.Add(request);
				return response;
            });
  
        }
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:13,代码来源:BL.Empresa.cs

示例8: Post

        public static Response<ComprobanteIngresoItem> Post(this ComprobanteIngresoItem request,
                                            Factory factory,
                                            IAuthSession authSession)
        {
            request.ValidateAndThrowHttpError(Operaciones.Create);

            factory.Execute(proxy=>{

                // bloquear el ComprobanteIngreso parent para evitar actualizaciones....
                using(proxy.AcquireLock(request.IdComprobanteIngreso.GetLockKey<ComprobanteIngreso>(), Definiciones.LockSeconds))
                {

                    var ce = proxy.FirstOrDefaultById<ComprobanteIngreso>(request.IdComprobanteIngreso);
                    ce.AssertExists(request.IdComprobanteIngreso);
                    ce.CheckPeriodo(proxy);
                                         
                    var ingreso= proxy.FirstOrDefaultById<Ingreso>(request.IdIngreso);
                    ingreso.AssertExists(request.IdIngreso);

                    request.ValidateAndThrowHttpError(ce,ingreso,Operaciones.InsertarIngresoEnCI);

                    ce.Valor+=request.Abono;

                    proxy.BeginDbTransaction();
                    ce.ActualizarValor(proxy);
                    proxy.Create(request);
                    proxy.CommitDbTransaction();


					request.DiasCredito= ingreso.DiasCredito;
					request.Numero= ingreso.Numero;
					request.Descripcion=ingreso.Descripcion;
					request.Documento=ingreso.Descripcion;
					request.Fecha= ingreso.Fecha;
					request.IdTercero= ingreso.IdTercero;
					request.IdSucursal= ingreso.IdSucursal;
					request.Saldo=ingreso.Saldo;
					request.Valor= ingreso.Valor;
                }
            });

            var data = new List<ComprobanteIngresoItem>();
            data.Add(request);
            
            return new Response<ComprobanteIngresoItem>(){
                Data=data
            };  
            
        }
开发者ID:aicl,项目名称:Aicl.Galapago,代码行数:49,代码来源:BL.ComprobanteIngresoItem.cs

示例9: Get

        public static Response<IngresoItem> Get(this IngresoItem request,
                                            Factory factory,
                                            IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{
            
				var visitor = ReadExtensions.CreateExpression<IngresoItem>();
                 
				visitor.Where(r=>r.IdIngreso==request.IdIngreso).OrderByDescending(r=>r.TipoPartida);

				return new Response<IngresoItem>(){
	                Data= proxy.Get(visitor)
	            };
            });
        }
开发者ID:aicl,项目名称:Aicl.Galapago,代码行数:15,代码来源:BL.IngresoItem.cs

示例10: Delete

        public static Response<Empresa> Delete(this Empresa request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
			factory.Execute(proxy=>{
				proxy.DeleteEmpresa(request);
			});

			List<Empresa> data = new List<Empresa>();
			data.Add(request);
			
			return new Response<Empresa>(){
				Data=data
			};	
		}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:15,代码来源:BL.Empresa.cs

示例11: Post

        public static Response<Ciudad> Post(this Ciudad request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
			factory.Execute(proxy=>{
				proxy.Create(request);
			});

			List<Ciudad> data = new List<Ciudad>();
			data.Add(request);
			
			return new Response<Ciudad>(){
				Data=data
			};	
		}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:15,代码来源:BL.Ciudad.cs

示例12: Put

        public static Response<AuthPermission> Put(this AuthPermission request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
			factory.Execute(proxy=>{
				proxy.DeleteFromCache<AuthPermission>();
				proxy.Update(request);
			});

			List<AuthPermission> data = new List<AuthPermission>();
			data.Add(request);
			
			return new Response<AuthPermission>(){
				Data=data
			};	
		}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:16,代码来源:BL.AuthPermission.cs

示例13: Post

        public static Response<AuthRole> Post(this AuthRole request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
			factory.Execute(proxy=>{
				proxy.DeleteFromCache<AuthRole>();
				proxy.Create(request);
			});

			List<AuthRole> data = new List<AuthRole>();
			data.Add(request);
			
			return new Response<AuthRole>(){
				Data=data
			};	
		}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:16,代码来源:BL.AuthRole.cs

示例14: Post

        public static Response<Consecutivo> Post(this Consecutivo request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
			if(request.Prefijo.IsNullOrEmpty()) request.Prefijo=BL.Prefijo;
			if(request.Documento.IsNullOrEmpty()) request.Documento=BL.Cotizacion;
			factory.Execute(proxy=>{
				proxy.Create(request);
			});

			List<Consecutivo> data = new List<Consecutivo>();
			data.Add(request);
			
			return new Response<Consecutivo>(){
				Data=data
			};	
		}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:17,代码来源:BL.Consecutivo.cs

示例15: Get

        public static Response<UserRole> Get(this UserRole request,
		                                              Factory factory,
		                                              IHttpRequest httpRequest)
        {
            return factory.Execute(proxy=>{

				var userSession = httpRequest.GetSession();

				long? totalCount=null;

				var paginador= new Paginador(httpRequest);

				var visitor = ReadExtensions.CreateExpression<UserRole>();
				var predicate = PredicateBuilder.True<UserRole>();


				if(request.UserId==default(int))
					request.UserId= int.Parse(userSession.UserAuthId);
				else if(!(userSession.HasRole(RoleNames.Admin)) &&
				        request.UserId != int.Parse(userSession.UserAuthId)
				        )
				{
					throw HttpError.Unauthorized("Usuario no puede leer listado de roles de otro usuario");
				}

				predicate= q=>q.UserId==request.UserId;
												                
				visitor.Where(predicate).OrderBy(f=>f.Name);

                if(paginador.PageNumber.HasValue)
                {
					visitor.Select(r=> Sql.Count(r.Id));
					totalCount= proxy.Count(visitor);
					visitor.Select();
                    int rows= paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize;
                    visitor.Limit(paginador.PageNumber.Value*rows, rows);
                }
                                
                
				return new Response<UserRole>(){
                	Data=proxy.Get(visitor),
                	TotalCount=totalCount
            	};
            });
  
        }
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:46,代码来源:BL.UserRole.cs


注:本文中的Factory.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。