Esempio n. 1
0
 public CountryController(ICountryRepository countryRepository, ICountryService countryService, IPresidentVotingRepository presidentVotingRepository, IWarService warService,
                          ITransactionsService transactionService, IWarRepository warRepository, IRegionService regionService, IRegionRepository regionRepository, IEmbargoService embargoService,
                          IEmbargoRepository embargoRepository, IWalletRepository walletRepository, IPopupService popupService, ICountryTreasureService countryTreasureService,
                          IWalletService walletService, ICompanyService companyService, IMPPService mppService, IMilitaryProtectionPactRepository mppRepository,
                          IMilitaryProtectionPactOfferRepository mppOfferRepository, ITransactionScopeProvider transactionScopeProvider, IConstructionRepository constructionRepository,
                          IConstructionService constructionService) : base(popupService)
 {
     this.countryRepository         = countryRepository;
     this.countryService            = countryService;
     this.presidentVotingRepository = presidentVotingRepository;
     this.warService               = warService;
     this.transactionService       = transactionService;
     this.warRepository            = warRepository;
     this.regionService            = regionService;
     this.regionRepository         = regionRepository;
     this.embargoService           = embargoService;
     this.embargoRepository        = embargoRepository;
     this.walletRepository         = walletRepository;
     this.countryTreasureService   = countryTreasureService;
     this.walletService            = walletService;
     this.companyService           = companyService;
     this.mppService               = mppService;
     this.mppRepository            = mppRepository;
     this.mppOfferRepository       = mppOfferRepository;
     this.transactionScopeProvider = transactionScopeProvider;
     this.constructionRepository   = constructionRepository;
     this.constructionService      = constructionService;
 }
        public CongressVotingService(ICongressVotingRepository congressVotingRepository, IPartyMemberRepository partyMemberRepository, ICongressmenRepository congressmenRepository,
                                     IProductTaxRepository productTaxRepository, IWarningService warningService, ICompanyService companyService, IWalletService walletService, IRegionRepository regionRepository,
                                     IReservedEntityNameRepository reservedEntityNameRepository, ICongressVotingReservedMoneyRepository congressVotingReservedMoneyRepository, ITransactionsService transactionsService,
                                     ICompanyRepository companyRepository, ICitizenRepository citizenRepository, IVotingGreetingMessageRepository votingGreetingMessageRepository,
                                     IHospitalService hospitalService, ICountryRepository countryRepository, IRemovalService removalService,
                                     IDefenseSystemService defenseSystemService, IConstructionService constructionService, ICountryEventService countryEventService)

        {
            this.congressVotingRepository              = congressVotingRepository;
            this.partyMemberRepository                 = partyMemberRepository;
            this.congressmenRepository                 = congressmenRepository;
            this.productTaxRepository                  = productTaxRepository;
            this.warningService                        = warningService;
            this.companyService                        = companyService;
            this.walletService                         = walletService;
            this.regionRepository                      = regionRepository;
            this.reservedEntityNameRepository          = reservedEntityNameRepository;
            this.congressVotingReservedMoneyRepository = congressVotingReservedMoneyRepository;
            this.transactionsService                   = transactionsService;
            this.companyRepository                     = companyRepository;
            this.citizenRepository                     = citizenRepository;
            this.votingGreetingMessageRepository       = votingGreetingMessageRepository;
            this.hospitalService                       = hospitalService;
            this.countryRepository                     = countryRepository;
            this.removalService                        = removalService;
            this.constructionService                   = constructionService;
            this.defenseSystemService                  = defenseSystemService;
            this.countryEventService                   = countryEventService;
        }
Esempio n. 3
0
 public ReportController(IContractService contractService,
                         ICustomerService customerService,
                         IUnitService unitService,
                         IProcuringAgencyService procuringAgencyService,
                         IConstructionModelFactory constructionModelFactory,
                         IReportService reportService,
                         IExportManager exportManager,
                         IConstructionService constructionService,
                         IPermissionService permissionService,
                         IContractFormService contractFormService,
                         IContractTypeService contractTypeService,
                         IConstructionTypeService constructionTypeService
                         )
 {
     this._customerService          = customerService;
     this._constructionTypeService  = constructionTypeService;
     this._contractTypeService      = contractTypeService;
     this._procuringAgencyService   = procuringAgencyService;
     this._unitService              = unitService;
     this._exportManager            = exportManager;
     this._contractService          = contractService;
     this._permissionService        = permissionService;
     this._reportService            = reportService;
     this._constructionModelFactory = constructionModelFactory;
     this._constructionService      = constructionService;
     this._contractFormService      = contractFormService;
 }
