public EditionController(
     IEditionService editionService,
     IContractService contractService)
 {
     _editionService  = editionService;
     _contractService = contractService;
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.Title = "Client";
            Console.WriteLine("Press any key to connect to server");
            Console.ReadKey();

            // InstanceContext - представляет метод вызываемый сервисом на клиенте.
            InstanceContext context = new InstanceContext(new Context());

            // Создаем фабрику дуплексных каналов на клиенте.
            DuplexChannelFactory <IContractService> factory = new DuplexChannelFactory <IContractService>(
                context,
                new NetTcpBinding(),
                "net.tcp://localhost:9000/MyService"
                );

            // Создаем конкретный канал.
            IContractService server = factory.CreateChannel();


            server.ServerMethod();

            Console.WriteLine("Connected");

            Console.ReadKey();



            Console.ReadKey();
        }
Exemple #3
0
 public SubscriptionController(
     ISubscriptionService subscriptionService,
     IContractService contractService)
 {
     _subscriptionService = subscriptionService;
     _contractService     = contractService;
 }
 public CompanyService(ICitizenService citizenService, IConfigurationRepository configurationRepository,
                       IEquipmentRepository equipmentRepository, IProductService productService, IProductRepository productRepository,
                       ICitizenRepository citizenRepository, ITransactionsService transactionService,
                       IJobOfferService jobOfferService, ICompanyEmployeeRepository companyEmployeeRepository,
                       ICompanyRepository companyRepository, IEntityService entityService, ICompanyManagerRepository companyManagerRepository,
                       IRegionRepository regionRepository, IWarningService warningService, IJobOfferRepository jobOfferRepository,
                       IEquipmentService equipmentService, IContractService contractService, IWalletService walletService, IPopupService popupService,
                       IRegionService regionService, ICompanyFinanceSummaryService companyFinanceSummaryService)
 {
     this.companyRepository         = companyRepository;
     this.entityService             = entityService;
     this.companyManagerRepository  = companyManagerRepository;
     this.jobOfferService           = jobOfferService;
     this.companyEmployeeRepository = companyEmployeeRepository;
     this.citizenRepository         = citizenRepository;
     this.transactionService        = transactionService;
     this.equipmentRepository       = equipmentRepository;
     this.productService            = productService;
     this.productRepository         = productRepository;
     this.citizenService            = Attach(citizenService);
     this.configurationRepository   = configurationRepository;
     this.regionRepository          = regionRepository;
     this.warningService            = Attach(warningService);
     this.jobOfferRepository        = jobOfferRepository;
     this.equipmentService          = Attach(equipmentService);
     this.contractService           = Attach(contractService);
     this.walletService             = Attach(walletService);
     this.popupService  = Attach(popupService);
     this.regionService = Attach(regionService);
     this.companyFinanceSummaryService = Attach(companyFinanceSummaryService);
 }
        public StandardTokenTransferViewModel(IEthereumHostProvider ethereumHostProvider, IContractService contractService, IScreen screenHost)
        {
            this._ethereumHostProvider = ethereumHostProvider;
            this._contractService      = contractService;
            this._screenHost           = screenHost;
            this._contractService.ContractAddress.Subscribe(x => ContractAddress = x);

            this.ValidationRule(x => x.AddressTo, address => Nethereum.UI.Util.Utils.IsValidAddress(address), "Address is not valid");
            this.ValidationRule(x => x.Amount, amount => amount >= 0, "Amount cannot be negative");



            var canExecuteTransaction = this.WhenAnyValue(
                x => x.AddressTo,
                x => x.Amount,
                x => x.ContractAddress,
                (addressTo, amount, contractAddress) =>
                Nethereum.UI.Util.Utils.IsValidAddress(addressTo) &&
                amount != null && amount > 0 &&
                contractAddress != null);

            var canExecuteAndEnabled = Observable.CombineLatest(canExecuteTransaction, _ethereumHostProvider.EnabledCallBack, (valid, enabled) => valid && enabled);

            this._executeTransactionCommand = ReactiveCommand.CreateFromTask(ExecuteAsync, canExecuteAndEnabled);
        }
