Adxstudio.Xrm.Events.EventDataAdapter.IsActive(Microsoft.Xrm.Sdk.Entity)

Here are the examples of the csharp api class Adxstudio.Xrm.Events.EventDataAdapter.IsActive(Microsoft.Xrm.Sdk.Entity) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: xRM-Portals-Community-Edition
Source File: EventDataAdapter.cs
protected virtual IEvent Select(Predicate<Entity> match)
		{
			var serviceContext = Dependencies.GetServiceContext();
			var website = Dependencies.GetWebsite();

			var publishingStateAccessProvider = new PublishingStateAccessProvider(Dependencies.GetRequestContext().HttpContext);

			// Bulk-load all ad entities into cache.
			var allEntities = serviceContext.CreateQuery("adx_event")
				.Where(e => e.GetAttributeValue<EntityReference>("adx_websiteid") == website)
				.ToArray();

			var entity = allEntities.FirstOrDefault(e =>
				match(e)
				&& IsActive(e)
				&& publishingStateAccessProvider.TryAssert(serviceContext, e));

			if (entity == null)
			{
				return null;
			}

			var securityProvider = Dependencies.GetSecurityProvider();

			if (!securityProvider.TryAssert(serviceContext, entity, CrmEntityRight.Read))
			{
                ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Forum={0}: Not Found", entity.Id));

				return null;
			}

			var myevent = new Event(entity);

			return myevent;
		}