コード例 #1
0
 public DatacenterService(IDatacenterRepository repository, IAuditEventLogger auditEventLogger, IMapper mapper, IRackRepository rackRepository)
 {
     _repository       = repository;
     _auditEventLogger = auditEventLogger;
     _mapper           = mapper;
     _rackRepository   = rackRepository;
 }
コード例 #2
0
 public AssetService(IAssetRepository _repository, IAssetDetailRepository _repositoryAssetDetail, IAssetHistoryRepository _repositoryAssetHistory,
                     IAssetLicenseRepository _repositoryAssetLicense, IAssetOwnerRepository _repositoryAssetOwner,
                     IStatusRepository _repositoryStatus, IBackupRepository _repositoryBackup, ILicenseRepository _repositoryLicense,
                     IOperationalSiteRepository _repositoryOperationalSite, IOperationalSiteLocationRepository _repositoryOperationalSiteLocation,
                     IPurchaseItemRepository _repositoryPurchaseItem, IRackRepository _repositoryRack, IRackLocationRepository _repositoryRackLocation,
                     IURackRepository _repositoryURack, IWarningPeriodRepository _repositoryWarningPeriod, IPurchaseTypeRepository _repositoryPurchaseType,
                     IWarehouseRepository _repositoryWarehouse, UserManager <ApplicationUser> userManager)
 {
     repository                        = _repository;
     repositoryAssetDetail             = _repositoryAssetDetail;
     repositoryAssetHistory            = _repositoryAssetHistory;
     repositoryAssetLicense            = _repositoryAssetLicense;
     repositoryAssetOwner              = _repositoryAssetOwner;
     repositoryStatus                  = _repositoryStatus;
     repositoryBackup                  = _repositoryBackup;
     repositoryLicense                 = _repositoryLicense;
     repositoryOperationalSite         = _repositoryOperationalSite;
     repositoryOperationalSiteLocation = _repositoryOperationalSiteLocation;
     repositoryPurchaseItem            = _repositoryPurchaseItem;
     repositoryRack                    = _repositoryRack;
     repositoryRackLocation            = _repositoryRackLocation;
     repositoryURack                   = _repositoryURack;
     repositoryWarningPeriod           = _repositoryWarningPeriod;
     repositoryPurchaseType            = _repositoryPurchaseType;
     repositoryWarehouse               = _repositoryWarehouse;
     this.userManager                  = userManager;
 }
コード例 #3
0
 public RackLocationService(IRackLocationRepository _repository,
                            IRackRepository _repositoryRack, ILocationRepository _repositoryLocation, IAssetRepository _assetRepository)
 {
     repository         = _repository;
     repositoryRack     = _repositoryRack;
     repositoryLocation = _repositoryLocation;
     assetRepository    = _assetRepository;
 }
コード例 #4
0
        public RackService(IRackRepository rackRepository)
        {
            this._rackRepository = rackRepository;

            if (this._rackRepository == null)
            {
                throw new ArgumentNullException("RackService.IRackRepository");
            }
        }
コード例 #5
0
 public ChangePlanService(IChangePlanRepository repository, IAssetRepository assetRepository, IModelRepository modelRepository,
                          IRackRepository rackRepository, IIdentityRepository userRepository, IMapper mapper)
 {
     _repository      = repository;
     _assetRepository = assetRepository;
     _modelRepository = modelRepository;
     _rackRepository  = rackRepository;
     _userRepository  = userRepository;
     _mapper          = mapper;
 }
コード例 #6
0
 public UnitOfWork(IDbConnection connection)
 {
     transaction             = connection.BeginTransaction();
     documentRepository      = new DocumentRepository(transaction);
     documentThemeRepository = new DocumentThemeRepository(transaction);
     cellRepository          = new CellRepository(transaction);
     shelfRepository         = new ShelfRepository(transaction);
     rackRepository          = new RackRepository(transaction);
     departmentRepository    = new DepartmentRepository(transaction);
     workerRepository        = new WorkerRepository(transaction);
     requestsRepository      = new RequestRepository(transaction);
 }
コード例 #7
0
 public ItemProviderServiceApplication(IAuthorRepository authorRepository
                                       , IPublisherRepository publisherRepository
                                       , IGenreRepository genreRepository
                                       , ISeriesRepository seriesRepository
                                       , IShelfRepository shelfRepository
                                       , IRackRepository rackRepository)
 {
     _authorRepository    = authorRepository;
     _publisherRepository = publisherRepository;
     _genreRepository     = genreRepository;
     _seriesRepository    = seriesRepository;
     _shelfRepository     = shelfRepository;
     _rackRepository      = rackRepository;
 }
