示例#1
0
        internal static void CreateNewKey(string group, string key, out string errorMsg)
        {
            string language;

            errorMsg = string.Empty;
            fwk_ConfigManager record = null;
            Boolean           wExist = false;

            using (ConfigDataContext dc = new ConfigDataContext(cnnString))
            {
                for (int i = 0; i < Fwk.Configuration.ConfigurationManager.ConfigProvider.Providers.Count; i++)
                {
                    language = Fwk.Configuration.ConfigurationManager.ConfigProvider.Providers[i].Name;
                    //Verifico que clave y valor exista
                    wExist = dc.fwk_ConfigManagers.Any(p => p.ConfigurationFileName.Equals(language) &&
                                                       p.group.Equals(group) &&
                                                       p.key.Equals(key));

                    if (wExist)
                    {
                        errorMsg = String.Format("Ya existe la clave {0} en el grupo {1} para alguno de los lenguajes", key, group);
                        continue;
                    }
                    else
                    {
                        record = new fwk_ConfigManager();
                        record.ConfigurationFileName = language;
                        record.group = group;
                        record.key   = key;
                        dc.fwk_ConfigManagers.InsertOnSubmit(record);
                    }
                    dc.SubmitChanges();
                }
            }
        }
示例#2
0
        internal static void CreateORUpdateKey(string language, string group, string key, string value)
        {
            using (ConfigDataContext dc = new ConfigDataContext(cnnString))
            {
                bool wExist = false;
                fwk_ConfigManager record;

                //Verifico que clave y valor exista
                wExist = dc.fwk_ConfigManagers.Any(p => p.ConfigurationFileName.Equals(language) &&
                                                   p.group.Equals(group) &&
                                                   p.key.Equals(key));

                if (wExist)
                {
                    record = dc.fwk_ConfigManagers.Where(p => p.ConfigurationFileName.Equals(language) &&
                                                         p.group.Equals(group) &&
                                                         p.key.Equals(key)).FirstOrDefault <fwk_ConfigManager>();

                    record.value = value;// e.Value.ToString().Trim();
                }

                else
                {
                    record = new fwk_ConfigManager();
                    record.ConfigurationFileName = language;
                    record.group = group;
                    record.key   = key;
                    record.value = value;
                    dc.fwk_ConfigManagers.InsertOnSubmit(record);
                }
                dc.SubmitChanges();
            }
        }
示例#3
0
 partial void Deletefwk_ConfigManager(fwk_ConfigManager instance);
示例#4
0
 partial void Updatefwk_ConfigManager(fwk_ConfigManager instance);
示例#5
0
 partial void Insertfwk_ConfigManager(fwk_ConfigManager instance);