public ConfigDTO getConfig() { try { ConfigDTO cf = null; string queryString = "SELECT * FROM Config"; SqlCommand cmd = new SqlCommand(queryString, DataConnection.connect); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { cf = new ConfigDTO(DateTime.Parse(dr["DateModified"].ToString()), long.Parse(dr["MinWithDraw"].ToString()), long.Parse(dr["MaxWithDraw"].ToString()), int.Parse(dr["NumPerPage"].ToString())); } dr.Close(); DataConnection.closeConnection(); return(cf); } catch (Exception) { DataConnection.closeConnection(); return(null); } }
public ActionResult <ConfigDTO> Get() { var config = new ConfigDTO { Authentication = new AuthenticationConfigDTO { Mechanism = authenticationOptions.Mechanism, InactivityTimeoutMinutes = authenticationOptions.InactiveTimeoutMinutes, LogoutURI = authenticationOptions.LogoutURI.ToString() }, Attestation = new AttestationConfigDTO { Enabled = attestationOptions.Enabled }, Cohort = new CohortConfigDTO { CacheLimit = cohortOptions.RowLimit, ExportLimit = cohortOptions.ExportLimit }, Client = clientOptions, Version = versionOptions.Version.ToString() }; return(Ok(config)); }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { if (configdto == null) { configdto = new ConfigDTO(); } configdto.UserName = Environment.UserName; configdto.TfsUrl = txbTfsUrl.Text; configdto.Language = (cbxLang.SelectedItem as LangDTO).Code; configdto.VersionPath = txbVersionLocation.Text; int upTime = 0; Int32.TryParse(txbUptime.Text, out upTime); if (upTime <= 0) { upTime = 60; } configdto.UpdateCicle = upTime; ConfigBO.Save(configdto); tabControl.SelectedIndex = 2; lstLog.Items.Add(FindResource("SaveSuccessMsg").ToString()); } catch (Exception ex) { lstLog.Items.Add(ex.Message); } }
private void loadConfig(bool controlInit = false) { var boConfig = ConfigBO.Load(); if (boConfig == null && controlInit) { tabControl.SelectedIndex = 3; } else { if (boConfig.isValid()) { configdto = boConfig.ObjectList.First(); } if (controlInit) { txbTfsUrl.Text = configdto.TfsUrl; txbUptime.Text = configdto.UpdateCicle.ToString(); txbVersionLocation.Text = configdto.VersionPath; cbxLang.SelectedItem = lstLang.Where(t => t.Code == configdto.Language).First(); WorkItemBO.TfsUrl = configdto.TfsUrl; VersionBO.VersionFile = configdto.VersionPath; } } }
private void frmConfig_Load(object sender, EventArgs e) { _cfgDto = ConfigBUS.GetConfig(); //Tich Luy Diem chbxTichLuyDiem.Checked = _cfgDto.TichLuyDiem; }
public Configuration(ConfigDTO dto, DataProtectionManager protectionManager, bool runDebug) { RunDebug = runDebug; ReoccurenceTime = dto.ReoccurenceTime; Local = new ConfigLocal(dto.Local, protectionManager); Remote = new ConfigRemote(dto.Remote, protectionManager); }
public static BusinessObject <ConfigDTO> Save(ConfigDTO dto) { try { var lst = LoadList(); if (lst == null) { lst = new List <ConfigDTO>(); } var dtoAux = lst.Where(t => t.UserName == Environment.UserName).FirstOrDefault(); if (dtoAux == null) { lst.Add(dto); } else { dtoAux.TfsUrl = dto.TfsUrl; dtoAux.VersionPath = dto.VersionPath; dtoAux.UpdateCicle = dto.UpdateCicle; dtoAux.Language = dto.Language; } using (var sw = File.CreateText(configJsonPath)) { sw.Write(JsonConvert.SerializeObject(lst)); sw.Close(); } return(dto.EntityToBusinessObject()); } catch (Exception ex) { return(ConstructError <ConfigDTO> .Set(ex)); } }
public void LoadConfig() { xConsole.WriteLine("Loading default config", MessageType.Info); //loading default config configDeserializer.AssingConfigFileFormatStrategy(new JSONFormatStrategy()); loadedConfig = configDeserializer.LoadConfig(Info.ProjectDirectory + @"Assets\Defaults\default.config.json"); xConsole.WriteLine("Default config loaded.", MessageType.Info); xConsole.WriteLine("Loading user config.", MessageType.Info); //loading user config if any string userConfigName = ConfigFileFinder.GetConfigFile(); if (userConfigName == null) { xConsole.WriteLine("No custom config found.", MessageType.Info); return; } IConfigFileFormatStrategy userConfigStrategy = FormatSelector.GetFileFormatStrategyFromFileName(userConfigName); configDeserializer.AssingConfigFileFormatStrategy(userConfigStrategy); loadedConfig = configDeserializer.LoadConfig(userConfigName); xConsole.WriteLine(string.Format("{0} loaded", userConfigName), MessageType.Info); return; }
public ConfigController() { this._configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); this.Config = new ConfigDTO(); this._configuration.Bind("AppConfig", this.Config); }
/// <summary> /// Trys to read the current Configuration /// returns null if not possible /// </summary> /// <returns></returns> public Configuration ReadConfig(bool runDebug) { ConfigDTO dto = _serializer.Deserialize(GetConfigPath()); if (dto != null) { return new Configuration(dto, _protectionManager, runDebug); } _logger.Error("Deserializing the config file failed!"); return null; }
public ActionResult <ConfigDTO> Get() { var config = new ConfigDTO { Authentication = new AuthenticationConfigDTO { Mechanism = authenticationOptions.Mechanism, InactivityTimeoutMinutes = authenticationOptions.InactiveTimeoutMinutes, Logout = new AuthenticationConfigDTO.LogoutConfigDTO(authenticationOptions.Logout) }, Attestation = new AttestationConfigDTO { Enabled = attestationOptions.Enabled, Text = attestationOptions.Text, Type = attestationOptions.Type }, Cohort = new CohortConfigDTO { CacheLimit = cohortOptions.RowLimit, ExportLimit = cohortOptions.ExportLimit, DeidentificationEnabled = deidentOptions.Patient.Enabled }, Client = new ClientOptionsDTO { Map = new ClientOptionsDTO.MapOptionsDTO { Enabled = clientOptions.Map.Enabled, TileURI = clientOptions.Map.TileURI }, Visualize = new ClientOptionsDTO.VisualizeOptionsDTO { Enabled = clientOptions.Visualize.Enabled, ShowFederated = clientOptions.Visualize.ShowFederated }, Timelines = new ClientOptionsDTO.TimelinesOptionsDTO { Enabled = clientOptions.Timelines.Enabled }, PatientList = new ClientOptionsDTO.PatientListOptionsDTO { Enabled = clientOptions.PatientList.Enabled }, Help = new ClientOptionsDTO.HelpOptionsDTO { Enabled = clientOptions.Help.Enabled, AutoSend = clientOptions.Help.AutoSend, Email = clientOptions.Help.Email, URI = clientOptions.Help.URI } }, Version = versionOptions.Version.ToString() }; return(Ok(config)); }
public static void SaveConfig(ConfigDTO cfgDto) { OleDbConnection connection = DataProvider.CreateConnection(); string cmdText = "Update CONFIG Set TichLuyDiem = ? where ID=1"; OleDbCommand command = new OleDbCommand(cmdText, connection); command.Parameters.Add("@TichLuyDiem", OleDbType.Boolean); command.Parameters["@TichLuyDiem"].Value = cfgDto.TichLuyDiem; int row = command.ExecuteNonQuery(); connection.Close(); }
public Int64 Update(ConfigDTO _nv) { string[] str = new string[3]; object[] val = new object[3]; str[0] = "@quiDinh"; val[0] = _nv.quyDinh; str[2] = "@giaTri"; val[2] = _nv.giaTri; DataProvider dp = new DataProvider(); return(dp.WriteDataAddParam("SP_UpdateConfig", str, val, 50)); }
public static void getSessionId() { try { // login (make sure you have user and role assigned in magento admin) _cfgDto = ConfigBUS.GetConfig(); apiUrl = _cfgDto.SoapAddress; sessionId = Connection.Login(apiUrl, apiUser, apiPass); } catch (System.Exception ex) { MessageBox.Show("Không thể kết nối tới web, sử dụng OFFLINE MODE"); _cfgDto.UseAPISycn = false; } }
public List <ConfigDTO> convertToObject(DataTable input) { List <ConfigDTO> output = new List <ConfigDTO>(); foreach (DataRow dr in input.Rows) { ConfigDTO obj = new ConfigDTO(); obj.ID = Convert.ToInt32(dr["ID"]); obj.DateModified = Convert.ToDateTime(dr["DateModified"]); obj.MinWithDraw = Convert.ToInt32(dr["MinWithDraw"]); obj.MaxWithDraw = Convert.ToInt32(dr["MaxWithDraw"]); obj.NumPerPage = Convert.ToInt32(dr["NumPerPage"]); output.Add(obj); } return(output); }
public AutoPokeExtension() { Config = GetConfig <ConfigDTO>(); if (Config.Enabled) { mapper = AutoMapperConfig.Initialize(); events = new Dictionary <uint, bool>(); channelService = new AutoPokeService(this, Config); foreach (var c in Config.Channels) { channelService.AddChannel(mapper.Map <ChannelDTO, ChannelData>(c)); } } }
public static ConfigDTO GetConfig() { OleDbConnection connection = DataProvider.CreateConnection(); string cmdText = "Select * from CONFIG"; OleDbCommand command = new OleDbCommand(cmdText, connection); OleDbDataReader reader = command.ExecuteReader(); ConfigDTO cfgDto = new ConfigDTO(); while (reader.Read()) { cfgDto.TichLuyDiem = (bool)reader["TichLuyDiem"]; } reader.Close(); connection.Close(); return(cfgDto); }
/// <summary> /// Validates wheter the given ConfigDTO is valid by considering the /// Attributes that have been set in the ConfigDTO itself /// </summary> /// <param name="dto"></param> /// <returns>Wheter the Config could be validated or not</returns> private bool Validate(ConfigDTO dto) { bool validated = true; _logger.Debug("Validating config."); if(!CorrectAndValidateType<ConfigDTO>(dto)) validated = false; if(!CorrectAndValidateType<ConfigLocalDTO>(dto.Local)) validated = false; if(!CorrectAndValidateType<ConfigRemoteDTO>(dto.Remote)) validated = false; if(validated) { _logger.Debug("Config validation succeed."); } else { _logger.Error("Config validation failed! Run \"reconfigure\" or edit the configuration file to change the values!"); }; return validated; }
public static List <LvConfiguracao> Salvar() { List <LvConfiguracao> lista = new List <LvConfiguracao>(); try { using (IDocumentStore store = new DocumentStore { Urls = new[] { "http://localhost:8082" }, Database = "lv_leitura", Conventions = { } }) { store.Initialize(); using (IDocumentSession session = store.OpenSession()) { ConfigDTO configDTO = new ConfigDTO() { GUID = Guid.NewGuid().ToString(), NOME = "Eletrica" }; session.Store(configDTO); session.SaveChanges(); //lista = session.Query<LvConfiguracao>().ToList(); } } } catch (Exception ex) { string msg = ex.Source; } return(lista); }
public void SaveConfig(ConfigDTO config, string configFileName) { throw new NotImplementedException(); }
private void SetDataIndex() { itemIndex = new ConfigDTO(txtQuyDinh.Text, txtDoiTuong.Text, Convert.ToInt32(txtGiaTri.Text.Trim())); }
public AutoPokeService(AutoPokeExtension e, ConfigDTO config) { extension = e; this.config = config; }
public static void SaveConfig(ConfigDTO cfgDto) { ConfigDAO.SaveConfig(cfgDto); }
public Int64 Update(ConfigDTO _nv) { return(nvDAO.Update(_nv)); }