Exemple #6
0
 public WorksController(IWorkTaskService workTaskService,
                        IContractLogService contractLogService,
                        CurrencySettings currencySettings,
                        ICurrencyService currencyService,
                        IWorkModelFactory workModelFactory,
                        ILocalizationService localizationService,
                        IPermissionService permissionService,
                        IWorkContext workContext,
                        ITaskModelFactory taskModelFactory,
                        IContractModelFactory contractModelFactory,
                        IContractService contractService,
                        GSConfig config,
                        IDataProvider dataProvider,
                        IProcuringAgencyService procuringAgencyService,
                        IDbContext dbContext,
                        IPriceFormatter priceFormatter
                        )
 {
     this._workModelFactory     = workModelFactory;
     this._contractLogService   = contractLogService;
     this._currencySettings     = currencySettings;
     this._localizationService  = localizationService;
     this._workTaskService      = workTaskService;
     this._permissionService    = permissionService;
     this._workContext          = workContext;
     this._taskModelFactory     = taskModelFactory;
     this._contractModelFactory = contractModelFactory;
     this._contractService      = contractService;
     this._currencyService      = currencyService;
     this._config                 = config;
     this._dataProvider           = dataProvider;
     this._procuringAgencyService = procuringAgencyService;
     this._dbContext              = dbContext;
     this._priceFormatter         = priceFormatter;
 }
 public ContractsController(IContractService IContractService, IPipelineService IPipelineService, ILocationService ILocationService, ImetadataRequestTypeService ImetadataRequestTypeService) : base(IPipelineService)
 {
     _IContractService = IContractService;
     //_IPipelineService = IPipelineService;
     _ILocationService            = ILocationService;
     _ImetadataRequestTypeService = ImetadataRequestTypeService;
 }
Exemple #8
0
 public ExchangeContractService(IBaseSettings settings,
                                ICoinTransactionService cointTransactionService, IContractService contractService,
                                ICoinContractFilterRepository coinContractFilterRepository, Func <string, IQueueExt> queueFactory,
                                ICoinRepository coinRepository, IEthereumContractRepository ethereumContractRepository, Web3 web3,
                                ILykkeSigningAPI lykkeSigningAPI,
                                IUserPaymentHistoryRepository userPaymentHistory,
                                ICoinEventService coinEventService,
                                IHashCalculator hashCalculator,
                                IPendingTransactionsRepository pendingTransactionsRepository,
                                ITransferContractService transferContractService)
 {
     _lykkeSigningAPI               = lykkeSigningAPI;
     _web3                          = web3;
     _settings                      = settings;
     _cointTransactionService       = cointTransactionService;
     _contractService               = contractService;
     _coinContractFilterRepository  = coinContractFilterRepository;
     _coinRepository                = coinRepository;
     _userPaymentHistoryRepository  = userPaymentHistory;
     _coinEventService              = coinEventService;
     _hashCalculator                = hashCalculator;
     _pendingTransactionsRepository = pendingTransactionsRepository;
     _transferContractService       = transferContractService;
     _addressUtil                   = new AddressUtil();
 }
Exemple #9
0
 public LykkePayErc20DepositContractService(
     [KeyFilter(Constants.LykkePayKey)] IErc223DepositContractRepository contractRepository,
     [KeyFilter(Constants.LykkePayKey)] IHotWalletOperationRepository operationsRepository,
     IContractService contractService,
     IErc20DepositContractQueueServiceFactory poolFactory,
     IBaseSettings settings,
     ILog log,
     IWeb3 web3,
     AppSettings appSettings,
     IQueueFactory factory,
     IErcInterfaceService ercInterfaceService,
     IUserTransferWalletRepository userTransferWalletRepository)
 {
     _contractRepository = contractRepository;
     _contractService    = contractService;
     _poolFactory        = poolFactory;
     _settings           = settings;
     _log                          = log;
     _web3                         = web3;
     _appSettings                  = appSettings;
     _transferQueue                = factory.Build(Constants.LykkePayErc223TransferQueue);
     _ercInterfaceService          = ercInterfaceService;
     _operationsRepository         = operationsRepository;
     _userTransferWalletRepository = userTransferWalletRepository;
 }
