コード例 #1
0
 public Nullable <short> GetAttributeAsNullOrShort(SupportedAttribute attributeName)
 {
     try
     {
         return(Attributes.ContainsKey(attributeName.ToString()) ? (short?)short.Parse(Attributes[attributeName.ToString()], CultureInfo.InvariantCulture) : null);
     }
     catch
     {
         return(null);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 public string GetAttributeAsNullOrString(SupportedAttribute attributeName)
 {
     return(Attributes.ContainsKey(attributeName.ToString()) ? Attributes[attributeName.ToString()] : null);
 }