Example #1
0
 public void command(CharacterCommands command, params object[] args)
 {
     switch(command)
     {
         case CharacterCommands.SetEntityQuery:
             eq = (IEntityQuery)args[0];
             return;
         case CharacterCommands.Face:
             System.Console.WriteLine("face");
             state = 0;
             d = (Directions)args[0];
             return;
         case CharacterCommands.Walk:
             System.Console.WriteLine("walk");
             state = 1;
             if(d == (Directions)args[0]) step = step==0?1:0;
             else step = 0;
             d = (Directions)args[0];
             counter = 0;
             break;
         case CharacterCommands.Stop:
             System.Console.WriteLine("stop");
             state = 0;
             return;
         case CharacterCommands.Step:
             System.Console.WriteLine("step");
             state = 2;
             if(d == (Directions)args[0]) step = (step+1)&1;
             else step = 0;
             d = (Directions)args[0];
             counter = 0;
             return;
     }
 }
Example #2
0
 public XMLRepository(
     IEntityQuery entityQuery,
     IVETSEntityManagerView entityManagerView,
     IEntityCreate entityCreate,
     ITestExecution testExecution,
     ITestStatus testStatus,
     ITestEvents testEvents,
     ISystemLogManager logger,
     IReportService resportService,
     IApplication application,
     IVETSEntityManagerViewModelView entityManagerViewModelView,
     VTS vts
     )
 {
     _entityQuery       = entityQuery;
     _entityManagerView = entityManagerView;
     _entityCreate      = entityCreate;
     _testExecution     = testExecution;
     _testStatus        = testStatus;
     _testEvents        = testEvents;
     _logger            = logger;
     _resportService    = resportService;
     _vts         = vts;
     _application = application;
     _entityManagerViewModelView = entityManagerViewModelView;
 }
Example #3
0
 public NewsListModel(
     IEntityQuery query,
     IEntityBasedModelLoader <NewsModel, DomainModel.News> modelLoader)
 {
     _query       = query;
     _modelLoader = modelLoader;
 }
Example #4
0
 public LabScheduleListModel(
     IEntityQuery query,
     IEntityBasedModelLoader <LabScheduleModel, AbstractLabSchedule> modelLoader)
 {
     _query       = query;
     _modelLoader = modelLoader;
 }
Example #5
0
 public ResultWithTaskInfoModelLoader(IEntityQuery query,
                                      IEntityBasedModelLoader <TaskResultModel, TaskResult> modelLoader,
                                      IEntityBasedModelLoader <StudentActionModel, StudentAction> modelLoader_StudentAction,
                                      IEntityBasedModelLoader <GroupModel, Group> modelLoader_Group) : base(query)
 {
     _modelLoader = modelLoader;
     _modelLoader_StudentAction = modelLoader_StudentAction;
     _modelLoader_Group         = modelLoader_Group;
 }
Example #6
0
 /// <summary> Контроллер учётных записей </summary>
 public AccountController(
     IMembershipEngine membershipEngine,
     IAuthenticationSavingService authSavingService,
     IEntityQuery query)
 {
     _membershipEngine  = membershipEngine;
     _authSavingService = authSavingService;
     _query             = query;
 }
Example #7
0
 protected override Action <Group> GetEntityInitializer(GroupModel model, IEntityQuery query)
 {
     return(g =>
     {
         g.FirstYear = model.FirstYear;
         g.Name = model.Name;
         g.IsOpen = model.IsOpen;
     });
 }
 public TaskVariantPreviewModelLoader(
     IAuthenticationSavingService authService,
     IInitParamsProvider initParamsProvider,
     IEntityQuery entityQuery)
 {
     _authService        = authService;
     _initParamsProvider = initParamsProvider;
     _entityQuery        = entityQuery;
 }
