Example #1
0
        public static void UpdateAutocomplete(SettingName name, string newVal, Context ctx)
        {
            SettingsServiceLocalDB svc = new SettingsServiceLocalDB(ctx);
            Settings setting           = svc.GetByName(name);

            if (setting == null)
            {
                setting       = new Settings();
                setting.Name  = name;
                setting.Val_1 = ",";
                svc.Insert(setting);
            }
            string[] result = setting.Val_1.Split(',');
            bool     exist  = false;

            foreach (string rs in result)
            {
                if (rs == newVal)
                {
                    exist = true;
                    break;
                }
            }
            if (!exist)
            {
                setting.Val_1 = setting.Val_1 + "," + newVal;
                svc.Update(setting);
            }
        }
Example #2
0
        public static String[] GetAutoComplete(SettingName name, Context ctx)
        {
            SettingsServiceLocalDB svc = new SettingsServiceLocalDB(ctx);
            Settings setting           = svc.GetByName(name);

            if (setting == null)
            {
                setting       = new Settings();
                setting.Name  = name;
                setting.Val_1 = ",";
                svc.Insert(setting);
            }
            string[] result = setting.Val_1.Split(',');
            return(result);
        }