Esempio n. 4
0
 public ConstructionsController(
     IConstructionService constructionService,
     IMapper mapper)
 {
     _service = constructionService;
     _mapper  = mapper;
 }
 public ConstructionController(IConstructionRepository constructionRepository, IPopupService popupService, IConstructionService constructionService,
                               ICountryRepository countryRepository, IMarketOfferRepository marketOfferRepository, IMarketService marketService) : base(popupService)
 {
     this.constructionRepository = constructionRepository;
     this.constructionService    = constructionService;
     this.countryRepository      = countryRepository;
     this.marketOfferRepository  = marketOfferRepository;
     this.marketService          = marketService;
 }
        public NationalConstructionItemViewModel(NationalConstruction construction, IConstructionService constructionService)
        {
            RegionID       = construction.RegionID;
            RegionName     = construction.RegionName;
            ConstructionID = construction.ConstructionID;
            Avatar         = new SmallEntityAvatarViewModel(construction.ConstructionID, construction.ConstructionName, Images.UnderConstruction.Path)
                             .DisableNameInclude();

            Quality  = construction.Quality;
            Progress = ((double)construction.Progress / constructionService.GetProgressNeededToBuild(construction.ProductType, construction.Quality)) * 100.0;;
            Progress = Math.Round(Progress, 1);
        }
Esempio n. 7
0
        public void BuildDefenseSystem(Region region, Country country, int quality, IConstructionService constructionService)
        {
            var name = Constants.DefenseSystemConstructionName.FormatString(region.Name);

            using (var trs = transactionScopeProvider.CreateTransactionScope())
            {
                var company = companyService.CreateCompany(name, ProductTypeEnum.DefenseSystem, region.ID, country.ID);
                company.Quality = quality;

                constructionRepository.SaveChanges();
                trs.Complete();
            }
        }
Esempio n. 8
0
 public ConstructionController(ICustomerActivityService customerActivityService,
                               ILocalizationService localizationService,
                               ILocalizedEntityService localizedEntityService,
                               IPermissionService permissionService,
                               ISettingService settingService,
                               IConstructionModelFactory constructionModelFactory,
                               IConstructionService constructionService)
 {
     this._constructionModelFactory = constructionModelFactory;
     this._customerActivityService  = customerActivityService;
     this._localizationService      = localizationService;
     this._localizedEntityService   = localizedEntityService;
     this._permissionService        = permissionService;
     this._constructionService      = constructionService;
 }
