Exemple #1
0
 public RepositoryManager()
 {
     CharacterRepository                 = new CharacterRepository();
     ActionRepository                    = new ActionRepository();
     AttributeRepository                 = new AttributeRepository();
     ShadowCharacterRepository           = new ShadowCharacterRepository();
     DrugRepository                      = new DrugRepository();
     GearEnchantMaterialRepository       = new GearEnchantMaterialRepository();
     GearRepository                      = new GearRepository();
     GearPieceRepository                 = new GearPieceRepository();
     GearRecipeRepository                = new GearRecipeRepository();
     CharacterEffectRepository           = new CharacterEffectRepository();
     LevelMasterRepository               = new LevelMasterRepository();
     SoulRepository                      = new SoulRepository();
     StoryStageRepository                = new StoryStageRepository();
     StoryEpisodeRepository              = new StoryEpisodeRepository();
     ExchangeCashGiftRepository          = new ExchangeCashGiftRepository();
     RaidTicketRepository                = new RaidTicketRepository();
     PlayerCharacterRepository           = new PlayerCharacterRepository();
     PlayerStatusRepository              = new PlayerStatusRepository();
     PlayerStoryChapterRepository        = new PlayerStoryChapterRepository();
     PlayerStoryEpisodeRepository        = new PlayerStoryEpisodeRepository();
     PlayerStoryStageRepository          = new PlayerStoryStageRepository();
     PlayerArenaRepository               = new PlayerArenaRepository();
     PlayerSoulRepository                = new PlayerSoulRepository();
     PlayerDrugRepository                = new PlayerDrugRepository();
     PlayerGearEnchantMaterialRepository = new PlayerGearEnchantMaterialRepository();
     PlayerGearPieceRepository           = new PlayerGearPieceRepository();
     PlayerGearRepository                = new PlayerGearRepository();
     PlayerSoulRepository                = new PlayerSoulRepository();
     PlayerExchangeCashGiftRepository    = new PlayerExchangeCashGiftRepository();
     PlayerRaidTicketRepository          = new PlayerRaidTicketRepository();
     InventoryRepository                 = new InventoryRepository();
     CharacterEvolutionTypeRepository    = new CharacterEvolutionTypeRepository();
 }
Exemple #2
0
        public override PullResult Preview()
        {
            var options = AttributeRepository.LoadOptions(AttributeModel.Id.ToString());
            var limit   = options.GetValue("puller_page_limit", 100);
            var offset  = 0;

            var sqlScript = GetSqlScript(options, false); // should call raw SQL instead of calling view
            var sets      = adapter.Query(sqlScript, new
            {
                Limit  = limit,
                Offset = offset
            });
            var set     = sets.FirstOrDefault();
            var results = set?.Rows?.Select(r => {
                var jObj = JObject.FromObject(r);
                jObj.Remove("RowNum");
                return(jObj.ToObject(typeof(object)));
            });

            return(new PullResult
            {
                Status = results?.Count() > 0 ? PullState.HasData : PullState.Invalid,
                LastToken = new
                {
                    Limit = limit,
                    Offset = offset
                },
                Data = results
            });
        }
Exemple #3
0
        public void AttributeRepositoryTest()
        {
            var repo = new AttributeRepository(factory);

            var all   = repo.GetAll();
            var one   = repo.Single(x => x.Id == 3);
            var query = repo.Get(x => x.Family.Contains("Tecno"));
        }
Exemple #4
0
        public void SetUp()
        {
            _dbContextOptions = new DbContextOptionsBuilder <DueltankDbContext>()
                                .UseInMemoryDatabase("dueltank")
                                .Options;

            _sut = new AttributeRepository(new DueltankDbContext(_dbContextOptions));
        }