Exemple #10
0
        public ContractList()
        {
            _contractService = DiConfig.Resolve <IContractService>();

            InitializeComponent();

            // Create de Command.
            var changedIndex = new RoutedUICommand("ChangedIndex", "ChangedIndex", typeof(ExportControl));

            // Assing the command to PagingControl Command.
            GridPaging1.ChangedIndexCommand = changedIndex;

            // Binding Command
            var binding = new CommandBinding
            {
                Command = changedIndex
            };

            // Binding Handler to executed.
            binding.Executed += OnChangeIndexCommandHandler;

            CommandBindings.Add(binding);

            ExecuteQuery();
        }
Exemple #11
0
        public WorldService(ICompanyEmployeeRepository companyEmployeeRepository, IContractRepository contractRepository, IContractService contractService,
                            ICitizenRepository citizenRepository, IConfigurationRepository configurationRepository, IEquipmentRepository equipmentRepository,
                            IPartyService partyService, ICongressCandidateService congressCandidateService, ICongressVotingService congressVotingService,
                            ICountryService countryService, IBattleService battleService, IRegionService regionService, ICompanyService companyService,
                            IEmbargoService embargoService, IWarService warService, IEmployeeService employeeService, IMPPService mppService, IWalletService walletService,
                            INewDayRepository newDayRepository, IHotelService hotelService, IHouseService houseService)
        {
            this.citizenRepository         = citizenRepository;
            this.configurationRepository   = configurationRepository;
            this.equipmentRepository       = equipmentRepository;
            this.companyEmployeeRepository = companyEmployeeRepository;
            this.contractRepository        = contractRepository;
            this.contractService           = contractService;
            this.partyService             = partyService;
            this.congressCandidateService = congressCandidateService;
            this.congressVotingService    = congressVotingService;
            this.countryService           = countryService;
            this.battleService            = battleService;
            this.regionService            = regionService;
            this.companyService           = companyService;
            this.embargoService           = embargoService;
            this.warService       = warService;
            this.employeeService  = employeeService;
            this.mppService       = mppService;
            this.walletService    = Attach(walletService);
            this.newDayRepository = newDayRepository;
            this.hotelService     = hotelService;
            this.houseService     = houseService;

            citizenRepository.SetTimeout(300);
            equipmentRepository.SetTimeout(300);
        }
 public UserService(IKeyStoreService keyStore, ILogger <Program> logger, IContractService contractService)
 {
     _keyStoreService = keyStore;
     _logger          = logger;
     _contractService = contractService;
     _logger.LogInformation("User Service initialized");
 }
Exemple #13
0
        public async Task Update_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ContractService Update(ContractServiceModel) method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            this.contractService = new ContractService(context);
            await SeedData(context);

            ContractServiceModel contract = context.Contracts.First().To <ContractServiceModel>();

            contract.NextBillingDueDate = DateTime.Now;
            contract.StartDate          = DateTime.Now;
            contract.Amount             = 10000;
            contract.Frequency          = "ANNUAL";
            contract.Duration           = 12;


            var actualResults = await this.contractService.Update(contract);

            var actualEntry = this.contractService.GetById(contract.Id);

            Assert.True(contract.NextBillingDueDate == actualEntry.NextBillingDueDate, errorMessagePrefix + " " + "NextBillingDueDate is not returned properly.");
            Assert.True(contract.StartDate == actualEntry.StartDate, errorMessagePrefix + " " + "StartDate is not returned properly.");
            Assert.True(contract.Amount == actualEntry.Amount, errorMessagePrefix + " " + "Amount is not returned properly.");
            Assert.True(contract.Frequency == actualEntry.Frequency, errorMessagePrefix + " " + "Frequency is not returned properly.");
            Assert.True(contract.Duration == actualEntry.Duration, errorMessagePrefix + " " + "Duration is not returned properly.");
        }
Exemple #14
0
        public async Task TryToApplyFinancial_ShouldNotApply()
        {
            string errorMessagePrefix = "ContractService TryToApplyFinancial(long contractId) method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            this.contractService = new ContractService(context);

            await SeedData(context);

            var actualResults = this.contractService.GetById(1);
            var contract      = context.Contracts.SingleOrDefault(c => c.Id == 1);

            var moneyIn = new MoneyIn()
            {
                Contract = contract,
                Status   = Data.Models.Financial.Enums.Status.Pending
            };

            context.Add(moneyIn);
            await context.SaveChangesAsync();

            var result = contractService.TryToApplyFinancial(1);

            Assert.True(moneyIn.Status == Data.Models.Financial.Enums.Status.Pending, errorMessagePrefix);
        }