Esempio n. 9
0
 public AppWorkController(
     IContractMonitorService contractMonitorService,
     IUnitService unitService,
     IConstructionModelFactory constructionModelFactory,
     IConstructionService constructionService,
     IPriceFormatter priceFormatter,
     IWorkTaskService workTaskService,
     ICustomerService customerService,
     IProcuringAgencyService procuringAgencyService,
     IContractLogService contractLogService,
     IContractTypeService contractTypeService,
     IContractFormService contractFormService,
     ICustomerActivityService customerActivityService,
     ILocalizationService localizationService,
     ILocalizedEntityService localizedEntityService,
     IPermissionService permissionService,
     ISettingService settingService,
     IContractModelFactory contractModelFactory,
     IWorkContext workContext,
     IContractService contractService,
     INotificationService notificationService,
     IPrivateMessagesModelFactory privateMessagesModelFactory
     )
 {
     this._contractMonitorService   = contractMonitorService;
     this._constructionModelFactory = constructionModelFactory;
     this._unitService                 = unitService;
     this._constructionService         = constructionService;
     this._priceFormatter              = priceFormatter;
     this._workTaskService             = workTaskService;
     this._customerService             = customerService;
     this._notificationService         = notificationService;
     this._privateMessagesModelFactory = privateMessagesModelFactory;
     this._contractTypeService         = contractTypeService;
     this._contractLogService          = contractLogService;
     this._contractFormService         = contractFormService;
     this._procuringAgencyService      = procuringAgencyService;
     this._contractModelFactory        = contractModelFactory;
     this._customerActivityService     = customerActivityService;
     this._localizationService         = localizationService;
     this._localizedEntityService      = localizedEntityService;
     this._permissionService           = permissionService;
     this._contractService             = contractService;
     this._workContext                 = workContext;
 }
 public ConstructionModelFactory(IConstructionTypeService constructionTypeService,
                                 ICountryService countryService,
                                 ILocalizationService localizationService,
                                 IStateProvinceService stateProvinceService,
                                 IStaticCacheManager cacheManager,
                                 IWorkContext workContext,
                                 IConstructionCapitalService constructionCapitalService,
                                 IConstructionService constructionService)
 {
     this._constructionTypeService    = constructionTypeService;
     this._constructionCapitalService = constructionCapitalService;
     this._constructionService        = constructionService;
     this._countryService             = countryService;
     this._localizationService        = localizationService;
     this._stateProvinceService       = stateProvinceService;
     this._cacheManager = cacheManager;
     this._workContext  = workContext;
 }
 public PaymentExpenditureController(
     IContractMonitorService contractMonitorService,
     IConstructionModelFactory constructionModelFactory,
     IConstructionService constructionService,
     IPriceFormatter priceFormatter,
     IWorkTaskService workTaskService,
     ICustomerService customerService,
     IProcuringAgencyService procuringAgencyService,
     IContractLogService contractLogService,
     IContractTypeService contractTypeService,
     IContractFormService contractFormService,
     ILocalizationService localizationService,
     ILocalizedEntityService localizedEntityService,
     IPermissionService permissionService,
     IContractModelFactory contractModelFactory,
     IWorkContext workContext,
     IContractService contractService,
     INotificationService notificationService,
     IPrivateMessagesModelFactory privateMessagesModelFactory,
     IUnitService unitService,
     IPaymentAdvanceFactory paymentAdvanceFactory,
     IPaymentAdvanceService paymentAdvanceService,
     IContractPaymentService contractPaymentService,
     ICurrencyService currencyService)
 {
     this._constructionService    = constructionService;
     this._priceFormatter         = priceFormatter;
     this._workTaskService        = workTaskService;
     this._customerService        = customerService;
     this._notificationService    = notificationService;
     this._contractLogService     = contractLogService;
     this._contractFormService    = contractFormService;
     this._contractModelFactory   = contractModelFactory;
     this._localizationService    = localizationService;
     this._localizedEntityService = localizedEntityService;
     this._permissionService      = permissionService;
     this._contractService        = contractService;
     this._workContext            = workContext;
     this._unitService            = unitService;
     this._paymentAdvanceFactory  = paymentAdvanceFactory;
     this._paymentAdvanceService  = paymentAdvanceService;
     this._contractPaymentService = contractPaymentService;
     this._currencyService        = currencyService;
 }
        public ConstructionServiceTest()
        {
            // Arrange
            _departments = new List <Department>
            {
                new Department
                {
                    Id   = 1,
                    Name = "D1",
                },
                new Department
                {
                    Id   = 2,
                    Name = "D2",
                },
            };
            _positions = new List <Position>
            {
                new Position
                {
                    Id   = 1,
                    Name = "P1",
                },
                new Position
                {
                    Id   = 2,
                    Name = "P2",
                },
                new Position
                {
                    Id   = 3,
                    Name = "P3",
                },
                new Position
                {
                    Id   = 4,
                    Name = "P4",
                },
                new Position
                {
                    Id   = 7,
                    Name = "P7",
                },
                new Position
                {
                    Id   = 9,
                    Name = "P9",
                },
                new Position
                {
                    Id   = 10,
                    Name = "P10",
                },
            };
            _employees = new List <Employee>
            {
                new Employee
                {
                    Id         = 1,
                    Name       = "E1",
                    Department = _departments[0],
                    Position   = _positions[0],
                },
                new Employee
                {
                    Id         = 2,
                    Name       = "E2",
                    Department = _departments[1],
                    Position   = _positions[1],
                },
                new Employee
                {
                    Id         = 3,
                    Name       = "E3",
                    Department = _departments[0],
                    Position   = _positions[2],
                },
                new Employee
                {
                    Id         = 4,
                    Name       = "E4",
                    Department = _departments[1],
                    Position   = _positions[1],
                },
                new Employee
                {
                    Id         = 5,
                    Name       = "E5",
                    Department = _departments[0],
                    Position   = _positions[4],
                },
                new Employee
                {
                    Id         = 6,
                    Name       = "E6",
                    Department = _departments[1],
                    Position   = _positions[4],
                },
                new Employee
                {
                    Id         = 7,
                    Name       = "E7",
                    Department = _departments[0],
                    Position   = _positions[5],
                },
                new Employee
                {
                    Id         = 8,
                    Name       = "E8",
                    Department = _departments[1],
                    Position   = _positions[6],
                },
            };
            _projects = new List <Project>
            {
                new Project
                {
                    Id         = 1,
                    Name       = "P1",
                    BaseSeries = "M32787",
                },
                new Project
                {
                    Id         = 2,
                    Name       = "2",
                    BaseSeries = "M32788",
                },
            };
            _nodes = new List <Node>
            {
                new Node
                {
                    Id            = 1,
                    Project       = _projects[0],
                    Code          = "11",
                    Name          = "Name 1",
                    ChiefEngineer = _employees[0],
                },
                new Node
                {
                    Id            = 2,
                    Project       = _projects[1],
                    Code          = "22",
                    Name          = "Name 2",
                    ChiefEngineer = _employees[1],
                },
            };
            _subnodes = new List <Subnode>
            {
                new Subnode
                {
                    Id   = 1,
                    Node = _nodes[0],
                    Code = "Code1",
                    Name = "Name 1",
                },
                new Subnode
                {
                    Id   = 2,
                    Node = _nodes[1],
                    Code = "Code2",
                    Name = "Name 2",
                },
            };
            _marks = new List <Mark>
            {
                new Mark
                {
                    Id         = 1,
                    Subnode    = _subnodes[0],
                    Code       = "KM1",
                    Name       = "Name 1",
                    Department = _departments[0],
                    NormContr  = _employees[0],
                },
                new Mark
                {
                    Id         = 2,
                    Subnode    = _subnodes[0],
                    Code       = "KM2",
                    Name       = "Name 2",
                    Department = _departments[0],
                    NormContr  = _employees[1],
                },
                new Mark
                {
                    Id         = 3,
                    Subnode    = _subnodes[1],
                    Code       = "KM3",
                    Name       = "Name 3",
                    Department = _departments[1],
                    NormContr  = _employees[2],
                },
                new Mark
                {
                    Id         = 4,
                    Subnode    = _subnodes[1],
                    Code       = "KM4",
                    Name       = "Name 4",
                    Department = _departments[1],
                    NormContr  = _employees[2],
                },
            };
            _specifications = new List <Specification>
            {
                new Specification
                {
                    Id        = 1,
                    Mark      = _marks[0],
                    Num       = 0,
                    IsCurrent = true,
                },
                new Specification
                {
                    Id        = 2,
                    Mark      = _marks[1],
                    Num       = 0,
                    IsCurrent = false,
                },
                new Specification
                {
                    Id        = 3,
                    Mark      = _marks[1],
                    Num       = 1,
                    IsCurrent = true,
                },
                new Specification
                {
                    Id        = 4,
                    Mark      = _marks[2],
                    Num       = 0,
                    IsCurrent = true,
                },
            };
            _constructionTypes = new List <ConstructionType>
            {
                new ConstructionType
                {
                    Id   = 1,
                    Name = "T1",
                },
                new ConstructionType
                {
                    Id   = 2,
                    Name = "T2",
                },
                new ConstructionType
                {
                    Id   = 3,
                    Name = "T3",
                },
            };
            _constructionSubtypes = new List <ConstructionSubtype>
            {
                new ConstructionSubtype
                {
                    Id        = 1,
                    Type      = _constructionTypes[0],
                    Name      = "S1",
                    Valuation = "V1",
                },
                new ConstructionSubtype
                {
                    Id        = 2,
                    Type      = _constructionTypes[1],
                    Name      = "S2",
                    Valuation = "V2",
                },
                new ConstructionSubtype
                {
                    Id        = 3,
                    Type      = _constructionTypes[2],
                    Name      = "S3",
                    Valuation = "V3",
                },
            };
            _weldingControl = new List <WeldingControl>
            {
                new WeldingControl
                {
                    Id   = 1,
                    Name = "WC1",
                },
                new WeldingControl
                {
                    Id   = 2,
                    Name = "WC2",
                },
                new WeldingControl
                {
                    Id   = 3,
                    Name = "WC3",
                },
            };
            _constructions = new List <Construction>
            {
                new Construction
                {
                    Id            = 1,
                    Specification = _specifications[0],
                    Name          = "N1",
                    Type          = _constructionTypes[0],
                    Subtype       = _constructionSubtypes[0],
                    Valuation     = "1701",
                    NumOfStandardConstructions = 1,
                    StandardAlbumCode          = "C1",
                    HasEdgeBlunting            = true,
                    HasDynamicLoad             = false,
                    HasFlangedConnections      = true,
                    WeldingControl             = _weldingControl[0],
                    PaintworkCoeff             = 1,
                },
                new Construction
                {
                    Id            = 2,
                    Specification = _specifications[0],
                    Name          = "N2",
                    Type          = _constructionTypes[1],
                    Valuation     = "1702",
                    NumOfStandardConstructions = 1,
                    StandardAlbumCode          = "C1",
                    HasEdgeBlunting            = true,
                    HasDynamicLoad             = false,
                    HasFlangedConnections      = true,
                    WeldingControl             = _weldingControl[1],
                    PaintworkCoeff             = 1,
                },
                new Construction
                {
                    Id            = 3,
                    Specification = _specifications[1],
                    Name          = "N3",
                    Type          = _constructionTypes[0],
                    Valuation     = "1703",
                    NumOfStandardConstructions = 0,
                    HasEdgeBlunting            = true,
                    HasDynamicLoad             = false,
                    HasFlangedConnections      = true,
                    WeldingControl             = _weldingControl[1],
                    PaintworkCoeff             = 1,
                },
                new Construction
                {
                    Id            = 4,
                    Specification = _specifications[1],
                    Name          = "N4",
                    Type          = _constructionTypes[2],
                    Valuation     = "1704",
                    NumOfStandardConstructions = 0,
                    HasEdgeBlunting            = true,
                    HasDynamicLoad             = false,
                    HasFlangedConnections      = true,
                    WeldingControl             = _weldingControl[2],
                    PaintworkCoeff             = 2,
                },
                new Construction
                {
                    Id            = 5,
                    Specification = _specifications[2],
                    Name          = "N5",
                    Type          = _constructionTypes[0],
                    Valuation     = "1705",
                    NumOfStandardConstructions = 0,
                    HasEdgeBlunting            = true,
                    HasDynamicLoad             = false,
                    HasFlangedConnections      = true,
                    WeldingControl             = _weldingControl[0],
                    PaintworkCoeff             = 2,
                },
            };

            foreach (var c in _constructions)
            {
                _updateConstructions.Add(new Construction
                {
                    Id            = c.Id,
                    Specification = c.Specification,
                    Name          = c.Name,
                    Type          = c.Type,
                    Subtype       = c.Subtype,
                    Valuation     = c.Valuation,
                    NumOfStandardConstructions = c.NumOfStandardConstructions,
                    HasEdgeBlunting            = c.HasEdgeBlunting,
                    HasDynamicLoad             = c.HasDynamicLoad,
                    HasFlangedConnections      = c.HasFlangedConnections,
                    WeldingControl             = c.WeldingControl,
                    PaintworkCoeff             = c.PaintworkCoeff,
                });
            }
            foreach (var construction in _constructions)
            {
                _repository.Setup(mock =>
                                  mock.GetById(construction.Id, false)).Returns(
                    _constructions.SingleOrDefault(v => v.Id == construction.Id));
                _repository.Setup(mock =>
                                  mock.GetById(construction.Id, true)).Returns(
                    _constructions.SingleOrDefault(v => v.Id == construction.Id));

                _updateRepository.Setup(mock =>
                                        mock.GetById(construction.Id, false)).Returns(
                    _updateConstructions.SingleOrDefault(v => v.Id == construction.Id));
                _updateRepository.Setup(mock =>
                                        mock.GetById(construction.Id, true)).Returns(
                    _updateConstructions.SingleOrDefault(v => v.Id == construction.Id));
            }
            foreach (var specification in _specifications)
            {
                _mockSpecificationRepo.Setup(mock =>
                                             mock.GetById(specification.Id, false)).Returns(
                    _specifications.SingleOrDefault(v => v.Id == specification.Id));
                _mockSpecificationRepo.Setup(mock =>
                                             mock.GetById(specification.Id, true)).Returns(
                    _specifications.SingleOrDefault(v => v.Id == specification.Id));

                _repository.Setup(mock =>
                                  mock.GetAllBySpecificationId(specification.Id)).Returns(
                    _constructions.Where(v => v.Specification.Id == specification.Id));
                _updateRepository.Setup(mock =>
                                        mock.GetAllBySpecificationId(specification.Id)).Returns(
                    _updateConstructions.Where(v => v.Specification.Id == specification.Id));

                foreach (var construction in _constructions)
                {
                    _repository.Setup(mock =>
                                      mock.GetByUniqueKey(
                                          specification.Id, construction.Name, construction.PaintworkCoeff)).Returns(
                        _constructions.SingleOrDefault(
                            v => v.Specification.Id == specification.Id &&
                            v.Name == construction.Name &&
                            v.PaintworkCoeff == construction.PaintworkCoeff));

                    _updateRepository.Setup(mock =>
                                            mock.GetByUniqueKey(
                                                specification.Id, construction.Name, construction.PaintworkCoeff)).Returns(
                        _updateConstructions.SingleOrDefault(
                            v => v.Specification.Id == specification.Id &&
                            v.Name == construction.Name &&
                            v.PaintworkCoeff == construction.PaintworkCoeff));
                }
            }
            foreach (var type in _constructionTypes)
            {
                _mockConstructionTypeRepo.Setup(mock =>
                                                mock.GetById(type.Id)).Returns(
                    _constructionTypes.SingleOrDefault(v => v.Id == type.Id));
            }
            foreach (var subtype in _constructionSubtypes)
            {
                _mockConstructionSubtypeRepo.Setup(mock =>
                                                   mock.GetById(subtype.Id)).Returns(
                    _constructionSubtypes.SingleOrDefault(v => v.Id == subtype.Id));
            }
            foreach (var weldingControl in _weldingControl)
            {
                _mockWeldingControlRepo.Setup(mock =>
                                              mock.GetById(weldingControl.Id)).Returns(
                    _weldingControl.SingleOrDefault(v => v.Id == weldingControl.Id));
            }
            foreach (var mark in _marks)
            {
                _mockMarkRepo.Setup(mock =>
                                    mock.GetById(mark.Id)).Returns(
                    _marks.SingleOrDefault(v => v.Id == mark.Id));
            }

            _repository.Setup(mock =>
                              mock.Add(It.IsAny <Construction>())).Verifiable();
            _updateRepository.Setup(mock =>
                                    mock.Update(It.IsAny <Construction>())).Verifiable();
            _repository.Setup(mock =>
                              mock.Delete(It.IsAny <Construction>())).Verifiable();

            _service = new ConstructionService(
                _repository.Object,
                _mockMarkRepo.Object,
                _mockSpecificationRepo.Object,
                _mockConstructionTypeRepo.Object,
                _mockConstructionSubtypeRepo.Object,
                _mockWeldingControlRepo.Object);
            _updateService = new ConstructionService(
                _updateRepository.Object,
                _mockMarkRepo.Object,
                _mockSpecificationRepo.Object,
                _mockConstructionTypeRepo.Object,
                _mockConstructionSubtypeRepo.Object,
                _mockWeldingControlRepo.Object);
        }
Esempio n. 13
0
 public ExampleConstructionController(IConstructionService constructionService)
 {
     this._constructionService = constructionService;
 }
 public NationalConstructionsViewModel(Entities.Country country, IEnumerable <NationalConstruction> constructions, IConstructionService constructionService)
 {
     Info = new CountryInfoViewModel(country);
     Constructions.AddRange(constructions.Select(c => new NationalConstructionItemViewModel(c, constructionService)));
 }