コード例 #8
0
 public IntegrationServiceApplication(IParserApplication parserApplication, IBookRepository bookRepository, IAuthorRepository authorRepository, IPublisherRepository publisherRepository, IGenreRepository genreRepository, ISeriesRepository seriesRepository, IShelfRepository shelfRepository, IRackRepository rackRepository, ILogger logger, IUserRepository userRepository, IImporter importer, IFileReciever fileReciever)
 {
     _parserApplication   = parserApplication;
     _bookRepository      = bookRepository;
     _authorRepository    = authorRepository;
     _publisherRepository = publisherRepository;
     _genreRepository     = genreRepository;
     _seriesRepository    = seriesRepository;
     _shelfRepository     = shelfRepository;
     _rackRepository      = rackRepository;
     _logger         = logger;
     _userRepository = userRepository;
     _importer       = importer;
     _fileReciever   = fileReciever;
 }
コード例 #9
0
 public RackValidator(IRackRepository rackRepository)
 {
     _rackRepository = rackRepository;
     // default rules
     RuleFor(rack => rack.Row)
     .NotEmpty()
     .Matches("^[A-Z]{1}$");
     RuleFor(rack => rack.Column)
     .GreaterThanOrEqualTo(1);
     RuleSet("delete", () =>
     {
         RuleFor(rack => rack.Assets)
         .Empty();
     });
     RuleSet("create", () =>
     {
         RuleFor(rack => rack)
         .MustAsync(HaveUniqueAddress)
         .WithMessage(rack => $"A rack already exists at address {rack.Row}{rack.Column} in the datacenter {rack.Datacenter.Name}.")
         .WithSeverity(Severity.Info);
     });
 }
コード例 #10
0
        public AssetValidator(IAssetRepository assetRepository, IRackRepository rackRepository, IModelRepository modelRepository, IIdentityRepository identityRepository)
        {
            _assetRepository    = assetRepository;
            _rackRepository     = rackRepository;
            _modelRepository    = modelRepository;
            _identityRepository = identityRepository;

            // default rules
            RuleFor(asset => asset.Hostname)
            .NotEmpty()
            .MaximumLength(63)
            .Matches("^[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]$")
            .MustAsync(HaveUniqueHostname);
            RuleFor(asset => asset.Rack)
            .NotNull()
            .MustAsync(RackExists)
            .When(asset => asset.Rack != null);
            RuleFor(asset => asset.Model)
            .NotNull()
            .MustAsync(ModelExists)
            .When(asset => asset.Model != null);
            RuleFor(asset => asset.RackPosition)
            .NotEmpty()
            .GreaterThanOrEqualTo(1);
            RuleFor(asset => asset.Owner)
            .MustAsync(UserExists)
            .When(asset => asset.Owner != null);
            RuleFor(asset => asset)
            .Must(NotConflictWithInstalledAssets)
            .WithErrorCode("Conflict")
            .WithMessage(asset => $"Asset (hostname: {asset.Hostname}) conflicts with other installed assets.");
            RuleFor(asset => asset)
            .Must(FitWithinRack)
            .WithErrorCode("DoesNotFit")
            .WithMessage(asset =>
                         $"Asset (hostname: {asset.Hostname}) does not fit within confines of its rack.");
        }
コード例 #11
0
        public void CreateAndUpdateRackItemLevel(RackItemLevelContract rackItemLevelContract)
        {
            var rackeitemlevel = IRackItemLevelRepository.Get(rackItemLevelContract.Id);

            if (rackeitemlevel != null)
            {
                rackeitemlevel.CurrentQuantity = rackItemLevelContract.CurrentQuantity;
                rackeitemlevel.InQuantity      = rackItemLevelContract.InQuantity;
                rackeitemlevel.OutQuantity     = rackItemLevelContract.OutQuantity;
                rackeitemlevel.Item            = IItemRepository.Get(rackItemLevelContract.ItemId);
                rackeitemlevel.Rack            = IRackRepository.Get(rackItemLevelContract.RackId);
                IRackItemLevelRepository.Update(rackeitemlevel);
            }
            else
            {
                rackeitemlevel = new RackItemLevel();
                rackeitemlevel.CurrentQuantity = rackItemLevelContract.CurrentQuantity;
                rackeitemlevel.InQuantity      = rackItemLevelContract.InQuantity;
                rackeitemlevel.OutQuantity     = rackItemLevelContract.OutQuantity;
                rackeitemlevel.Item            = IItemRepository.Get(rackItemLevelContract.ItemId);
                rackeitemlevel.Rack            = IRackRepository.Get(rackItemLevelContract.RackId);
                IRackItemLevelRepository.Insert(rackeitemlevel);
            }
        }