Exemple #15
0
        public async Task Create_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ContractService Create(ContractServiceModel) method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            this.contractService = new ContractService(context);
            await SeedData(context);

            ContractServiceModel newContract = new ContractServiceModel()
            {
                Id            = 4,
                Frequency     = "ANNUAL",
                StartDate     = DateTime.Parse("01/01/2019"),
                Duration      = 10,
                ProductIdntfr = "LIFE1",
                PersonId      = 39,
                DistributorId = 39
            };
            var actualResults = await this.contractService.Create(newContract);

            var actualEntry = this.contractService.GetById(4);

            Assert.True(newContract.Frequency == actualEntry.Frequency, errorMessagePrefix + " " + "Frequency is not returned properly.");
            Assert.True(newContract.StartDate == actualEntry.StartDate, errorMessagePrefix + " " + "StartDate is not returned properly.");
        }
 public ContractController(IRepository <Contract> contractRepository,
                           IRepository <Assignment> assignmentRepository,
                           IRepository <AssignmentHistory> assignmentHistoryRepository,
                           IRepository <Contact> contactRepository,
                           IRepository <ContractTerm> contractTermRepository,
                           IRepository <ContractPriceItem> contractPriceItemRepository,
                           IRepository <WorkOrder> workOrderRepository,
                           IRepository <PreventiveMaintenance> pmRepository,
                           IContractService contractService,
                           IAutoNumberService autoNumberService,
                           IDateTimeHelper dateTimeHelper,
                           ILocalizationService localizationService,
                           IPermissionService permissionService,
                           HttpContextBase httpContext,
                           IWorkContext workContext,
                           IDbContext dbContext)
 {
     this._contractRepository          = contractRepository;
     this._assignmentRepository        = assignmentRepository;
     this._assignmentHistoryRepository = assignmentHistoryRepository;
     this._contactRepository           = contactRepository;
     this._contractTermRepository      = contractTermRepository;
     this._contractPriceItemRepository = contractPriceItemRepository;
     this._workOrderRepository         = workOrderRepository;
     this._pmRepository        = pmRepository;
     this._localizationService = localizationService;
     this._contractService     = contractService;
     this._autoNumberService   = autoNumberService;
     this._dateTimeHelper      = dateTimeHelper;
     this._permissionService   = permissionService;
     this._httpContext         = httpContext;
     this._workContext         = workContext;
     this._dbContext           = dbContext;
 }
        public decimal CalculateAnnualHourlySalary(decimal hourlySalary)
        {
            IContractService contract = ContractCreator.Create(ContractCreator.HourlySalary);
            decimal          salary   = contract.CalculateAnnualSalary(hourlySalary);

            return(salary);
        }
Exemple #18
0
        public async Task GetAllContracts_WithDummyData_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ContractService GetAllContracts() method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.contractService = new ContractService(context);

            List <ContractServiceModel> actualResults = await this.contractService.GetAllContracts().ToListAsync();

            List <ContractServiceModel> expectedResults = GetDummyDataContract().To <ContractServiceModel>().ToList();

            for (int i = 0; i < expectedResults.Count; i++)
            {
                var expectedEntry = expectedResults[i];
                var actualEntry   = actualResults[i];

                Assert.True(expectedEntry.Frequency == actualEntry.Frequency, errorMessagePrefix + " " + "Frequency is not returned properly.");
                Assert.True(expectedEntry.Amount == actualEntry.Amount, errorMessagePrefix + " " + "Amount is not returned properly.");
                Assert.True(expectedEntry.PremiumAmount == actualEntry.PremiumAmount, errorMessagePrefix + " " + "PremiumAmount is not returned properly.");
                Assert.True(expectedEntry.NextBillingDueDate == actualEntry.NextBillingDueDate, errorMessagePrefix + " " + "NextBillingDueDate is not returned properly.");
                Assert.True(expectedEntry.StartDate == actualEntry.StartDate, errorMessagePrefix + " " + "StartDate Type is not returned properly.");
            }
        }
