public SettingsWindow(AccountsSettingsModel accountsSettings, ApplicationSettingsModel applicationSettings, OutgoingMailServiceResolver serviceResolver) { _serviceResolver = serviceResolver; AccountsSettings = accountsSettings; ApplicationSettings = applicationSettings; InitializeComponent(); }
public void FormStateTest() { var settingsModel = new ApplicationSettingsModel() { ImageFormatExtension = ".jpg", FormStateModels = new Dictionary <string, FormStateModel>(), LastAppStartTime = DateTime.Now, InputDirectory = "", OutputDirectory = "" }; FormStateModel formStateModel = new FormStateModel() { FormName = "TestForm", FormPosition = new Point(32, 128), WindowState = FormState.Maximized, FormSize = new Size(247, 377) }; settingsModel.FormStateModels.Add(formStateModel.FormName, formStateModel); Assert.IsTrue(_repository.SaveSettings(settingsModel), "SaveSettings(settingsModel) failed"); var loadedSettings = _repository.LoadSettings(); FormStateModel reconstructedFormState = loadedSettings.FormStateModels.Count > 0 ? loadedSettings.FormStateModels.Values.First() : null; Assert.IsNotNull(reconstructedFormState, "reconstructedFormState != null"); // Test each property bool objectsAreEqual = reconstructedFormState.Equals(formStateModel); Assert.IsTrue(objectsAreEqual, "Reconstructed object not equal to original object."); }
public void bindCompanyType() { try { ApplicationSettingsModel ComName = client.GetAllApplicationList2(ParlourId, 0, 0); if (ComName != null) { ApplicationSettingsModel[] model = client.GetAllApplicationList(ParlourId, 1, 0); if (model != null) { ddlCompanyList.Visible = true; ddlCompanyList.DataTextField = "ApplicationName"; ddlCompanyList.DataValueField = "pkiApplicationID"; ddlCompanyList.DataSource = model; ddlCompanyList.DataBind(); ddlCompanyList.Items.Insert(0, new ListItem("Select", "0")); int a = SelectName(); ddlCompanyList.SelectedValue = a.ToString(); } } } catch (Exception ex) { ShowMessage(ref lblMessage, MessageType.Danger, ex.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="AutoMapperProfile"/> class. /// </summary> public AutoMapperProfile() { SearchProfileModel.CreateMappings(this); ApplicationSettingsModel.CreateMappings(this); //ComputedFileHashModel.CreateMappings(this); //FileHashCollection.CreateMappings(this); }
public Settings() { InitializeComponent(); ISettingsModel model = new ApplicationSettingsModel(); DataContext = new SettingsWindowViewModel(model); }
public CreateDatabase() { Settings = SettingsLogic.ReadConfiguration(); ConnectionStringProperty = $"Data Source={Settings.ConnectionString.DataSource}" + $"AttachDbFilename = {Settings.ConnectionString.AttachDbFilename}" + $"Integrated Security = {Settings.ConnectionString.IntegratedSecurity}"; }
/// <summary> /// Метод устанавливает строку подключения в требуемом конфиге /// </summary> /// <param name="connectionString">Новая строка подключения</param> /// <param name="settingsPath">Путь к конфигу</param> /// <returns>True если успех, False при ошибке</returns> static public void SetDefaultConnectionString(ApplicationSettingsModel settings, string settingsPath) { XmlDocument document = new XmlDocument(); try { document.Load(settingsPath); XmlElement root = document.DocumentElement; foreach (XmlNode node in root) { if (node.Name != "connectionStrings") { continue; } foreach (XmlNode connectionString in node.ChildNodes) { connectionString.Attributes["name"].Value = settings.ConnectionString.ConnectionName; connectionString.Attributes["providerName"].Value = settings.ConnectionString.ProviderName; connectionString.Attributes["connectionString"].Value = $"Data Source={settings.ConnectionString.DataSource}" + $"AttachDbFilename={settings.ConnectionString.AttachDbFilename}" + $"Integrated Security={settings.ConnectionString.IntegratedSecurity}"; } break; } document.Save(settingsPath); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Settings() { try { var data = await _applicationSettingsRepostiory.GetAsync(); var model = new ApplicationSettingsModel { ETag = data.ETag, RowKey = data.RowKey, AzureClientId = data.AzureClientId, AzureRegionName = data.AzureRegionName, AzureClientKey = data.AzureClientKey, AzureTenantId = data.AzureTenantId, AzureResourceGroupName = data.AzureResourceGroupName, AzureStorageName = data.AzureStorageName, AzureKeyName = data.AzureKeyName, AzureSubscriptionId = data.AzureSubscriptionId, AzureApiKey = data.AzureApiKey, DefaultMongoDBConnStr = data.DefaultMongoDBConnStr, DefaultRabbitMQConnStr = data.DefaultRabbitMQConnStr, DefaultRedisConnStr = data.DefaultRedisConnStr }; return(View(model)); } catch (Exception ex) { _log.Error(ex); return(View(new ApplicationSettingsModel())); } }
public void bindFuneralServiceList() { if (!IsPostBack) { gvFuneralServiceList.PageSize = PageSize; FuneralServiceManageModel[] objModel = client.SelectFuneralManageServiceByParlID(ParlourId, PageSize, PageNum, txtKeyword.Text, sortBYExpression, sortType); gvFuneralServiceList.DataSource = objModel; gvFuneralServiceList.DataBind(); ViewState["NewParlourID"] = ParlourId; } else { if (ddlCompanyList.SelectedValue == "" || ddlCompanyList.SelectedValue == null || ddlCompanyList.SelectedValue == "0") { gvFuneralServiceList.PageSize = PageSize; FuneralServiceManageModel[] objModel = client.SelectFuneralManageServiceByParlID(ParlourId, PageSize, PageNum, txtKeyword.Text, sortBYExpression, sortType); gvFuneralServiceList.DataSource = objModel; gvFuneralServiceList.DataBind(); } else { int AppId = Convert.ToInt32(ddlCompanyList.SelectedValue); ApplicationSettingsModel ComName = client.GetAllApplicationList2(ParlourId, 2, AppId); Guid New = ComName.parlourid; ViewState["NewParlourID"] = New; gvFuneralServiceList.PageSize = PageSize; FuneralServiceManageModel[] objModel = client.SelectFuneralManageServiceByParlID(New, PageSize, PageNum, txtKeyword.Text, sortBYExpression, sortType); gvFuneralServiceList.DataSource = objModel; gvFuneralServiceList.DataBind(); } } }
private void GetDataFromDb() { try { Settings = SettingsLogic.ReadConfiguration(); string conString = $"Data Source={Settings.ConnectionString.DataSource}" + $"AttachDbFilename = {Settings.ConnectionString.AttachDbFilename}" + $"Integrated Security = {Settings.ConnectionString.IntegratedSecurity}"; db = new DataContext(conString); firstNamesFromDb.AddRange(db.FirstNames); secondNamesFromDb.AddRange(db.SecondNames); if (firstNamesFromDb.Count == 0 || secondNamesFromDb.Count == 0) { this.Invoke(new Action(() => AskForData())); } } catch (InvalidOperationException) { throw; } catch (SqlException) { this.Invoke(new Action(() => AskForData())); } catch (Exception ex) { MessageBox.Show($"Произошла ошибка\n{ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } ButtonUserGenerate.Invoke(new Action(() => { ButtonUserGenerate.Enabled = true; })); LoadIndicator.Invoke(new Action(() => { LoadIndicator.Hide(); })); }
public bool SaveSettings(ApplicationSettingsModel settings) { ApplicationSettingsDataModel settingsDataModel = _mapper.Map <ApplicationSettingsModel, ApplicationSettingsDataModel>(settings); bool result = _ioProvider.SaveApplicationSettings(appConfigSettingsFilePath, settingsDataModel); OnSaveSettingsCompleted(); return(result); }
private static ApplicationSettingsModel CreateModel(int ImageQuality) { var model = new ApplicationSettingsModel { JpegImageQuality = ImageQuality }; return(model); }
public SettingsWindow() { InitializeComponent(); //we create a new model and we will work with this in the settings and connect ISettingsModel model = new ApplicationSettingsModel(); this.DataContext = new SettingsWindowViewModel(model); }
public DatabaseFill() { Settings = SettingsLogic.ReadConfiguration(); ConnectionStringProperty = $"Data Source={Settings.ConnectionString.DataSource}" + $"AttachDbFilename = {Settings.ConnectionString.AttachDbFilename}" + $"Integrated Security = {Settings.ConnectionString.IntegratedSecurity}"; db = new DataContext(ConnectionStringProperty); }
public int SelectName() { ApplicationSettingsModel ComName = client.GetAllApplicationList2(ParlourId, 0, 0); int pkiID = ComName.pkiApplicationID; return(pkiID); }
public void Init(ApplicationSettingsService settingsService) { _settingsService = settingsService; _settingsService.LoadSettings(); model = settingsService.Settings; _validator = ApplicationSettingsService.CreateModelValidator(model); BindControlValues(); }
public AccountController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IOptions <ApplicationSettingsModel> appSettings) { _userManager = userManager; _signInManager = signInManager; _appSettings = appSettings.Value; }
public void Application_Should_Read_Connection_String() { using (StreamReader reader = new StreamReader("appsettings.json")) { string json = reader.ReadToEnd(); ApplicationSettingsModel settings = JsonConvert.DeserializeObject <ApplicationSettingsModel>(json); Assert.IsNotNull(settings.ApplicationSettings.ConnectionString); } }
public void JpegImageQualityTestBelow() { const int ImageQuality = 49; ApplicationSettingsModel model = CreateModel(ImageQuality); ModelValidator validator = new ModelValidator(model); bool valid = validator.ValidateModel(); Assert.IsFalse(valid, " validation of " + nameof(model.JpegImageQuality) + " failed!"); }
public void BindAddress() { ApplicationSettingsModel model = client.GetApplictionByParlourID(ParlourId); lbladd1.Text = model.BusinessAddressLine1.ToString(); lbladd2.Text = model.BusinessAddressLine2.ToString(); lbladd3.Text = model.BusinessAddressLine3.ToString(); lbladd4.Text = model.BusinessPostalCode.ToString(); lblfpsnub.Text = "FPS Number: " + model.FSBNumber; lblTelCell.Text = model.ManageTelNumber.ToString() + " | " + model.ManageCellNumber.ToString(); }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (optionsBuilder.IsConfigured == false) { using (StreamReader reader = new StreamReader("appsettings.json")) { string json = reader.ReadToEnd(); ApplicationSettingsModel settings = JsonConvert.DeserializeObject <ApplicationSettingsModel>(json); optionsBuilder.UseSqlServer(settings.ApplicationSettings.ConnectionString); } } }
public void SaveSettings(ApplicationSettingsModel settings) { try { ApplicationSettingsDataModel applicationSettingsDataModel = _mapper.Map <ApplicationSettingsDataModel>(settings); _registryService.SaveObjectToRegistry(applicationSettingsDataModel); } catch (Exception ex) { Log.Error(ex, "Failed to save ApplicationSettings"); } }
//============================================================ // @class VKSDK // @method _initializeSettings() // @type Private Void // @usage Initialize SDK Settings //============================================================ private void _initializeSettings() { // Load SDK Settings string _sdk_cfg = LoadSDKConfigs(_sdk_settings_path, true); // Load if (_sdk_cfg != null) { settings = JsonUtility.FromJson <SDKSettingsModel>(_sdk_cfg); // Deserialize SDK Configs } if (settings.debug_mode) { Debug.Log("Инициализация VK SDK..."); } // Load App Settings string _app_cfg = LoadSDKConfigs(_app_settings_path, true); // Load if (_app_cfg != null) { application = JsonUtility.FromJson <ApplicationSettingsModel>(_app_cfg); // Deserialize Application Configs } // Load Authentication Data if (application.autosave_data) { string _auth_data = LoadSDKConfigs(_auth_data_path, true); // Load if (_auth_data != null) { authentication = JsonUtility.FromJson <AuthenticationModel>(_auth_data); // Deserialize Authenitcation Data } if (settings.debug_mode && _auth_data != null) { Debug.Log("Токен пользователя инициализирован."); } } // Initialize Platform if (settings.platform.Length < 1) // Platform is not defined { settings.platform = "other"; if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { settings.platform = "mac"; } if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) { settings.platform = "windows"; } if (settings.debug_mode) { Debug.Log("VK SDK инициализирован для платформы: " + settings.platform); } } }
/// <summary> /// Метод для чтения настроек из файла Json /// </summary> /// <returns>Возвращает модель класса ApplicationSettingsModel</returns> static public ApplicationSettingsModel ReadConfiguration() { try { string json = File.ReadAllText(Environment.CurrentDirectory + "\\ApplicationSettings.json"); ApplicationSettingsModel settings = JsonConvert.DeserializeObject <ApplicationSettingsModel>(json); return(settings); } catch (Exception) { return(new ApplicationSettingsModel()); } }
public void GetCompDetails() { ApplicationSettingsModel objApp = client.GetApplictionByParlourID(ParlourId); txtcompanyRules.Text = objApp.ApplicationName + Environment.NewLine + objApp.BusinessAddressLine1 + "," + Environment.NewLine + objApp.BusinessAddressLine2 + "," + Environment.NewLine + objApp.BusinessAddressLine3 + "," + Environment.NewLine + objApp.BusinessAddressLine4 + Environment.NewLine + objApp.BusinessPostalCode; ApplicationTnCModel ModelTnc; ModelTnc = client.SelectApplicationTermsAndCondition(ParlourId); if (ModelTnc != null) { txtTnc.Text = ModelTnc.TermsAndCondition; } }
public AppSettingsForm() { int ModifyCount = Enum.GetNames(typeof(Modify)).Length; IsModified = new bool[ModifyCount]; InitializeComponent(); DataProviderComboEdit.DataSource = SqlList; DataSourceComboEdit.DataSource = DataSourceList; progressPanel.Show(); Settings = SettingsLogic.ReadConfiguration(); FillSettingsFields(); progressPanel.Hide(); }
public async void InsertInitialApplicationSettings(ApplicationSettingsModel settings) { string cmd = string.Format("INSERT INTO ApplicationSettings(DeviceID) VALUES('{0}');", settings.DeviceID); try { int result = DatabaseHelper.ExecuteNonQuery(_dbpath, cmd); } catch (Exception ex) { Debug.WriteLine(string.Format("The following exception occurred in (ClientDatabaseManager.InsertInitialApplicationSettings) {0}", ex.Message)); } }
public static ApplicationSettingsModel GetDefaultApplicationSettings() { var settings = new ApplicationSettingsModel { ImageFormatExtension = "", InputDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), OutputDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer), LastAppStartTime = DateTime.Now, JpegImageQuality = 85, FormStateModels = new Dictionary <string, FormStateModel>() }; return(settings); }
protected override void OnStartup(StartupEventArgs e) { AFlightGearInfoModel infoModel = new InfoModel(); FlightModel commandModel = new FlightModel(new Client()); ApplicationSettingsModel settingM = new ApplicationSettingsModel(); base.OnStartup(e); MainWindow main = new MainWindow(); main.DataContext = new MainPageVM(infoModel, settingM); main.Board.InitiateVM(new FlightBoardViewModel(infoModel)); main.Control.DataContext = new FlightViewModel(commandModel, settingM); main.Show(); }
public ApplicationWorker(AccountsSettingsModel accountsSettings, EventBus eventBus, OutgoingMailServiceResolver serviceResolver, AsyncObservableCollection <EmailGroupModel> emailGroupList, ApplicationSettingsModel appSettings, IMailStorage mailStorage) { _accountsSettings = accountsSettings; _eventBus = eventBus; _serviceResolver = serviceResolver; _emailGroupList = emailGroupList; _appSettings = appSettings; _mailStorage = mailStorage; }