예제 #1
0
 public ComponentController(Startup.DeleteByIdResolver deleteAccesor, IComponentReadOnlyRepository readComponent, ICreate <Component> createComponent, IUpdate <Component> updateComponent)
 {
     delete = new DeleteComponent(deleteAccesor(WebApi.DeletesID.Component), readComponent);
     create = new CreateComponent(createComponent, readComponent);
     update = new UpdateComponent(updateComponent, readComponent);
     read   = new ReadComponent(readComponent);
 }
예제 #2
0
        public ComponentReplacer(Computer computer, Component component, IComponentReadOnlyRepository componentRepository, IFactoryCompatibility compatibilities, IFactoryEnough enoughs)
        {
            this.compatibilities = compatibilities;
            this.enoughs         = enoughs;
            this.computer        = computer;
            this.component       = component;
            components           = componentRepository.All.Where(c => c.TypePart == component.TypePart)
                                   .Where(c => c.IsEnough(enoughs[Enough.Level], GetLevelToReplace(component)))
                                   .Where(c => c.Id != component.Id)
                                   .OrderBy(c => c.Price);

            replaces = new Dictionary <TypePart, Func <Component> >
            {
                { TypePart.cpu, ReplaceCpu },
                { TypePart.mother, ReplaceMother },
                { TypePart.fan, ReplaceFan },
                { TypePart.ram, ReplaceRam },
                { TypePart.gpu, ReplaceGpu },
                { TypePart.hdd, ReplaceCapacity },
                { TypePart.ssd, ReplaceCapacity },
                { TypePart.tower, ReplaceTower },
                { TypePart.psu, ReplaceCapacity },
                { TypePart.accesory, ReplaceAccesory }
            };
        }
예제 #3
0
 public BuilderComputer(IStrategyOrderBy orderBy, IFactoryCompatibility factoryCompatibility, IFactoryEnough factoryEnough, IComponentReadOnlyRepository componentRepo, ICostsReadOnlyRepository costRepo)
 {
     this.orderBy = orderBy;
     this.factoryCompatibility = factoryCompatibility;
     this.factoryEnough        = factoryEnough;
     repository = componentRepo;
     buildCost  = costRepo.BuildCost;
     pricePerfomanceMultiplier = costRepo.PricePerfomanceMultiplier;
 }
예제 #4
0
 public RegisterBuildError(IComponentReadOnlyRepository componenRepository, IFactoryCompatibility compatibilities, IFactoryEnough enoughs, IErrorBuildingWriteOnlyRepository errorRepository, IErrorBuildingWithReplaceWriteOnlyRepository errorReplaceRepository, IComputerReadOnlyRepository computerRepository)
 {
     this.componenRepository     = componenRepository;
     this.compatibilities        = compatibilities;
     this.enoughs                = enoughs;
     this.errorRepository        = errorRepository;
     this.errorReplaceRepository = errorReplaceRepository;
     this.computerRepository     = computerRepository;
 }
예제 #5
0
 public ComputerStockRepository(IComponentReadOnlyRepository componentRepository)
 {
     ComponentRepository = componentRepository;
 }
예제 #6
0
 public DeleteComponent(IDeleteById delete, IComponentReadOnlyRepository read)
 {
     this.delete = delete;
     this.read   = read;
 }
예제 #7
0
 public ComputerReadOnlyRepository(IConnection connection, IComponentReadOnlyRepository componentRepository, ICostsReadOnlyRepository costRepo) : base(connection)
 {
     this.componentRepository = componentRepository;
     this.costRepo            = costRepo;
 }
예제 #8
0
 public UpdateComponent(IUpdate <Component> update, IComponentReadOnlyRepository read)
 {
     this.update = update;
     this.read   = read;
 }
예제 #9
0
 public CreateComponent(ICreate <Component> create, IComponentReadOnlyRepository read)
 {
     this.create = create;
     this.read   = read;
 }
예제 #10
0
 public ReadComponent(IComponentReadOnlyRepository read)
 {
     this.read = read;
 }
예제 #11
0
 public ControlStock(IComponentReadOnlyRepository componentRepo)
 {
     this.componentRepo = componentRepo;
 }