示例#1
0
        private async void Save()
        {
            var repo          = new ConfigurationRepository();
            var configuracion = new Configuration()
            {
                Working    = SelectedWorking,
                ShortBreak = SelectedShortBreaks,
                LongBreak  = SelectedLongBreaks,
                Pomorodos  = SelectedPomodoros
            };

            try
            {
                repo.SaveAsync(configuracion);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
                await dialogService.DisplayAlertAsync(Languages.Pomodoro, Languages.ErrorSaveconfiguration, Languages.Accept);

                return;
            }

            await dialogService.DisplayAlertAsync(Languages.Pomodoro, Languages.SuccessSaveConfiguration, Languages.Accept);
        }
 public ResultsModel(Daedalic.ProductDatabase.Data.DaedalicProductDatabaseContext context, InsightsService insightsService,
                     ConfigurationRepository configurationRepository)
 {
     _context                 = context;
     _insightsService         = insightsService;
     _configurationRepository = configurationRepository;
 }
示例#3
0
        public void LoadUserConfigurationTest()
        {
            // Arrange
            // Create a new data-access repository, which implements the Domain IUserConfigRepository
            Domain.Interfaces.Repositories.IUserConfigRepository userConfigRepo = new ConfigurationRepository();

            // Act
            userConfigRepo.SaveUserConfiguration(_userConfig.ConfigFilename, _userConfig);

            // Assert
            // Verify that file was created
            bool doesfilExit = File.Exists(_userConfig.ConfigFilename);

            // Validate that file exists
            Assert.IsTrue(doesfilExit);

            // Act: Load file
            Domain.Dto.UserConfiguration userConfi2 = userConfigRepo.LoadUserConfiguration(_userConfig.ConfigFilename);

            // Assert:
            // Validate that returning oopbjet is not null
            Assert.IsNotNull(userConfi2);
            // Validate that the configuration was loaded properly
            Assert.AreEqual(_userConfig.ConfigFilename, userConfi2.ConfigFilename);
            Assert.AreEqual(2, _userConfig.ConfigItems.Count);
        }
示例#4
0
 public ConfigurationRepositoryTests()
 {
     _inMemoryStorageAdapter  = new InMemoryStorageAdapter();
     _configurationRepository =
         new ConfigurationRepository(_inMemoryStorageAdapter, NullLogger <ConfigurationRepository> .Instance);
     _token = CancellationToken.None;
 }
        public void UT_Configuration_GetById()
        {
            var configurationRepository = new ConfigurationRepository();
            var config = configurationRepository.GetConfigurationById(1);

            Assert.IsNotNull(config);
        }
 static LocalFileConfigurationManager()
 {
     if (_Repository == null)
     {
         _Repository = new ConfigurationRepository();
     }
 }
 protected virtual void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     Rg.Plugins.Popup.Popup.Init((Context)this, bundle);
     Xamarin.Essentials.Platform.Init((Activity)this, bundle);
     FormsAppCompatActivity.set_ToolbarResource(2131427436);
     FormsAppCompatActivity.set_TabLayoutResource(2131427435);
     Application.set_Current(((IMvxFormsViewPresenter)Mvx.get_IoCProvider().GetSingleton <IMvxFormsViewPresenter>()).get_FormsApplication());
     FormsAppCompatActivity.set_ToolbarResource(2131427436);
     FormsAppCompatActivity.set_TabLayoutResource(2131427435);
     MainActivity.instance = this;
     CrossCurrentActivity.get_Current().set_Activity((Activity)this);
     CachedImageRenderer.Init(new bool?(false));
     CrossMobileAnalytics.Current.Register <GoogleMobileAnalyticsProvider>();
     CrossMobileAnalytics.Current.Register <HockeyAppMobileAnalyticsProvider>();
     if (((Activity)this).get_Intent().get_Data() != null)
     {
         ConfigurationRepository.SetEnvironment(((Activity)this).get_Intent().get_Data().ToString());
         if (Settings.Environment != ConfigurationRepository.EnvironmentSetting.Environment)
         {
             Settings.Reset();
         }
     }
     ProtectedAppsChecker.CheckProtectedAppsFeature((Context)this);
 }