Example #9
0
 /// <summary> Модель списка демонстрационных лабораторных работ </summary>
 protected AvailableLabListModel(IEntityQuery query,
                                 IEntityBasedModelLoader <TAvalilableLab, AbstractLabSchedule> modelLoader,
                                 ISystemDateService dateService,
                                 IGraphLabsPrincipal currentUser)
 {
     _query       = query;
     _modelLoader = modelLoader;
     _dateService = dateService;
     _currentUser = currentUser;
 }
        public static async Task <BudgetClass> FindDuplicateByNameAsync(this IEntityQuery <BudgetClass> repository, BudgetClass entity)
        {
            IQueryable <BudgetClass> query = repository.Query(bc => bc.Name == entity.Name.Trim());

            if (entity.Id != 0)
            {
                query = query.Where(bc => bc.Id != entity.Id);
            }

            return(await query.FirstOrDefaultAsync());
        }
Example #11
0
        public static TEntity Get <TEntity>(this IEntityQuery query, object keyValue)
            where TEntity : AbstractEntity
        {
            var entity = query.Find <TEntity>(keyValue);

            if (entity == null)
            {
                throw new EntityNotFoundException(typeof(TEntity), new [] { keyValue });
            }

            return(entity);
        }
Example #12
0
        private Session GetSessionWithChecks(IEntityQuery query, Guid sessionGuid)
        {
            var session = query.Get <Session>(sessionGuid);

            //TODO +проверка контрольной суммы и тп - всё надо куда-то в Security вытащить
            if (session.IP != HttpContext.Current.Request.UserHostAddress)
            {
                throw new EntityNotFoundException(typeof(Session), new object[] { sessionGuid });
            }

            return(session);
        }
Example #13
0
        internal SimpleSession(ISQLExecutor exe, IEntityManager mgr, IEntityQuery qry, INativeSQL native)
        {
            exe.ThrowIfNullArgument(nameof(exe));
            mgr.ThrowIfNullArgument(nameof(mgr));
            qry.ThrowIfNullArgument(nameof(qry));
            native.ThrowIfNullArgument(nameof(native));

            _exe    = exe;
            _mgr    = mgr;
            _qry    = qry;
            _native = native;
        }
Example #14
0
        /// <summary>
        /// An example of a method to retrieve a collection of entities.
        /// </summary>
        /// <param name="orderByPropertyName"></param>
        /// <returns>List of customers</returns>
        public Task <IEnumerable <Customer> > GetCustomersAsync(string orderByPropertyName)
        {
            IEntityQuery <Customer> query = Manager.Customers;

            if (orderByPropertyName != null)
            {
                var selector = new SortSelector(typeof(Customer), orderByPropertyName);
                query = query.OrderBySelector(selector);
            }

            return(query.ExecuteAsync());
        }
Example #15
0
        public HomeViewCommandViewModel(IEntityQuery entityQuery, IImageManager imageManager, [Import("SOC", typeof(Program))] Program program)
        {
            DisplayName = Properties.Resources.DisplayName;
            DisplayInfo = new ExplorerDisplayInfo
            {
                Description     = Properties.Resources.DisplayName,
                Image16         = "/STARS.Applications.VETS.Plugins.SOC;component/Images/color_image_16.png",
                ExplorerImage16 = "/STARS.Applications.VETS.SOC.Button;component/Images/white_image_16.png"
            };

            _entityQuery = entityQuery;
            Command      = new RelayCommand(x => DebugSOCAnalysis());
        }
Example #16
0
 public override void Initialize()
 {
     base.Initialize();
     Contents = ContainerManagerComponent.Ensure <Container>($"{typeof(EntityStorageComponent).FullName}{Owner.Uid.ToString()}", Owner);
     if (!Owner.TryGetComponent(out StorageComponent))
     {
         StorageComponent = Owner.AddComponent <ServerStorageComponent>();
         // TODO: This is a terrible hack.
         // Components should not need to be manually initialized in Initialize().
         StorageComponent.Initialize();
     }
     entityQuery = new IntersectingEntityQuery(Owner);
 }
