コード例 #1
0
        public short GetId(SqlLocale locale)
        {
            if (locale == null)
            {
                throw new ArgumentNullException("locale");
            }
            foreach (SqlLocale l in m_Locales.Values)
            {
                bool localeCodeMatch = false;
                if (((l.LocaleCode == null) && (locale.LocaleCode == null)) ||
                    ((l.LocaleCode != null) && (locale.LocaleCode != null) &&
                     (String.Compare(l.LocaleCode, locale.LocaleCode, StringComparison.OrdinalIgnoreCase) == 0)))
                {
                    localeCodeMatch = true;
                }

                bool LocaleNameMatch = false;
                if (((l.LocaleName == null) && (locale.LocaleName == null)) ||
                    ((l.LocaleName != null) && (locale.LocaleName != null) &&
                     (String.Compare(l.LocaleName, locale.LocaleName, StringComparison.OrdinalIgnoreCase) == 0)))
                {
                    LocaleNameMatch = true;
                }

                if (localeCodeMatch && LocaleNameMatch)
                {
                    return(l.LocaleId);
                }
            }
            return(-1);
        }
コード例 #2
0
 public void Add(SqlLocale newValue)
 {
     if (newValue == null)
     {
         throw new ArgumentNullException("newValue");
     }
     m_Locales.Add(newValue.LocaleId, newValue);
 }