示例#8
0
        private static void TriggerAlerts(string source, string target, Models.Rate rate90, Models.Rate rate4, Models.Rate rateRsi, Models.Rate last)
        {
            MessengerMessageSender  sender     = new MessengerMessageSender(new JsonMessengerSerializer());
            ConfigurationRepository repository = new ConfigurationRepository();

            //if (rateRsi.Value < 30)
            {
                var configs = repository.Get().Result;
                foreach (var config in configs)
                {
                    if (config.Source == source && config.Target == target)
                    {
                        var userId    = config.FacebookId;
                        var recipient = new MessengerUser();
                        recipient.Id = userId;
                        var configId = config.Id.ToString();
                        var response = new MessengerMessage();
                        response.Attachment         = new MessengerAttachment();
                        response.Attachment.Type    = "template";
                        response.Attachment.Payload = new MessengerPayload();
                        response.Attachment.Payload.TemplateType = "button";
                        response.Attachment.Payload.Text         = $"hi, we have found a good rate for your transfer: {source} to {target} is now {last.Value}. Tap the button below to do the transfer";
                        response.Attachment.Payload.Buttons      = new List <MessengerButton>();
                        var linkButton = new MessengerButton();
                        linkButton.Url   = $"https://transfer-buddy.herokuapp.com/Transfers/Create?configId={config.Id}";
                        linkButton.Title = "Transfer";
                        linkButton.Type  = "web_url";
                        response.Attachment.Payload.Buttons.Add(linkButton);
                        sender.SendAsync(response, recipient, "EAAaZCDGRPBJ4BAMVFRSRvqM8ytvC6ZAZCryE6xw5GImYZByvVpkIDhSpltas8CuclkcqZClTneXVzwMQqTeZCS5Gs3lf0sCLpiy977fg6bkGuNEESUysoPKKeJNGuW9WDZARKRw45J14A9BcustEzBsIvmbrUZCtVgZAohzKtG0w5DgZDZD").Wait();
                    }
                }
            }
        }
 static ServiceConfigurationManager()
 {
     if (_Repository == null)
     {
         _Repository = new ConfigurationRepository();
     }
 }
示例#10
0
        public override Response Execute()
        {
            // If we're already initialized (Test path)
            if (this.postInstallService != null)
            {
                return(this.ExecutePdb());
            }

            var logger              = new TextLogger();
            var connectionFactory   = new HelperConnectionFactory(this.Helper);
            var agentRepository     = new AgentRepository(connectionFactory);
            var agentManager        = this.Helper.GetServicesManager().CreateProxy <IAgentManager>(ExecutionIdentity.System);
            var agentManagerService = new AgentManagerService(agentManager, agentRepository, logger);

            var textLogger = new TextLogger();
            var resourceServerRepository = new ResourceServerRepository(connectionFactory);
            var refreshServerService     = new RefreshServerService(textLogger, resourceServerRepository);
            var serverRepository         = new ServerRepository(connectionFactory);
            var configurationRepository  = new ConfigurationRepository(connectionFactory);

            this.postInstallService = new PostInstallService(agentManagerService, refreshServerService, serverRepository, configurationRepository, logger);

            var response = this.ExecutePdb();

            agentManager?.Dispose();
            return(response);
        }
 static ServiceConfigurationManager()
 {
     if (_Repository == null)
     {
         _Repository = new ConfigurationRepository();
     }
 }
示例#12
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ConfigureService.ConfigureDependeciesService(services);
            ConfigurationRepository.ConfigureDependeciesRepository(services);
            ConfigurationContext.ConfigureDependeciesContext(services);

            var signingConfiguration = new SigningConfiguration();

            services.AddSingleton(signingConfiguration);

            var tokenConfiguration = new TokenConfiguration();

            new ConfigureFromConfigurationOptions <TokenConfiguration>(Configuration.GetSection("TokenConfiguration")).Configure(tokenConfiguration);

            services.AddSingleton(tokenConfiguration);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Api em .net core ", Description = "Projeto utilizado para fins didáticos", Version = "v1", Contact = new OpenApiContact
                    {
                        Name = "Uigor Silva Fonseca",
                        Url  = new Uri("https://github.com/uigormarshall")
                    }
                });
            });
            services.AddControllers();
        }
示例#13
0
        public void RemoveTasks(int workflowConfigurationId)
        {
            var workflowConfiguration = GetConfiguration(workflowConfigurationId);

            workflowConfiguration.RemoveTasks();
            ConfigurationRepository.Update(workflowConfiguration);
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseSwagger(c =>
            {
                c.SerializeAsV2 = true;
            });

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });

            app.UseRouting();

            app.UseAuthorization();

            app.UseGlobalExceptionHandler(loggerFactory);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            ConfigurationRepository.BSONMap();
        }
 static DatabaseConfigManager()
 {
     if (_Repository == null)
     {
         _Repository = new ConfigurationRepository();
     }
 }