Exemple #19
0
 public Form1(ContosoConsultancyServiceProxy contosoConsultancyServiceProxy, IContractService contractService, IPdfService pdfService)
 {
     InitializeComponent();
     this.contosoConsultancyServiceProxy = contosoConsultancyServiceProxy;
     this.contractService = contractService;
     this.pdfService      = pdfService;
 }
        public decimal CalculateAnnualMonthlySalary(decimal monthlySalary)
        {
            IContractService contract = ContractCreator.Create(ContractCreator.MonthlySalary);
            decimal          salary   = contract.CalculateAnnualSalary(monthlySalary);

            return(salary);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ContractController"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="contractService">The contract service.</param>
 public ContractController(
     ILoggerAdapter <ContractController> logger,
     IContractService contractService)
 {
     _logger          = logger;
     _contractService = contractService;
 }
 public OrganizerMusicianContractsController(IOrganizerService organizerService, IMusicianService musicianService, IContractService contractService, IMapper mapper)
 {
     _organizerService = organizerService;
     _musicianService  = musicianService;
     _contractService  = contractService;
     _mapper           = mapper;
 }
Exemple #23
0
 public ContractController(IContractService contractService,
                           IOrganizationMarketer marketer,
                           IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _marketer        = marketer;
     _contractService = contractService;
 }
 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;
 }
 public ContractsController(IOptions <ApplicationConfiguration> config,
                            IContractService contractService,
                            ILogger <ContractsController> logger)
 {
     _config          = config;
     _contractService = contractService;
     _logger          = logger;
 }
 public ContractController(IContractService contractService, IProductService productService, IPremiumService premiumService, IMoneyInService moneyInService, IClaimActivityService claimActivityService)
 {
     this.contractService      = contractService;
     this.productService       = productService;
     this.premiumService       = premiumService;
     this.moneyInService       = moneyInService;
     this.claimActivityService = claimActivityService;
 }
 private void CreateContractService()
 {
     if (_contractService == null)
     {
         var userId = Guid.Parse(User.Identity.GetUserId());
         _contractService = new ContractService(userId);
     }
 }
 public ContractController(IContractService contractService,
                           IJobPartDictionaryService jobPartDictionaryService,
                           IEmployeeService employeeService)
 {
     _contractService          = contractService;
     _jobPartDictionaryService = jobPartDictionaryService;
     _employeeService          = employeeService;
 }
Exemple #29
0
 public ContractsViewModel(IConfigService configService, INotificationService notificationService, IDialogService dialogService, IContractService contractsService, INavigationService navigationService)
 {
     _notificationService = notificationService;
     _dialogService       = dialogService;
     _navigationService   = navigationService;
     _contractsService    = contractsService;
     _configService       = configService;
 }
Exemple #30
0
        // This constructor is used in the Windows Phone app at design time,
        // for the Blend visual designer.

        public ContractsViewModel()
        {
            if (IsInDesignMode)
            {
                _contractsService = new DesignContractsService();
                GetCountries();
            }
        }
        // This constructor is used in the Windows Phone app at design time,
        // for the Blend visual designer.

        public ContractsViewModel()
        {
            if (IsInDesignMode)
            {

                _contractsService = new DesignContractsService();
                GetCountries();
            }
        }
Exemple #32
0
 public GeneralController(ICompanyService companyService, IUserService userService, IPositionService positionService,IEmployeeService employeeService, IContractService contractService,ISalaryService salaryService)
 {
     this.userService = userService;
     this.companyService = companyService;
     this.positionService = positionService;
     this.employeeService = employeeService;
     this.contractService = contractService;
     this.salaryService = salaryService;
 }
        public ContractsViewModel(IConfigService configService, INotificationService notificationService, IDialogService dialogService, IContractService contractsService, INavigationService navigationService)
        {
            _notificationService = notificationService;
            _dialogService = dialogService;
            _navigationService = navigationService;
            _contractsService = contractsService;
            _configService = configService;

        }