コード例 #12
0
 public RackService(IRackRepository _repository, IRackLocationRepository _rackLocationRepository)
 {
     repository             = _repository;
     rackLocationRepository = _rackLocationRepository;
 }
コード例 #13
0
 public RackGearController(IRackRepository repository)
 {
     _repository = repository;
 }
コード例 #14
0
 public RackService(IRackRepository rackRepository, IAuditEventLogger auditEventLogger, IMapper mapper)
 {
     _rackRepository   = rackRepository;
     _auditEventLogger = auditEventLogger;
     _mapper           = mapper;
 }
コード例 #15
0
        public void SaveCreateOrUpdate(SaleOrderContract saleOrderContract)
        {
            var saleOrderDb = ISaleOrderrepository.Get(saleOrderContract.Id);

            if (saleOrderDb != null)
            {
                for (int i = 0; i < saleOrderContract.SaleOrderItemscontract.Count; i++)
                {
                    var temp = saleOrderContract.SaleOrderItemscontract[i];

                    if (saleOrderDb.SaleOrderItem.Any(x => x.Id == temp.Id))
                    {
                        var indatabaseorderitem = saleOrderDb.SaleOrderItem.FirstOrDefault(x => x.Id == temp.Id);
                        indatabaseorderitem.Item       = ItemRepository.Get(temp.ItemId);
                        indatabaseorderitem.Rack       = IRackRepository.Get(temp.RackId);
                        indatabaseorderitem.NetPrice   = temp.NetPrice;
                        indatabaseorderitem.Quantity   = temp.Quantity;
                        indatabaseorderitem.TotalPrice = temp.TotalPrice;
                        indatabaseorderitem.UnitPrice  = temp.UnitPrice;
                    }
                    else
                    {
                        SaleOrderItem saleOrderItem = new SaleOrderItem();
                        saleOrderItem.Item       = ItemRepository.Get(temp.ItemId);
                        saleOrderItem.Rack       = IRackRepository.Get(temp.RackId);
                        saleOrderItem.Quantity   = temp.Quantity;
                        saleOrderItem.NetPrice   = temp.NetPrice;
                        saleOrderItem.TotalPrice = temp.TotalPrice;
                        saleOrderItem.UnitPrice  = temp.UnitPrice;
                        saleOrderDb.SaleOrderItem.Add(saleOrderItem);
                    }
                }

                for (int i = 0; i < saleOrderDb.SaleOrderItem.Count; i++)
                {
                    var temp = saleOrderDb.SaleOrderItem[i];
                    if (saleOrderContract.SaleOrderItemscontract.All(x => x.Id != temp.Id))
                    {
                        saleOrderDb.SaleOrderItem.Remove(temp);
                    }
                }
                ISaleOrderrepository.Update(saleOrderDb);
            }
            else
            {
                saleOrderDb              = new SaleOrder();
                saleOrderDb.Code         = saleOrderContract.Code;
                saleOrderDb.CreationDate = saleOrderContract.CreationDate;
                saleOrderDb.Title        = saleOrderContract.Title;
                SaleOrderItem saleOrderItem = new SaleOrderItem();
                for (int i = 0; i < saleOrderContract.SaleOrderItemscontract.Count; i++)
                {
                    var temp = saleOrderContract.SaleOrderItemscontract[i];

                    saleOrderItem.Item       = ItemRepository.Get(temp.ItemId);
                    saleOrderItem.Rack       = IRackRepository.Get(temp.RackId);
                    saleOrderItem.Quantity   = temp.Quantity;
                    saleOrderItem.NetPrice   = temp.NetPrice;
                    saleOrderItem.TotalPrice = temp.TotalPrice;
                    saleOrderItem.UnitPrice  = temp.UnitPrice;
                    saleOrderDb.SaleOrderItem.Add(saleOrderItem);
                }
                ISaleOrderrepository.Insert(saleOrderDb);
            }
        }
コード例 #16
0
 public RackDataService(IRackRepository repository)
 {
     this.repository = repository;
 }
コード例 #17
0
 public void Init()
 {
     repository = new MockRackRepository();
 }