Example #1
0
        public string GetDisplayNameByName(SettingsName name)
        {
            Settings settings    = _ListAllSettings.Where(col => col.Name == name.ToString()).FirstOrDefault();
            string   displayName = settings == null ? null : settings.DisplayName;

            return(displayName);
        }
Example #2
0
        public string GetValueByName(SettingsName name)
        {
            Settings settings = _ListAllSettings.Where(col => col.Name == name.ToString()).FirstOrDefault();
            string   value    = settings == null ? null : settings.Value;

            return(value);
        }
Example #3
0
        /// <summary>
        /// Gets a count of setting tags that contain the string portion specified.
        /// </summary>
        /// <param name="partial"></param>
        /// <returns></returns>
        public static int GetCountByPartial(string partial)
        {
            GetSingleton();

            lock (m_singleton)
            {
                string   inputString;
                string[] inputFields;

                int count = 0;


                string UserSettingsFileName;
                UserSettingsFileName = GetAppPath();


                if (File.Exists(UserSettingsFileName))
                {
                    // load the records into memory
                    //    open the file for reading
                    try
                    {
                        StreamReader fileReader;
                        string       SettingsName;
                        string       SettingsValue;

                        fileReader = new StreamReader(UserSettingsFileName);

                        while ((inputString = fileReader.ReadLine()) != null)
                        {
                            if (!inputString.Contains(","))
                            {
                                continue;
                            }
                            inputFields   = inputString.Split(',');
                            SettingsName  = inputFields[0];
                            SettingsValue = inputFields[1];
                            if (SettingsName.Contains(partial))
                            {
                                count++;
                            }
                        } // end while
                        fileReader.Close();
                    }
                    catch (Exception ex)
                    {
                        FileLogging.Set("GetCountByPartial exception : " + ex.Message);
                        return(0);
                    } // end try
                }     // end if file exists

                else  // the files has not been created, so this is an error
                {
                    // MessageBox.Show("could not open user.config file");
                    return(0);
                }

                return(count);
            }
        }
 /// <summary>Snippet for GetSettings</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetSettingsResourceNames()
 {
     // Create client
     ContactCenterInsightsClient contactCenterInsightsClient = ContactCenterInsightsClient.Create();
     // Initialize request argument(s)
     SettingsName name = SettingsName.FromProjectLocation("[PROJECT]", "[LOCATION]");
     // Make the request
     Settings response = contactCenterInsightsClient.GetSettings(name);
 }
 /// <summary>Snippet for GetSettings</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetSettingsRequestObject()
 {
     // Create client
     ContactCenterInsightsClient contactCenterInsightsClient = ContactCenterInsightsClient.Create();
     // Initialize request argument(s)
     GetSettingsRequest request = new GetSettingsRequest
     {
         SettingsName = SettingsName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
     };
     // Make the request
     Settings response = contactCenterInsightsClient.GetSettings(request);
 }
Example #6
0
 /// <summary>
 /// See the base.
 /// </summary>
 public override int GetHashCode()
 {
     return(SettingsName.GetHashCode());
 }
 public static string Get(SettingsName name) => System.Configuration.ConfigurationManager.AppSettings[name.ToString()];