private string[] getAccount(string name, ConfigChoice choice) { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string connectionString = config.AppSettings.Settings[name].Value; //因为参数保存方式不同,通过枚举判断下,不同情况取值方式 string[] account = connectionString.Split(','); return(account); }
void LoadListOfConfigs() { string[] configs = Util.GetListofConfigs(); if (ConfigChoice.Count > 0) { ConfigChoice.Clear(); } for (int i = 0; i < configs.Length; i++) { HudStaticText temp = new HudStaticText(); temp.Text = configs[i]; ConfigChoice.AddItem(temp, configs[i]); } }
public ReturnMessageModel CreateEditConfigChoice(ConfigChoiceModel model) { try { var ccRow = _context.ConfigChoices.Where(x => x.ChoiceId == model.ChoiceId).FirstOrDefault(); if (ccRow == null) { ccRow = new ConfigChoice(); } ccRow.CategoryId = model.CategoryId; ccRow.Choice = model.Choice; ccRow.ChoiceNepali = model.ChoiceNepali; ccRow.ChoiceDescription = model.ChoiceDescription; ccRow.Val = model.Val; ccRow.IsActive = model.IsActive; if (ccRow.ChoiceId == 0) { _context.ConfigChoices.Add(ccRow); _context.SaveChanges(); } else { _context.ConfigChoices.Attach(ccRow); _context.Entry(ccRow).State = EntityState.Modified; _context.SaveChanges(); } rModel.Msg = "ConfigChoice Saved Successfully!!"; rModel.Success = true; return(rModel); } catch (Exception ex) { rModel.Msg = "ConfigChoice Save Failed!!"; rModel.Success = false; return(rModel); } }
public ReadConfigSupport(string name, ConfigChoice choice) { this.account = getAccount(name, choice); }