Exemple #5
0
        public JsonResult GetTypeAheadTypicalOptionList(string attr, string query)
        {
            using (AttributeRepository aRepo = new AttributeRepository())
            {
                var theList = aRepo.GetTypicalOptionList(attr, query);

                return(Json(theList, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #6
0
 private void SaveAttributes(T saveThis)
 {
     if (saveThis is IAttributedEntity saveThisAsAttributed)
     {
         foreach (var item in saveThisAsAttributed.GetAttributes())
         {
             AttributeRepository.Save(item);
         }
     }
 }
 public ProductStockPusher(ProductStockPusherOptionManager optionManager,
                           ProductProcessor entityProcessor,
                           StockAttributeProcessor attributeProcessor,
                           FastProvider provider,
                           FastAdapter adapter,
                           EntityRepository entityRepository,
                           AttributeRepository attributeRepository,
                           ConnectionRepository connectionRepository) : base(optionManager, entityProcessor, attributeProcessor, provider, adapter, entityRepository, attributeRepository, connectionRepository)
 {
 }
 public QueueIndexChangesStep(ResolverFactory resolver,
                              EntityRepository entityRepository,
                              AttributeRepository attributeRepository,
                              ConnectionRepository connectionRepository,
                              QueueChangesManager queueChangesManager) : base(resolver)
 {
     this.entityRepository     = entityRepository;
     this.attributeRepository  = attributeRepository;
     this.connectionRepository = connectionRepository;
     this.queueChangesManager  = queueChangesManager;
 }
        public UnitOfWork(ComputerSalonContext context)
        {
            this.context = context;

            AttributeRepository            = new AttributeRepository(context);
            TypeRepository                 = new TypeRepository(context);
            SystemBlockRepository          = new SystemBlockRepository(context);
            SystemBlockComponentRepository = new SystemBlockComponentRepository(context);
            ComponentRepository            = new ComponentRepository(context);
            ValueRepository                = new ValueRepository(context);
        }
Exemple #10
0
 public AttributeIndexer(
     EntityProcessor entityProcessor,
     AttributeProcessor attributeProcessor,
     AttributeIndexerOptionManager optionManager,
     FastProvider provider,
     FastAdapter adapter,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     ConnectionRepository connectionRepository) : base(entityProcessor, attributeProcessor, optionManager, provider, adapter, entityRepository, attributeRepository, connectionRepository)
 {
 }
Exemple #11
0
 public JsonpResult GetCMDetailList()
 {
     using (AttributeRepository aRepo = new AttributeRepository())
     {
         return(new JsonpResult()
         {
             Data = aRepo.GetCMDetailList(),
             JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
 }
Exemple #12
0
 public JsonpResult GetSeriesListForAttribute(string attr)
 {
     using (AttributeRepository aRepo = new AttributeRepository())
     {
         return(new JsonpResult()
         {
             Data = aRepo.GetSeriesListForAttribute(attr),
             JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
 }
        public ActionResult AddAttributeToProduct()
        {
            ProductRepository   _prep = new ProductRepository();
            AttributeRepository _arep = new AttributeRepository();
            ProductVM           pvm   = new ProductVM()
            {
                Products    = _prep.GetActives(),
                PAttributes = _arep.GetActives(),
            };

            return(View(pvm));
        }
Exemple #14
0
        public override PullResult PullNext(object lastToken = null)
        {
            var options    = AttributeRepository.LoadOptions(AttributeModel.Id.ToString());
            var totalCount = GetCount(options, true);

            var limit  = options.GetValue("puller_page_limit", 100);
            var offset = 0;

            if (lastToken != null)
            {
                var jToken = JObject.FromObject(lastToken);
                if (jToken != null && jToken.ContainsKey("Limit") && jToken.ContainsKey("Offset"))
                {
                    limit  = int.Parse(jToken.GetValue("Limit").ToString());
                    offset = int.Parse(jToken.GetValue("Offset").ToString());
                    offset = offset + limit;
                }
            }

            if (offset > totalCount) // AccessDb never knows how to stop
            {
                return(new PullResult
                {
                    Status = PullState.Invalid,
                    LastToken = new
                    {
                        Limit = limit,
                        Offset = offset
                    },
                    Data = null
                });
            }

            var sqlScript = GetSqlScript(options, limit, offset + limit, true);
            var sets      = adapter.Query(sqlScript, new
            {
                Limit  = limit,
                Offset = offset
            });
            var set     = sets.FirstOrDefault();
            var results = set?.Rows;

            return(new PullResult
            {
                Status = results?.Count() > 0 ? PullState.HasData : PullState.Invalid,
                LastToken = new
                {
                    Limit = limit,
                    Offset = offset
                },
                Data = results
            });
        }
Exemple #15
0
 public AttributePuller(
     AttributePullerOptionManager optionManager,
     EntityProcessor entityProcessor,
     AttributeProcessor attributeProcessor,
     FastProvider provider,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     ConnectionRepository connectionRepository,
     FastAdapter adapter) : base(optionManager, entityProcessor, attributeProcessor, provider, adapter, entityRepository, attributeRepository, connectionRepository)
 {
     this.adapter = adapter;
 }
Exemple #16
0
        public JsonpResult GetImageCMInfo(int imageId)
        {
            using (AttributeRepository aRepo = new AttributeRepository())
            {
                var theData = aRepo.GetImageCMInfo(imageId);

                return(new JsonpResult()
                {
                    Data = theData,
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemple #17
0
        public JsonpResult GetTypicalPriceRange()
        {
            using (AttributeRepository aRepo = new AttributeRepository())
            {
                var theList = aRepo.GetTypicalPriceRange();

                return(new JsonpResult()
                {
                    Data = theList,
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemple #18
0
        public JsonpResult GetTypicalOptionList(string attr)
        {
            using (AttributeRepository aRepo = new AttributeRepository())
            {
                var theList = aRepo.GetTypicalOptionList(attr);

                return(new JsonpResult()
                {
                    Data = theList,
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemple #19
0
 public PullIndexParallelWorkflow(
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     ScheduleOptionRepository scheduleOptionRepository,
     IndexerManager indexerManager,
     ResolverFactory resolverFactory)
 {
     this.entityRepository         = entityRepository;
     this.attributeRepository      = attributeRepository;
     this.scheduleOptionRepository = scheduleOptionRepository;
     this.indexerManager           = indexerManager;
     this.logger = resolverFactory.Resolve <ILogger>("Workflow");
 }
 public string AttributeInfo(string attributeId)
 {
     AttributeInfoObject attribute = new AttributeInfoObject();
     try
     {
         attribute = new AttributeRepository().SelectByIDWithInfo(attributeId);
     }
     catch (Exception e)
     {
         LoggerFactory.GetLogger().Error(String.Format(msgUtil.GetMessage(MessageKey.LOG_GETATTRIBUTEINFO_EXCEPTION), attribute.Id), e);
     }
     return JsonConvert.SerializeObject(attribute);
 }
Exemple #21
0
 public PullersController(IEnumerable <IEntityPuller> entityPullers,
                          IEnumerable <IAttributePuller> attributePullers,
                          IEnumerable <IIndexer> indexers,
                          EntityRepository entityRepository,
                          AttributeRepository attributeRepository,
                          ConnectionRepository connectionRepository)
 {
     _entityPullers            = entityPullers;
     _attributePullers         = attributePullers;
     _indexers                 = indexers;
     this.entityRepository     = entityRepository;
     this.attributeRepository  = attributeRepository;
     this.connectionRepository = connectionRepository;
 }
Exemple #22
0
 public BaseAttributeIndexer(
     IProcessor entityProcessor,
     IProcessor attributeProcessor,
     IOptionManager optionManager,
     IRichProvider provider,
     IRichAdapter adapter,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     ConnectionRepository connectionRepository) : base(optionManager, adapter, provider, connectionRepository)
 {
     AttributeProcessor  = attributeProcessor;
     EntityProcessor     = entityProcessor;
     EntityRepository    = entityRepository;
     AttributeRepository = attributeRepository;
 }
Exemple #23
0
 public BaseAttributePusher(
     IOptionManager optionManager,
     IProcessor entityProcessor,
     IProcessor attributeProcessor,
     IRichProvider provider,
     IRichAdapter adapter,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     ConnectionRepository connectionRepository) : base(optionManager, connectionRepository, adapter, provider)
 {
     this.EntityProcessor     = entityProcessor;
     this.AttributeProcessor  = attributeProcessor;
     this.EntityRepository    = entityRepository;
     this.AttributeRepository = attributeRepository;
 }
 public SuccessItemReporter(
     ResolverFactory resolverFactory,
     SuccessItemReporterOptionManager optionManager,
     MessageRepository messageRepository,
     QueueItemRepository queueItemRepository,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     MessageDeliveryChannelRepository messageDeliveryChannelRepository
     ) : base(optionManager, resolverFactory, messageDeliveryChannelRepository)
 {
     this.messageRepository   = messageRepository;
     this.queueItemRepository = queueItemRepository;
     this.entityRepository    = entityRepository;
     this.attributeRepository = attributeRepository;
 }
Exemple #25
0
 public SyncService(
     ResolverFactory resolverFactory,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     IWorkflowHost host,
     IEnumerable <IBaseWorkflow> workflows)
 {
     _logger                  = resolverFactory.Resolve <ILogger>("SyncService");
     _errorLogger             = resolverFactory.Resolve <ILogger>("Error");
     this.resolverFactory     = resolverFactory;
     this.entityRepository    = entityRepository;
     this.attributeRepository = attributeRepository;
     _host          = host;
     this.workflows = workflows;
     //RegisterWorkflows();
 }
Exemple #26
0
 public UpdateIndexChangesStep(
     ResolverFactory resolver,
     EntityRepository entityRepository,
     AttributeRepository attributeRepository,
     ConnectionRepository connectionRepository,
     IEnumerable <IPuller> pullers,
     IEnumerable <IIndexer> indexers,
     IndexerManager indexerManager) : base(resolver)
 {
     this.entityRepository     = entityRepository;
     this.attributeRepository  = attributeRepository;
     this.connectionRepository = connectionRepository;
     this.pullers        = pullers;
     this.indexers       = indexers;
     this.indexerManager = indexerManager;
 }
        public static IEnumerable <SelectListItem> GetShapeDDList()
        {
            using (var aRepository = new AttributeRepository())
            {
                var shapes = aRepository.GetTypicalOptionList("Shape").Select(s => s.Name).ToList();

                shapes.Add("");

                shapes.Sort();

                return(shapes.Select(a => new SelectListItem()
                {
                    Text = a, Value = a
                }));
            }
        }
        public IActionResult Update(string id, [FromBody] CreateAttributeViewModel model)
        {
            AttributeRepository attributeRepository = null;

            try
            {
                attributeRepository = ResolverFactory.Resolve <AttributeRepository>();
                var attributeModel = attributeRepository.GetById(id);
                var state          = attributeModel.State;
                if (model.Enabled)
                {
                    state = (state | EntityState.Disabled) ^ EntityState.Disabled;
                }
                else
                {
                    state = state | EntityState.Disabled;
                }
                var result = attributeRepository.Update(id, new
                {
                    model.Name,
                    model.Description,
                    model.SourceConnectionId,
                    model.DestinationConnectionId,
                    model.EntityId,
                    model.SourceProcessorId,
                    model.DestinationProcessorId,
                    State = state
                });

                if (model.Options != null && model.Options.Count() > 0)
                {
                    attributeRepository.LinkOptions(id, model.Options);
                }

                transaction.Commit();
                return(Ok(result));
            }
            catch
            {
                transaction.Rollback();
                throw;
            }
            finally
            {
                attributeRepository?.Dispose();
            }
        }
Exemple #29
0
        public override IPuller Init()
        {
            var options    = AttributeRepository.LoadOptions(AttributeModel.Id.ToString());
            var sqlScript  = options.GetValue("puller_sql_script");
            var viewExists = adapter.GetView(AttributeModel.SourceViewName);

            if (viewExists != null)
            {
                adapter.DropView(AttributeModel.SourceViewName);
            }
            var createViewSQL = $@"
CREATE VIEW {AttributeModel.SourceViewName}
AS
{sqlScript}";

            adapter.Execute(createViewSQL);
            return(this);
        }
Exemple #30
0
        public override PullResult PullNext(object lastToken = null)
        {
            var options = AttributeRepository.LoadOptions(AttributeModel.Id.ToString());
            var limit   = options.GetValue("puller_page_limit", 100);
            var offset  = 0;

            if (lastToken != null)
            {
                var jToken = JObject.FromObject(lastToken);
                if (jToken != null && jToken.ContainsKey("Limit") && jToken.ContainsKey("Offset"))
                {
                    limit  = int.Parse(jToken.GetValue("Limit").ToString());
                    offset = int.Parse(jToken.GetValue("Offset").ToString());
                    offset = offset + limit;
                }
            }

            var sqlScript = GetSqlScript(options, true);
            var sets      = adapter.Query(sqlScript, new
            {
                Limit  = limit,
                Offset = offset
            });
            var set     = sets.FirstOrDefault();
            var results = set?.Rows?.Select(r => {
                var jObj = JObject.FromObject(r);
                jObj.Remove("RowNum");
                return(jObj.ToObject(typeof(object)));
            });

            return(new PullResult
            {
                Status = results?.Count() > 0 ? PullState.HasData : PullState.Invalid,
                LastToken = new
                {
                    Limit = limit,
                    Offset = offset
                },
                Data = results
            });
        }
Exemple #31
0
 public AttributesController(
     AttributeRepository attributeRepository,
     EntityRepository entityRepository,
     ConnectionRepository connectionRepository,
     IEnumerable <IProcessor> processors,
     IEnumerable <IAttributePuller> pullers,
     IEnumerable <IAttributeIndexer> indexers,
     IEnumerable <IAttributePusher> pushers,
     DbTransaction transaction,
     JsonSerializer serializer)
 {
     this.attributeRepository  = attributeRepository;
     this.entityRepository     = entityRepository;
     this.connectionRepository = connectionRepository;
     this.processors           = processors;
     this.pullers     = pullers;
     this.indexers    = indexers;
     this.pushers     = pushers;
     this.transaction = transaction;
     this.serializer  = serializer;
 }