示例#16
0
        public void Setup()
        {
            _keys = GetKeys();
            var client = new LexalyticsRepositoryClient(_keys);

            _sut = new ConfigurationRepository(_keys, client);
        }
示例#17
0
        public void Save()
        {
            try
            {
                ConfigurationRepository.InsertOrUpdate(new ConfigurationModel
                {
                    IdConfiguration       = Guid.Empty,
                    IdMotorizedCardReader = SelectedMotorizedCardReader.Value.IdMotorizedCardReader
                });
                SnackBarMessage("Configuração atualizada!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                SnackBarMessage("Erro ao atualizar configuração!");
            }

            try
            {
                Framework.MotorizedCardReader.Instance(SelectedMotorizedCardReader.Value);
                Framework.MotorizedCardReader.Instance().MovePosition(0x2E);
                Framework.MotorizedCardReader.Instance().MovePosition(0x31);

                SnackBarMessage("Comando enviado para o dispositivo!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                SnackBarMessage("Não foi possível enviar o comando para o dispositivo!");
            }
        }
示例#18
0
        public HomeViewModel()
        {
            var configuration = ConfigurationRepository.GetConfiguration();
            var listMCR       = MotorizedCardReaderRepository.GetAll();
            var selectedMCR   = listMCR.Where(m => m.IdMotorizedCardReader == configuration?.IdMotorizedCardReader).FirstOrDefault();

            SelectedMotorizedCardReader = new ReactiveProperty <MotorizedCardReaderModel>(selectedMCR);
            SelectedMotorizedCardReader.PropertyChanged += (_, e) => Save();

            Name = new ReactiveProperty <string>().SetValidateAttribute(() => Name);
            MotorizedCardReaderCollection = listMCR.ToObservable().ToReadOnlyReactiveCollection();
            BautRateCollection            = new ReactiveCollection <int>()
            {
                9600, 19200, 38400, 115200
            };
            PortCollection = Observable.Range(1, 30)
                             .Select(i => $"COM{i}")
                             .ToReadOnlyReactiveCollection();

            SaveCommand = new[]
            {
                Name.ObserveHasErrors
            }
            .CombineLatestValuesAreAllFalse()
            .ToReactiveCommand(false)
            .WithSubscribe(Save);
        }
示例#19
0
        private void TouchIt()
        {
            var repo = new ConfigurationRepository();

            repo.TouchSqlServer();
            Debug.Log("Successfull sql server touch");
        }
示例#20
0
 static DatabaseConfigManager()
 {
     if (_Repository == null)
     {
         _Repository = new ConfigurationRepository();
     }
 }
        public async void RetrieveParameter_Scenario_RetrievesCorrectParameter()
        {
            // arrange
            var _ssmClient = new Mock <IAmazonSimpleSystemsManagement>();
            var param      = new Parameter();

            param.Name  = "test";
            param.Value = "test_value";
            var parametersResponse = new GetParametersResponse();

            parametersResponse.Parameters.Add(param);
            var paramsList = new List <string>()
            {
                "test"
            };

            _ssmClient.Setup(
                ssm => ssm.GetParametersAsync(It.IsAny <GetParametersRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(parametersResponse);

            var configurationRepository = new ConfigurationRepository(_ssmClient.Object);

            // Act
            var response = await configurationRepository.RetrieveParameters(paramsList);


            // Assert
            Assert.Equal("test_value", response[response.FindIndex(p => p.Name == "test")].Value);
        }
 static LocalFileConfigurationManager()
 {
     if (_Repository == null)
     {
         _Repository = new ConfigurationRepository();
     }
 }
示例#23
0
        public void RemoveTask(int workflowConfigurationId, string workflowTaskId)
        {
            var workflowConfiguration = GetConfiguration(workflowConfigurationId);

            workflowConfiguration.RemoveTask(new Guid(workflowTaskId));
            ConfigurationRepository.Update(workflowConfiguration);
        }
示例#24
0
        private void LoadNamedConfig(string configName)
        {
            try
            {
                if (_rootOfCreation != null)
                {
                    Object.Destroy(_rootOfCreation);
                }

                var configurationRepository = new ConfigurationRepository();
                var config = configurationRepository.LoadConfigByName(configName);
                //var config = Mother.CreateSimpleConf();
                if (config == null)
                {
                    print("could not load configuration" + configurationName);
                    return;
                }
                config.RootElement.GameObject      = this.gameObject;
                config.RootElement.GameObject.name = config.Name;
                ConfigurationHelper.CurrentConfig  = config;
                _rootOfCreation = CreateConfElement(config.RootElement, config.RootElement.GameObject);
            }
            catch (Exception exception)
            {
                Debug.LogException(exception, this.gameObject);
                Debug.LogError("error loading " + exception.Message, this.gameObject);
            }
        }
示例#25
0
 public DetailsModel(Daedalic.ProductDatabase.Data.DaedalicProductDatabaseContext context, IConfiguration config,
                     ConfigurationRepository configurationRepository)
 {
     _context = context;
     _config  = config;
     _configurationRepository = configurationRepository;
 }
示例#26
0
        public static async Task Converts_raw_data_to_configuration()
        {
            var mockDatabaseProvider = new Mock <IDatabaseProvider>(MockBehavior.Strict);

            var rawData = new Dictionary <string, string>
            {
                { "nearbyDistance", "3.5" },
                { "shortLeadTimeSpaces", "2" },
                { "totalSpaces", "9" }
            };

            mockDatabaseProvider
            .Setup(p => p.GetConfiguration())
            .ReturnsAsync(RawItem.CreateConfiguration(rawData));

            var configurationRepository = new ConfigurationRepository(mockDatabaseProvider.Object);

            var result = await configurationRepository.GetConfiguration();

            Assert.NotNull(result);

            Assert.Equal(3.5m, result.NearbyDistance);
            Assert.Equal(2, result.ShortLeadTimeSpaces);
            Assert.Equal(9, result.TotalSpaces);
        }
示例#27
0
        public OctopusAsyncRepository(IOctopusAsyncClient client, RepositoryScope repositoryScope = null)
        {
            Client                    = client;
            Scope                     = repositoryScope ?? RepositoryScope.Unspecified();
            Accounts                  = new AccountRepository(this);
            ActionTemplates           = new ActionTemplateRepository(this);
            Artifacts                 = new ArtifactRepository(this);
            Backups                   = new BackupRepository(this);
            BuiltInPackageRepository  = new BuiltInPackageRepositoryRepository(this);
            CertificateConfiguration  = new CertificateConfigurationRepository(this);
            Certificates              = new CertificateRepository(this);
            Channels                  = new ChannelRepository(this);
            CommunityActionTemplates  = new CommunityActionTemplateRepository(this);
            Configuration             = new ConfigurationRepository(this);
            DashboardConfigurations   = new DashboardConfigurationRepository(this);
            Dashboards                = new DashboardRepository(this);
            Defects                   = new DefectsRepository(this);
            DeploymentProcesses       = new DeploymentProcessRepository(this);
            Deployments               = new DeploymentRepository(this);
            Environments              = new EnvironmentRepository(this);
            Events                    = new EventRepository(this);
            FeaturesConfiguration     = new FeaturesConfigurationRepository(this);
            Feeds                     = new FeedRepository(this);
            Interruptions             = new InterruptionRepository(this);
            LibraryVariableSets       = new LibraryVariableSetRepository(this);
            Lifecycles                = new LifecyclesRepository(this);
            MachinePolicies           = new MachinePolicyRepository(this);
            MachineRoles              = new MachineRoleRepository(this);
            Machines                  = new MachineRepository(this);
            Migrations                = new MigrationRepository(this);
            OctopusServerNodes        = new OctopusServerNodeRepository(this);
            PerformanceConfiguration  = new PerformanceConfigurationRepository(this);
            PackageMetadataRepository = new PackageMetadataRepository(this);
            ProjectGroups             = new ProjectGroupRepository(this);
            Projects                  = new ProjectRepository(this);
            ProjectTriggers           = new ProjectTriggerRepository(this);
            Proxies                   = new ProxyRepository(this);
            Releases                  = new ReleaseRepository(this);
            RetentionPolicies         = new RetentionPolicyRepository(this);
            Schedulers                = new SchedulerRepository(this);
            ServerStatus              = new ServerStatusRepository(this);
            Spaces                    = new SpaceRepository(this);
            Subscriptions             = new SubscriptionRepository(this);
            TagSets                   = new TagSetRepository(this);
            Tasks                     = new TaskRepository(this);
            Teams                     = new TeamsRepository(this);
            Tenants                   = new TenantRepository(this);
            TenantVariables           = new TenantVariablesRepository(this);
            UserInvites               = new UserInvitesRepository(this);
            UserRoles                 = new UserRolesRepository(this);
            Users                     = new UserRepository(this);
            VariableSets              = new VariableSetRepository(this);
            Workers                   = new WorkerRepository(this);
            WorkerPools               = new WorkerPoolRepository(this);
            ScopedUserRoles           = new ScopedUserRoleRepository(this);
            UserPermissions           = new UserPermissionsRepository(this);

            loadRootResource      = new Lazy <Task <RootResource> >(LoadRootDocumentInner, true);
            loadSpaceRootResource = new Lazy <Task <SpaceRootResource> >(LoadSpaceRootDocumentInner, true);
        }
示例#28
0
        public void Configuration(IAppBuilder app)
        {
            // Map Dashboard to the `http://<your-app>/hangfire` URL.
            //ConnectionService.SetConnectionString();
            var connectionFactory = new HelperConnectionFactory(ConnectionHelper.Helper());
            var configurationRepo = new ConfigurationRepository(connectionFactory);
            var queuePollInterval =
                Math.Max(
                    configurationRepo.ReadValue <int>(ConfigurationKeys.QueuePollInterval) ?? Defaults.Queuing.DefaultQueuePollInterval,
                    Defaults.Queuing.MinQueuePollInterval);
            var sqlHangfireOptions = new SqlServerStorageOptions
            {
                QueuePollInterval = TimeSpan.FromSeconds(queuePollInterval)
            };

            using (var conn = connectionFactory.GetEddsPerformanceConnection())
            {
                GlobalConfiguration.Configuration.UseSqlServerStorage(conn.ConnectionString, sqlHangfireOptions);
            }

            var options = new DashboardOptions
            {
                AppPath       = VirtualPathUtility.ToAbsolute("~"),
                Authorization = new[] { new AuthenticateUserAttribute() }
            };

            app.UseHangfireDashboard("/hangfire", options);
        }
示例#29
0
        public JsonResult GetConfig(string sortBy)
        {
            var repo   = new ConfigurationRepository(_appSettings);
            var config = repo.GetConfiguration();

            return(Json(config.ToString()));
        }
示例#30
0
        public void RemoveTransition(int workflowConfigurationId, string sourceWorkflowTaskId, string name)
        {
            var workflowConfiguration = GetConfiguration(workflowConfigurationId);

            workflowConfiguration.RemoveTransition(name, new Guid(sourceWorkflowTaskId));
            ConfigurationRepository.Update(workflowConfiguration);
        }
        public ImportDataService()
        {
            _exportDataService = new ExportDataService();

            _crmRepository                     = new CRMRepository();
            _eventRepository                   = new EventRepository();
            _configurationRespository          = new ConfigurationRepository();
            _hostedControlRepository           = new HostedControlRepository();
            _entityTypeRepository              = new EntityTypeRepository();
            _scriptletRepository               = new ScriptletRepository();
            _importResults                     = new List <ImportResult>();
            _entitySearchRepository            = new EntitySearchRepository();
            _sessionLineRepository             = new SessionLineRepository();
            _optionRepository                  = new OptionRepository();
            _actionRepository                  = new ActionRepository();
            _actionCallrepository              = new ActionCallRepository();
            _subActionCallsRepository          = new SubActionCallsRepository();
            _eventActionCallRepository         = new EventActionCallRepository();
            _toolbarRepository                 = new ToolbarRepository();
            _toolbarButtonRepository           = new ToolbarButtonRepository();
            _toolbarButtonActionCallRepository = new ToolbarButtonActionCallRepository();
            _toolbarHostedControlRepository    = new ToolbarHostedControlRepository();
            _wnrRepository                     = new WNRRepository();
            _wnrActionCallrepository           = new WNRActionCallRepository();
            _agentScriptTaskRepository         = new AgentScriptTaskRepository();
            _taskActionCallRepository          = new TaskActionCallRepository();
            _taskAnswerRepository              = new TaskAnswerRepository();
            _agentScriptAnswerRepository       = new AgentScriptAnswerRepository();
            _answerActionCallRepository        = new AnswerActionCallrepository();
        }
        public ReservationsController(IService service, IMeetingsScheduler meetingsScheduler)
        {
            this._service               = service;
            this._meetingsScheduler     = meetingsScheduler;
            this._officeRepository      = RepositoryFactory.GetConfigurationRepository <Office>(this._service);
            this._roomRepository        = RepositoryFactory.GetConfigurationRepository <Room>(this._service);
            this._reservationRepository = RepositoryFactory.GetConfigurationRepository <Reservation>(this._service);

            allOffices      = this._officeRepository.GetAll <Office>().OrderBy(x => x.OfficeId).ToList();
            allRooms        = this._roomRepository.GetAll <Room>().OrderBy(x => x.RoomId).ToList();
            allReservations = this._reservationRepository.GetAll <Reservation>().OrderBy(x => x.CreationDate).ToList();

            reservationViewModel = new ReservationViewModel();
            reservationViewModel.allReservations = this.allReservations;
            reservationViewModel.allOffices      = this.allOffices;
            reservationViewModel.allRooms        = this.allRooms;

            reservationViewModel.offices = new SelectList(
                this.allOffices.Select(x => new { Id = x.OfficeId, Value = x.City }),
                "Id",
                "Value");

            reservationViewModel.rooms = new SelectList(
                this.allRooms.Select(x => new { Id = x.RoomId, Value = x.RoomName }),
                "Id",
                "Value");
        }
        /// <summary>
        /// Sends the mail.
        /// </summary>
        /// <param name="toEmail">To email.</param>
        /// <param name="attachments">The attachments.</param>
        /// <returns></returns>
        public static bool sendMail(string toEmail, List <Attachment> attachments)
        {
            try
            {
                //get Configuration System from Configuration table in database

                var config = new ConfigurationRepository().GetConfiguration();

                int numOfGroup        = (int)(Math.Ceiling((decimal)attachments.Count / (decimal)Constant.MAX_NUMBER_OF_ATTACH_PER_EMAIL));
                int attachmentPointer = 0;

                //mail configuration
                MailMessage message      = new MailMessage();
                string      fromEmail    = config.FromEmail;
                string      fromPassword = config.FromPassword;
                message.From = new MailAddress(fromEmail);
                message.To.Add(toEmail);
                message.Subject = Constant.EMAIL_SUBJECT;
                message.Body    = Constant.EMAIL_BODY_IF_FOUND_RECORDS;
                message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

                using (SmtpClient smtpClient = new SmtpClient(config.EmailHost, config.EmailPort))
                {
                    smtpClient.EnableSsl             = true;
                    smtpClient.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    smtpClient.UseDefaultCredentials = true;
                    smtpClient.Credentials           = new NetworkCredential(fromEmail, fromPassword);
                    //in case of no record send message to user that system not found record
                    if (numOfGroup == 0)
                    {
                        message.Body = Constant.EMAIL_BODY_IF_NOT_FOUND_RECORDS;
                        smtpClient.Send(message);
                    }
                    //records were found
                    //prepare attahcment and send
                    else
                    {
                        while (numOfGroup > 0)
                        {
                            for (int i = 0; i < Constant.MAX_NUMBER_OF_ATTACH_PER_EMAIL; i++)
                            {
                                if (attachmentPointer >= attachments.Count)
                                {
                                    break;
                                }
                                message.Attachments.Add(attachments[attachmentPointer++]);
                            }
                            numOfGroup--;
                            smtpClient.Send(message);
                        }
                    }
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public void Should_read_Configuration_from_specified_file_path()
        {
            ConfigurationRepository reposiotryUnderTest = new ConfigurationRepository();
            string configurationFile = "Configs\\NConfigTest.config";

            Configuration readConfiguration =  reposiotryUnderTest.GetFileConfiguration(configurationFile);

            Assert.That(readConfiguration, Is.Not.Null);
        }
        public void Should_cache_Configuration_by_file_paths()
        {
            ConfigurationRepository reposiotryUnderTest = new ConfigurationRepository();
            string configurationFile = "Configs\\NConfigTest.config";

            Configuration readConfiguration = reposiotryUnderTest.GetFileConfiguration(configurationFile);
            Configuration cachedConfiguration = reposiotryUnderTest.GetFileConfiguration(configurationFile);

            Assert.That(cachedConfiguration, Is.SameAs(readConfiguration));
        }
示例#36
0
    public static void SaveCurrent()
    {
        if (CurrentConfig == null)
        {
            Debug.Log("nothing to save");
            return;
        }

        ConfigurationRepository configurationRepository = new ConfigurationRepository();
        configurationRepository.SaveConfiguration(CurrentConfig);
        Debug.Log("saved "+ CurrentConfig.ConfigurationId);
    }
        private void ExtractReferences()
        {
            if (_isAnalyzed) return;
            _settings.Documentation =
                new DocumentationManager(_settings.GenerateDocumentation ? _settings.DocumentationFilePath : null);
            var fluentConfigurationPresents = _settings.ConfigurationMethod != null;
            if (fluentConfigurationPresents)
            {
                var configurationBuilder = new ConfigurationBuilder();
                _settings.ConfigurationMethod(configurationBuilder);
                _configurationRepository = configurationBuilder.Build();
                ConfigurationRepository.Instance = _configurationRepository;

                foreach (var additionalDocumentationPath in _configurationRepository.AdditionalDocumentationPathes)
                {
                    _settings.Documentation.CacheDocumentation(additionalDocumentationPath);
                }
            }

            _allTypes = _settings.SourceAssemblies
                .SelectMany(c => c.GetTypes().Where(d => d.GetCustomAttribute<TsAttributeBase>(false) != null))
                .Union(ConfigurationRepository.Instance.AttributesForType.Keys).Distinct()
                .ToList();

            _allTypesHash = new HashSet<Type>(_allTypes);

            if (_settings.Hierarchical)
            {
                foreach (var type in _allTypesHash)
                {
                    ConfigurationRepository.Instance.AddFileSeparationSettings(type);
                }
            }

            var grp = _allTypes.GroupBy(c => c.GetNamespace(true));
            _namespace = grp.Where(g => !string.IsNullOrEmpty(g.Key)) // avoid anonymous types
                .ToDictionary(k => k.Key, v => v.ToList());

            _settings.SourceAssemblies.Where(c => c.GetCustomAttributes<TsReferenceAttribute>().Any())
                .SelectMany(c => c.GetCustomAttributes<TsReferenceAttribute>())
                .Select(c => string.Format("/// <reference path=\"{0}\"/>", c.Path))
                .Union(
                    ConfigurationRepository.Instance.References.Select(
                        c => string.Format("/// <reference path=\"{0}\"/>", c)))
                .ToList()
                .ForEach(a => _referenceBuilder.AppendLine(a));

            _settings.References = _referenceBuilder.ToString();


            _isAnalyzed = true;
        }
示例#38
0
        private void ExtractReferences()
        {
            if (_isAnalyzed) return;
            _context.Documentation =
                new DocumentationManager(_context.GenerateDocumentation ? _context.DocumentationFilePath : null, _context.Warnings);
            var fluentConfigurationPresents = _context.ConfigurationMethod != null;
            if (fluentConfigurationPresents)
            {
                var configurationBuilder = new ConfigurationBuilder();
                _context.ConfigurationMethod(configurationBuilder);
                _configurationRepository = configurationBuilder.Build();
                ConfigurationRepository.Instance = _configurationRepository;

                foreach (var additionalDocumentationPath in _configurationRepository.AdditionalDocumentationPathes)
                {
                    _context.Documentation.CacheDocumentation(additionalDocumentationPath, _context.Warnings);
                }
            }

            _allTypes = _context.SourceAssemblies
                .SelectMany(c => c.GetTypes().Where(d => d.GetCustomAttribute<TsAttributeBase>(false) != null))
                .Union(ConfigurationRepository.Instance.AttributesForType.Keys).Distinct()
                .ToList();

            _allTypesHash = new HashSet<Type>(_allTypes);

            if (_context.Hierarchical)
            {
                foreach (var type in _allTypesHash)
                {
                    ConfigurationRepository.Instance.AddFileSeparationSettings(type);
                }
            }

            _context.SourceAssemblies.Where(c => c.GetCustomAttributes<TsReferenceAttribute>().Any())
                .SelectMany(c => c.GetCustomAttributes<TsReferenceAttribute>())
                .Select(c => string.Format("/// <reference path=\"{0}\"/>", c.Path))
                .Union(
                    ConfigurationRepository.Instance.References.Select(
                        c => string.Format("/// <reference path=\"{0}\"/>", c)))
                .ToList()
                .ForEach(a => _referenceBuilder.AppendLine(a));

            _context.References = _referenceBuilder.ToString();


            _isAnalyzed = true;
        }
 public ConfigurationService(ConfigurationRepository repository)
  {
      this.repository = repository;
  }
        /// <summary>
        /// Configures NHibernate and creates a member-level session factory.
        /// </summary>
        public void Initialize()
        {
            // Initialize
            Configuration cfg = new Configuration();
            cfg.Configure();

            // Add class mappings to configuration object

            cfg.AddAssembly(this.GetType().Assembly);

            // Create session factory from configuration object
            _sessionFactory = cfg.BuildSessionFactory();

            _userRepository = new UserRepository(_sessionFactory);

            _metadataRepository = new MetadataRepository(_sessionFactory);

            _configurationMongoRepository = new ConfigurationRepository(new WebConfigConnectionStringRepository());
        }
示例#41
0
        private void LoadNamedConfig(string configName)
        {
            try
            {

                if(_rootOfCreation!=null)
                   Object.Destroy(_rootOfCreation);

                var configurationRepository = new ConfigurationRepository();
                var config = configurationRepository.LoadConfigByName(configName);
                //var config = Mother.CreateSimpleConf();
                if (config == null)
                {
                    print("could not load configuration" + configurationName);
                    return;
                }
                config.RootElement.GameObject = this.gameObject;
                config.RootElement.GameObject.name = config.Name;
                ConfigurationHelper.CurrentConfig = config;
                _rootOfCreation = CreateConfElement(config.RootElement, config.RootElement.GameObject);

            }
            catch (Exception exception)
            {
                Debug.LogException(exception, this.gameObject);
                Debug.LogError("error loading " + exception.Message, this.gameObject);

            }
        }
示例#42
0
 public void SetUp()
 {
     //serialiseConfiguration = MockRepository.GenerateMock<ISerialiseConfiguration>();
     config = new ConfigurationRepository();
 }
示例#43
0
 public Configuration Get()
 {
     var repository = new ConfigurationRepository();
     return repository.GetConfiguration();
 }
        internal ConfigurationRepository Build()
        {
            var repository = new ConfigurationRepository();
            foreach (var kv in _typeConfigurationBuilders)
            {
                var cls = kv.Value as IClassConfigurationBuilder;
                var intrf = kv.Value as IInterfaceConfigurationBuilder;
                if (cls != null)
                {
                    repository.AttributesForType[kv.Key] = cls.AttributePrototype;
                }

                if (intrf != null)
                {
                    repository.AttributesForType[kv.Key] = intrf.AttributePrototype;
                }

                foreach (var kvm in kv.Value.MembersConfiguration)
                {
                    if (kvm.Value.CheckIgnored())
                    {
                        repository.Ignored.Add(kvm.Key);
                        continue;
                    }
                    var prop = kvm.Key as PropertyInfo;
                    var field = kvm.Key as FieldInfo;
                    var method = kvm.Key as MethodInfo;
                    if (prop != null)
                    {
                        repository.AttributesForProperties[prop] = (TsPropertyAttribute) kvm.Value.AttributePrototype;
                    }
                    if (field != null)
                    {
                        repository.AttributesForFields[field] = (TsPropertyAttribute) kvm.Value.AttributePrototype;
                    }
                    if (method != null)
                    {
                        repository.AttributesForMethods[method] = (TsFunctionAttribute) kvm.Value.AttributePrototype;
                    }
                }
                foreach (var kvp in kv.Value.ParametersConfiguration)
                {
                    if (kvp.Value.CheckIgnored())
                    {
                        repository.Ignored.Add(kvp.Key);
                        continue;
                    }
                    repository.AttributesForParameters[kvp.Key] = kvp.Value.AttributePrototype;
                }
                repository.AddFileSeparationSettings(kv.Key, kv.Value);
            }
            foreach (var kv in _enumConfigurationBuilders)
            {
                repository.AttributesForType[kv.Key] = kv.Value.AttributePrototype;
                foreach (var enumValueExportConfiguration in kv.Value.ValueExportConfigurations)
                {
                    repository.AttributesForEnumValues[enumValueExportConfiguration.Key] =
                        enumValueExportConfiguration.Value.AttributePrototype;
                }
                repository.AddFileSeparationSettings(kv.Key, kv.Value);
            }
            repository.References.AddRange(_references);
            repository.AdditionalDocumentationPathes.AddRange(_additionalDocumentationPathes);
            return repository;
        }
示例#45
0
 private void TouchIt()
 {
     var repo = new ConfigurationRepository();
     repo.TouchSqlServer();
     Debug.Log("Successfull sql server touch");
 }
 public WaybillSettingFactory(ConfigurationRepository configurationRepository,
     IUnityContainer container)
 {
     this.configurationRepository = configurationRepository;
     this.container = container;
 }