Exemple #34
0
 public EmployeeController(UserManager<ApplicationUser> UserManager, IExperienceService experienceService, ISalaryService salaryService, IEmployeeService employeeService, ICompanyService companyService, ITerminateService terminateService, IPositionService positionService, IContractService contractService, IInsuranceService insuranceService)
 {
     this.employeeService = employeeService;
     this.companyService = companyService;
     this.terminateService = terminateService;
     this.positionService = positionService;
     this.contractService = contractService;
     this.insuranceService = insuranceService;
     this.salaryService = salaryService;
     this.experienceService = experienceService;
     this.userManager = UserManager;
 }
Exemple #35
0
 /// <summary>
 /// 将回调通道加入到通道列表中进行管理
 /// </summary>
 /// <param name="callbackChannel"></param>
 public void Add(IContractService callbackChannel)
 {
     if (callbackChannelList.Contains(callbackChannel))
     {
         Console.WriteLine("已存在重复通道");
     }
     else
     {
         lock (SyncObj)
         {
             callbackChannelList.Add(callbackChannel);
             Console.WriteLine("添加了新的通道");
         }
     }
 }
Exemple #36
0
 /// <summary>
 /// 从通道列表中移除对一个通道的管理
 /// </summary>
 /// <param name="callbackChannel"></param>
 public void Remove(IContractService callbackChannel)
 {
     if (!callbackChannelList.Contains(callbackChannel))
     {
         Console.WriteLine("不存在待移除通道");
     }
     else
     {
         lock (SyncObj)
         {
             callbackChannelList.Remove(callbackChannel);
             Console.WriteLine("移除了一个通道");
         }
     }
 }
        public StationRenderer(Context context, GoogleMap map,
                             ClusterManager clusterManager) : base(context, map, clusterManager)
        {
            _context = context;
            _map = map;
            _clusterManager = clusterManager;
            _contractService = SimpleIoc.Default.GetInstance<IContractService>();
            _settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();

            _iconGenRed = new IconGenerator(_context);
            _iconGenGreen = new IconGenerator(_context);
            _iconGenOrange = new IconGenerator(_context);
            _iconGenGrey = new IconGenerator(_context);
            _iconGenGreyLowAlpha = new IconGenerator(_context);
            //// Define the size you want from dimensions file
            //var shapeDrawable = ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.station, null);
            //iconGen.SetBackground(shapeDrawable);
            ////// Create a view container to set the size
            _iconGenRed.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationRed, null));
            _iconGenOrange.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationOrange, null));
            _iconGenGreen.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreen, null));
            _iconGenGrey.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGrey, null));
            _iconGenGreyLowAlpha.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreyAlpha, null));

            _iconRed = _iconGenRed.MakeIcon();
            _iconGreen = _iconGenGreen.MakeIcon();
            _iconOrange = _iconGenOrange.MakeIcon();
            _iconGrey = _iconGenGrey.MakeIcon();
            _iconGreyLowAlpha = _iconGenGreyLowAlpha.MakeIcon();

            var textView = new TextView(context);
            textView.SetTextAppearance(_context, Resource.Style.iconGenText);
            _textPaint.AntiAlias = true;
            _textPaint.SetARGB(255, 0, 0, 0);
            _textPaint.TextSize = textView.TextSize;
            _textPaint.TextAlign = Paint.Align.Center;
            //_textPaint.SetTypeface(textView.Typeface);
            _textPaint.SetTypeface(Typeface.CreateFromAsset(_context.Assets, "fonts/Roboto-Bold.ttf"));

        }
