Esempio n. 1
0
        public override void CheckEntity(IRoleBased entity, EntityEntry <IRoleBased> entityEntry, IUnitOfWorkCachedSearching unitOfWork)
        {
            var locking = entity as Locking;

            if (locking != null)
            {
                if (locking.TableName.ToUpper() == typeof(ServiceChannelVersioned).Name.ToUpper())
                {
                    roleChecker.CheckEntity(GetEntity <ServiceChannelVersioned>(locking.LockedEntityId.Value, unitOfWork), null, unitOfWork);
                }
                else if (locking.TableName.ToUpper() == typeof(ServiceVersioned).Name.ToUpper())
                {
                    roleChecker.CheckEntity(GetEntity <ServiceVersioned>(locking.LockedEntityId.Value, unitOfWork, q => q.Include(i => i.OrganizationServices)), null, unitOfWork);
                }
                else if (locking.TableName.ToUpper() == typeof(OrganizationVersioned).Name.ToUpper())
                {
                    roleChecker.CheckEntity(GetEntity <OrganizationVersioned>(locking.LockedEntityId.Value, unitOfWork), null, unitOfWork);
                }
            }
        }
Esempio n. 2
0
        public override void CheckEntity(IRoleBased entity, EntityEntry <IRoleBased> entityEntry, IUnitOfWorkCachedSearching unitOfWork)
        {
            var serviceChannel = entity as ServiceChannel;

            if (serviceChannel != null)
            {
                var serviceChannelVersioned = versioningManager.GetNotModifiedVersion(serviceChannel.Versions);

                if (serviceChannelVersioned != null)
                {
                    roleChecker.CheckEntity(GetEntity <ServiceChannelVersioned>(serviceChannelVersioned.Id, unitOfWork), null, unitOfWork);
                }
            }
        }
Esempio n. 3
0
        public override void CheckEntity(IRoleBased entity, EntityEntry <IRoleBased> entityEntry, IUnitOfWorkCachedSearching unitOfWork)
        {
            var connection = entity as GeneralDescriptionServiceChannel;

            if (connection != null)
            {
                //roleChecker.CheckEntity(GetEntity<ServiceChannel>(connection.ServiceChannelId, unitOfWork, q => q.Include(j => j.Versions)), null, unitOfWork); PTV-1675
                //roleChecker.CheckEntity(GetEntity<ServiceVersioned>(connection.ServiceId, unitOfWork), null, unitOfWork);
                if (connection.StatutoryServiceGeneralDescription != null)
                {
                    roleChecker.CheckEntity(GetEntity <StatutoryServiceGeneralDescriptionVersioned>(connection.StatutoryServiceGeneralDescriptionId, unitOfWork), null, unitOfWork);
                }
            }
        }
Esempio n. 4
0
 private void CheckRoles(SaveMode saveMode, DbContext writableContext)
 {
     if (saveMode == SaveMode.Normal)
     {
         var roleBasedEntity =
             writableContext.ChangeTracker.Entries <IRoleBased>()
             .Where(x => x.State == EntityState.Added || x.State == EntityState.Modified)
             .ToList();
         foreach (var updatedEntityEntry in roleBasedEntity)
         {
             roleChecker.CheckEntity(updatedEntityEntry.Entity, updatedEntityEntry, this);
         }
     }
 }
Esempio n. 5
0
        public override void CheckEntity(IRoleBased entity, EntityEntry <IRoleBased> entityEntry, IUnitOfWorkCachedSearching unitOfWork)
        {
            var service = entity as Service;

            if (service == null)
            {
                return;
            }

            var serviceVersioned = GetServiceVersioned(service, unitOfWork);

            if (serviceVersioned != null)
            {
                roleChecker.CheckEntity(serviceVersioned, null, unitOfWork);
            }
        }