public Nullable <short> GetAttributeAsNullOrShort(SupportedAttribute attributeName) { try { return(Attributes.ContainsKey(attributeName.ToString()) ? (short?)short.Parse(Attributes[attributeName.ToString()], CultureInfo.InvariantCulture) : null); } catch { return(null); } }
public DateTime?GetAttributeAsNullOrDateTime(SupportedAttribute attributeNameDate, SupportedAttribute attributeNameTime) { try { //if we have a date and time join them/if there is only a date return that/return null if there is only a time if (Attributes.ContainsKey(attributeNameDate.ToString()) && Attributes.ContainsKey(attributeNameTime.ToString())) { return((DateTime?)DateTime.Parse($"{Attributes[attributeNameDate.ToString()]} {Attributes[attributeNameTime.ToString()]}", CultureInfo.InvariantCulture)); } else if (Attributes.ContainsKey(attributeNameDate.ToString())) { return(DateTime.Parse($"{Attributes[attributeNameDate.ToString()]}", CultureInfo.InvariantCulture)); } else { return(null); } } catch { return(null); } }
public string GetAttributeAsNullOrString(SupportedAttribute attributeName) { return(Attributes.ContainsKey(attributeName.ToString()) ? Attributes[attributeName.ToString()] : null); }