Exemplo n.º 1
0
 public static SkillSet find_by_name(string name)
 {
     try
     {
         return(new SkillSet(SkillSetConfigurations.First(item => item.ConfigurationId.DisplayName == name)));
     }
     catch (InvalidOperationException)
     {
         throw new KeyNotFoundException(string.Format("Unable to find a {0} with key {1}", MethodInfo.GetCurrentMethod().DeclaringType.Name, name));
     }
 }
Exemplo n.º 2
0
        public static SkillSet find_or_create(string name, string column_name, int minimum_proficiency = 1)
        {
            if (!SkillSetConfigurations.Any(item => item.ConfigurationId.DisplayName == name))
            {
                try
                {
                    var configurations = new SkillSetConfigurationList(new DialerConfigurationManager(Application.ICSession).ConfigurationManager);
                    var skillset       = configurations.CreateObject();

                    skillset.SetDisplayName(name);
                    skillset.ColumnName.Value         = column_name;
                    skillset.MinimumProficiency.Value = minimum_proficiency;
                    skillset.Commit();
                    _SkillSetConfigurations = null; // So the list is fetched again
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            return(new SkillSet(SkillSetConfigurations.First(item => item.ConfigurationId.DisplayName == name)));
        }