コード例 #1
0
 public static string ApplyOffset(SimpleDBFieldAttribute attribute, decimal value)
 {
     decimal offset = (decimal)attribute.Offset;
     if (offset > 0) {
         value = value + offset;
         if (value < 0) {
             throw new  FieldFormatException ("Negative value of attribute " + attribute.Name + " is greather than specified offset");
         }
     }
     return value.ToString (CultureInfo.InvariantCulture);
 }
コード例 #2
0
 public static string ApplyPadding(SimpleDBFieldAttribute attribute, string value)
 {
     int padding = attribute.ZeroPadding;
     int length = value.Length;
     if (padding > 0) {
         if (length > padding) {
             throw new  FieldFormatException ("String length of value is greather than padding specified in attribute " + attribute.Name);
         } else {
             return value.PadLeft (padding, '0');
         }
     }
     return value;
 }