Example #17
0
        private Session FindSession(IEntityQuery query, string email, Guid sessionGuid, string clientIp)
        {
            var session = query
                          .OfEntities <Session>()
                          .Where(s => s.Guid == sessionGuid)
                          .Include(s => s.User)
                          .SingleOrDefault();

            if (session != null && SessionIsValid(session, email, clientIp))
            {
                return(session);
            }

            return(null);
        }
Example #18
0
        public HomeViewModel(IDialogService dialogService, IImageManager imageManager, IShellViewModel shellViewModel, IEntityQuery entityQuery, IVETSEntityManagerView entityManager, ISystemLogManager logger, ShiftTableCalculator shiftTableCalculator)
        {
            _shellViewModel                = shellViewModel;
            _entityQuery                   = entityQuery;
            _entityManager                 = entityManager;
            SystemLogService.Logger        = logger;
            SystemLogService.DialogService = dialogService;

            CalculateShiftTableCommand = new CalculateShiftTableCommand(this, imageManager, shiftTableCalculator);

            var imagePathPattern = "/STARS.Applications.VETS.Plugins.ShiftTableCalculator;component/Images/{0}.png";

            DisplayInfo = new ExplorerDisplayInfo
            {
                Description     = Resources.DisplayName,
                Image16         = string.Format(imagePathPattern, "color_image_16"),
                ExplorerImage16 = string.Format(imagePathPattern, "white_image_16"),
            };
            DisplayName = Resources.DisplayName;
        }
        public UpdateSystemStateTestStart
        (
            IStarsApplication starsApplication,
            ILocalResourceSupport localResourceSupport,
            ITestStatus testStatus,
            IEntityQuery entityQuery,
            IVETSEntityManagerView entityManagerView,
            IDialogService dialogService,
            ISystemLogManager systemLogManager

        )
        {
            _starsApplication     = starsApplication;
            _localResourceSupport = localResourceSupport;
            _testStatus           = testStatus;
            _entityQuery          = entityQuery;
            _entityManagerView    = entityManagerView;
            _dialogService        = dialogService;
            _systemLogManager     = systemLogManager;
        }
Example #20
0
 public MEF
 (
     ISystemLogManager logger,
     IApplication application,
     IEntityQuery entityQuery,
     IEntityCreate entityCreate,
     ILiveResource liveResources,
     IProvideValues provideValues,
     IDialogService dialogService,
     IStarsApplication starsApplication,
     IVETSEntityManagerView entityManagerView
 )
 {
     Logger            = logger;
     Application       = application;
     EntityQuery       = entityQuery;
     EntityCreate      = entityCreate;
     LiveResources     = liveResources;
     ProvideValues     = provideValues;
     DialogService     = dialogService;
     StarsApplication  = starsApplication;
     EntityManagerView = entityManagerView;
 }
Example #21
0
        /// <summary>
        /// Match
        ///
        /// Allows us to fetch entities with a defined SET of components
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public bool Match(IEntityQuery query)
        {
            // Empty queries always result in a match - equivalent to SELECT * FROM ENTITIES
            if (!(query.Exclusionset.Any() || query.OneSet.Any() || query.AllSet.Any()))
            {
                return(true);
            }

            //If there is an EXCLUDE set, and the entity contains any component types in that set, or subtypes of them, the entity is excluded.
            bool matched = !(query.Exclusionset.Any() && query.Exclusionset.Any(t => ComponentTypes.Any(t.IsAssignableFrom)));

            //If there are no matching exclusions, and the entity matches the ALL set, the entity is included
            if (matched && (query.AllSet.Any() && query.AllSet.Any(t => !ComponentTypes.Any(t.IsAssignableFrom))))
            {
                matched = false;
            }
            //If the entity matches so far, and it matches the ONE set, it matches.
            if (matched && (query.OneSet.Any() && query.OneSet.Any(t => ComponentTypes.Any(t.IsAssignableFrom))))
            {
                matched = false;
            }
            return(matched);
        }
 public static async Task <TEntity> FirstOrDefaultAsync <TEntity>(
     this IEntityQuery <TEntity> repository,
     Expression <Func <TEntity, bool> > where) where TEntity : class
 {
     return(await repository.Query(where).FirstOrDefaultAsync());
 }
 /// <summary>
 /// Load data, passing the source query.
 /// </summary>
 /// <param name="query"></param>
 public void Load(IEntityQuery query) {
   Query = query;
   LoadCore();
 }
 public static async Task <BudgetClass> FindByNameAsync(this IEntityQuery <BudgetClass> repository, string name)
 {
     return(await repository.FirstOrDefaultAsync(bc => bc.Name == name.Trim()));
 }
 public static async Task <BudgetClass> FindByIdAsync(this IEntityQuery <BudgetClass> repository, int id)
 {
     return(await repository.FirstOrDefaultAsync(bc => bc.Id == id));
 }