Exemple #38
0
 public InvoicingService(IInvoiceRepository invoiceRepository, IAccountRepository accountRepository, 
     IPlanRepository planRepository, INetworkRepository networkRepository, IContractRepository contractRepository, IContactRepository contactRepository,
     ICompanyRepository companyRepository, INumberGeneratorService numberGeneratorService,
     ISettingRepository settingRepository, ICustomFeeRepository customFeeRepository, IInvoiceHardcopyRepository hardcopyRepository, IContractService contractService,
     IInvoiceSettings invoiceSettings, IEwayPaymentsService ewayPaymentsService, IDateTimeFacade dateTime)
 {
     _invoiceRepository = invoiceRepository;
     _accountRepository = accountRepository;
     _planRepository = planRepository;
     _networkRepository = networkRepository;
     _contractRepository = contractRepository;
     _contactRepository = contactRepository;
     _companyRepository = companyRepository;
     _numberGeneratorService = numberGeneratorService;
     _settingRepository = settingRepository;
     _contractService = contractService;
     _customFeeRepository = customFeeRepository;
     _invoiceHardcopyRepository = hardcopyRepository;
     _invoiceSettings = invoiceSettings;
     _ewayPaymentsService = ewayPaymentsService;
     _dateTime = dateTime;
 }
 public ContractsController(IContractService contractService, IContractStatusService contractStatusService)
 {
     _contractService = contractService;
     _contractStatusService = contractStatusService;
 }
        public async void OnMapReady(GoogleMap googleMap)
        {
            _gettingMap = false;
            // TODO TO HELP DEBUG auto download paris to help dev on performances 
            //var contractToTest = "Paris";
            //var contractService = SimpleIoc.Default.GetInstance<IContractService>();
            //var contract = contractService.GetCountries().First(country => country.Contracts.Any(c => c.Name == contractToTest)).Contracts.First(c => c.Name == contractToTest);
            //await SimpleIoc.Default.GetInstance<ContractsViewModel>().AddOrRemoveContract(contract);
            _contractService = SimpleIoc.Default.GetInstance<IContractService>();
            _contractService.ContractRefreshed += OnContractRefreshed;
            _contractService.StationRefreshed += OnStationRefreshed;

            // set the initial visual state of the bike/parking buttons
            SwitchModeStationParkingVisualState();

            _map = googleMap;
            _maxZoom = _map.MaxZoomLevel;

            LoadPreviousTile();

            //Setup and customize your Google Map
            _map.UiSettings.CompassEnabled = true;
            _map.UiSettings.MyLocationButtonEnabled = false;
            _map.UiSettings.MapToolbarEnabled = false;
            _map.MyLocationEnabled = true;

            // add padding to prevent action bar to hide the position button
            //var dp = (int)(48 * Resources.DisplayMetrics.Xdpi / Resources.DisplayMetrics.Density);
            //_map.SetPadding(0, dp, 0, 0);
            //_map.vie
            //View locationButton = suppormanagerObj.getView().findViewById(2);
            //var rlp = (RelativeLayout.LayoutParams)locationButton.getLayoutParams(); 
            //// position on right bottom 
            //rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); 

            // Initialize the camera position
            SetViewPoint(await GetStartingCameraPosition(), false);

            // Initialize the marker with the stations
            _clusterManager = new ClusterManager(this, _map);
            _clusterRender = new StationRenderer(this, _map, _clusterManager);
            _clusterManager.SetRenderer(_clusterRender);

            _map.SetOnCameraChangeListener(_clusterManager);
            // this disable the rest of the event handlers
            // so there is no way to distinct a click on a cluster and a marker 
            _map.MarkerClick += _map_MarkerClick;
            //_map.SetOnMarkerClickListener(new OnMarkerClickListener());
            //_clusterManager.SetOnClusterClickListener(this);
            //_clusterManager.SetOnClusterItemClickListener(this);

            // check if the app contains a least one city, otherwise, tells the user to download one
            MainViewModel.MainPageLoadedCommand.Execute(null);

            // On long click, display the address on a info window
            Observable.FromEventPattern<GoogleMap.MapLongClickEventArgs>(_map, "MapLongClick")
                .Subscribe(e =>
                {
                    AddPlaceMarker(e.EventArgs.Point, null, null);
                    SelectItem(e.EventArgs.Point);
                    //IList<Address> addresses = new List<Address>();
                    //try
                    //{
                    //    // Convert latitude and longitude to an address (GeoCoder)
                    //    addresses = await (new Geocoder(this).GetFromLocationAsync(currentMarkerPosition.Latitude, currentMarkerPosition.Longitude, 1));
                    //}
                    //catch (Exception ex)
                    //{
                    //    Log.Debug("MyActivity", "Geocoder crashed: " + ex.Message);
                    //}
                    //return new AddressesFromLocationDTO { Addresses = addresses, Location = FormatLatLng(e.EventArgs.Point) };

                });
            _map.MapClick += _map_MapClick;


            if (_parameterLat != 0 && _parameterLon != 0)
            {
                ShowIntentLocation();
            }
            else
            {
                // center the map on last user location
                GetPreviousLastUserLocation();
            }





            // Initialize the behavior when long clicking somewhere on the map
            //_map.MapLongClick += async (sender, e) =>
            //{
            //    // On long click, display the address on a info window
            //    if (longClickMarker != null)
            //    {
            //        // Remove a previously created marker
            //        longClickMarker.Remove();
            //    }

            //    IList<Address> addresses = new List<Address>();
            //    currentMarkerPosition = e.Point;
            //    var latLongString = $"(latitude: { Math.Round(currentMarkerPosition.Latitude)}, longitude: { Math.Round(currentMarkerPosition.Longitude, 4)})";
            //    try
            //    {

            //        // Resolve the addresses (can throw an exception)
            //        var task = new Geocoder(this).GetFromLocationAsync(currentMarkerPosition.Latitude, currentMarkerPosition.Longitude, 1);
            //        AddressesFromLocationStream.OnNext(new AddressesFromLocationDTO { AddressesTask = task, Location = currentMarkerPosition });
            //    }
            //    catch (Exception)
            //    {
            //        // Ignore
            //    }
            //    finally
            //    {
            //        AddressesFromLocationStream.OnNext(new AddressesFromLocationDTO { Addresses = addresses, Location = currentMarkerPosition });
            //    }
            //};


            _contractService = SimpleIoc.Default.GetInstance<IContractService>();
            var mapObserver = Observable.FromEventPattern(_map, "CameraChange");
            TaskCompletionSource<bool> tcs;
            mapObserver
                .Do((e) =>
                {
                    if (_map.CameraPosition.Zoom > _maxZoom)
                    {
                        _map.MoveCamera(CameraUpdateFactory.ZoomTo(_maxZoom));
                    }
                    cts.Cancel();
                    cts = new CancellationTokenSource();
                }).Throttle(throttleTime)
                .Select(async x =>
                {
                    var stations = _contractService.GetStations();
                    // some services can provide wrong values in lat or lon... just take care of it
                    foreach (var station in stations.Where(s => s.Location == null))
                    {
                        station.Location = new LatLng(station.Latitude, station.Longitude);
                    }
                    LatLngBounds bounds = null;
                    tcs = new TaskCompletionSource<bool>();
                    RunOnUiThread(() =>
                    {
                        try
                        {
                            // can return null
                            bounds = _map.Projection.VisibleRegion.LatLngBounds;
                        }
                        catch
                        {
                        }
                        tcs.SetResult(true);
                    });

                    await tcs.Task;


                    var collection = new AddRemoveCollection();
                    if (bounds != null)
                    {
                        // extends slightly the bound view
                        // to provide a better experience
                        //bounds = MapHelper.extendLimits(bounds, 1);
                        collection.ToRemove = Items.Where(t => !bounds.Contains((LatLng)t.Location)).ToList();
                        collection.ToAdd = stations.Where(t => !Items.Contains(t)
                        && bounds.Contains((LatLng)t.Location)).Take(MAX_CONTROLS).ToList();
                        if (Items.Count > MAX_CONTROLS + collection.ToRemove.Count)
                            collection.ToAdd.Clear();

                    }
                    // precalculate the items offset (that deffer well calculation)
                    //foreach (var velib in collection.ToAdd)
                    //{
                    //    velib.GetOffsetLocation2(leftCornerLocation, zoomLevel);
                    //}
                    return collection;
                })
                .Switch()
                .Subscribe(x =>
                {
                    if (x == null)
                        return;


                    RunOnUiThread(() =>
                    {
                        RefreshView(x, cts.Token);
                    });

                });
        }
 public ContractController(IContractService contractService)
     : base()
 {
     this.contractService = contractService;
 }
 public DefaultContractServiceTests()
 {
     this.Service = new DefaultConventionContractService();
 }
Exemple #43
0
 public ContractController(ICustomerService customerService,
     IContractService contractService,
     IDocumentService documentService)
 {
     _customerService = customerService;
     _contractService = contractService;
     _documentService = documentService;
 }
 public ConventionContractServiceTests()
 {
     this.Service = new ConventionContractService();
 }