/// <summary> /// Parses a string value into a Sound Description Keyword Category (SDKCategories enumeration type). No exceptions will be thrown. /// </summary> /// <param name="SDKString">The string to parse into a SDKCategories value.</param> /// <returns>This will return a SDKCategories value. If the string is not valid, it will return Unknown</returns> public static SDKCategories ParseSDK(string SDKString) { SDKCategories SDKEnum = SDKCategories.Unknown; //make sure string isn't null if (!String.IsNullOrEmpty(SDKString)) { //parse string into SDKCategory and ignore case //kludge until database storage of this concept is resolved switch (SDKString.ToLowerInvariant()) { case "source": case "soundsource": case "1": SDKEnum = SDKCategories.SoundSource; break; case "instrument": case "instrumenttype": case "2": SDKEnum = SDKCategories.InstrumentType; break; case "timbre": case "timbre_characteristic": case "3": SDKEnum = SDKCategories.Timbre_Characteristic; break; case "articulation": case "4": SDKEnum = SDKCategories.Articulation; break; default: SDKEnum = SDKCategories.Unknown; break; } } return(SDKEnum); }//end ParseSDK
/// <summary> /// Returns a list of Keyword instances belonging to a certain type. /// </summary> /// <param name="KeywordType">The type of Keyword to return.</param> /// <returns>A list of Keyword objects; this will be an empty list if an exception occurs.</returns> public List <Keyword> GetKeywordsByType(SDKCategories SDKType) { //create typed data objects DSNyMPH.tbKeywordDataTable _dtKeyword = new DSNyMPH.tbKeywordDataTable(); try { //using (tbKeywordTableAdapter _taKeyword = new tbKeywordTableAdapter()) //{ //_taKeyword.Connection = _conn; ////fill typed table //_taKeyword.FillByType(_dtKeyword, SDKType.ToString()); //use global table adapter to fill datatable _keywordTA.FillByType(_dtKeyword, SDKType.ToString()); Console.WriteLine(_dtKeyword.Rows.Count); // } } catch (Exception ex) { _elh.WriteEvent(string.Format("Exception occurred while getting List of Keywords with KeywordType = {0}. Exception details: {1}", SDKType.ToString(), ex.Message), EventLogEntryType.Error); } //create typed list with correct capacity List <Keyword> _keywords = new List <Keyword>(_dtKeyword.Rows.Count); foreach (DSNyMPH.tbKeywordRow _row in _dtKeyword.Rows) { //map datarow to Keyword object _keywords.Add(MapRowToKeyword(_row)); } return(_keywords); }
public static List <Keyword> GetKeywordList(SDKCategories Type) { // TODO add implementation //TODO: call data layer to get list throw new NotImplementedException("TODO:"); }