Example #26
0
 public IEnumerable <IEntity> GetEntities(IEntityQuery query)
 {
     return(query.Match(this));
 }
Example #27
0
 /// <summary> Менеджер заданий </summary>
 public TaskManager(IEntityQuery query, IXapProcessor xapProcessor)
 {
     _query        = query;
     _xapProcessor = xapProcessor;
 }
Example #28
0
 /// <summary> Базовый загрузчик модели по сущности </summary>
 protected AbstractModelLoader(IEntityQuery query)
 {
     _query = query;
 }
Example #29
0
 /// <summary> Модель списка демонстрационных лабораторных работ </summary>
 public DemoLabListModel(IEntityQuery query,
                         IEntityBasedModelLoader <DemoLabModel, AbstractLabSchedule> modelLoader,
                         ISystemDateService dateService,
                         IGraphLabsPrincipal currentUser) : base(query, modelLoader, dateService, currentUser)
 {
 }
 public ClientQueries(IEntityQuery entityQuery, ISqlQuery sqlQuery)
 {
     this.entityQuery = entityQuery;
     this.sqlQuery = sqlQuery;
 }
Example #31
0
        /// <summary>
        /// Match
        /// 
        /// Allows us to fetch entities with a defined SET of components
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public bool Match(IEntityQuery query)
        {
            // Empty queries always result in a match - equivalent to SELECT * FROM ENTITIES
            if (!(query.Exclusionset.Any() || query.OneSet.Any() || query.AllSet.Any()))
                return true;

            //If there is an EXCLUDE set, and the entity contains any component types in that set, or subtypes of them, the entity is excluded.
            bool matched = !(query.Exclusionset.Any() && query.Exclusionset.Any(t => ComponentTypes.Any(t.IsAssignableFrom)));
         
            //If there are no matching exclusions, and the entity matches the ALL set, the entity is included
            if(matched && (query.AllSet.Any() && query.AllSet.Any(t => !ComponentTypes.Any(t.IsAssignableFrom))))
                matched = false;
            //If the entity matches so far, and it matches the ONE set, it matches.
            if(matched && (query.OneSet.Any() && query.OneSet.Any(t => ComponentTypes.Any(t.IsAssignableFrom))))
                matched = false;
            return matched;
        }
 public static async Task <TEntity> FirstOrDefaultAsync <TEntity>(
     this IEntityQuery <TEntity> repository) where TEntity : class
 {
     return(await repository.Query().FirstOrDefaultAsync());
 }
Example #33
0
 public IEnumerable <IEntity> GetEntities(IEntityQuery query)
 {
     return(GetEntities().Where(e => e.Match(query)));
 }
 public static IIncludableQueryable <TEntity, TProperty> Include <TEntity, TProperty>(
     this IEntityQuery <TEntity> repository,
     Expression <Func <TEntity, TProperty> > navigationPropertyPath) where TEntity : class
 {
     return(repository.Query().Include(navigationPropertyPath));
 }