Пример #1
0
 public StringBackedField(string fieldName, FieldDescriptorFlags flags = FieldDescriptorFlags.NONE, string defaultValue = null,
                          ConstraintDescriptorFlags[] cdFlags          = null, string[] cdValues = null)
 {
     FieldName    = fieldName;
     Flags        = flags;
     DefaultValue = defaultValue;
     if (cdFlags != null && cdValues != null)
     {
         if (cdFlags.Length != cdValues.Length)
         {
             throw new Exception("ConstraintDescriptor flags and values arrays must be of same length");
         }
         Constraints = new StringConstraintDescriptor(cdFlags, cdValues);
     }
     else
     {
         Constraints = new StringConstraintDescriptor(new ConstraintDescriptorFlags[0], new string[0]);
     }
 }
Пример #2
0
 public DateTimeSpecialField(string fieldName, FieldDescriptorFlags flags = FieldDescriptorFlags.NONE, long defaultValue = 0,
                             DateTimeConstraintDescriptorFlags[] cdFlags  = null, long[] cdValues = null)
 {
     FieldName    = fieldName;
     Flags        = flags;
     DefaultValue = Util.GetDateTimeFromUnixTimestamp(defaultValue);
     if (cdFlags != null && cdValues != null)
     {
         if (cdFlags.Length != cdValues.Length)
         {
             throw new Exception("ConstraintDescriptor flags and values arrays must be of same length");
         }
         DateTime[] mCdValues = new DateTime[cdValues.Length];
         for (int i = 0; i < cdValues.Length; i++)
         {
             mCdValues[i] = Util.GetDateTimeFromUnixTimestamp(cdValues[i]);
         }
         Constraints = new DateTimeConstraintDescriptor(cdFlags, mCdValues);
     }
     else
     {
         Constraints = new DateTimeConstraintDescriptor(new DateTimeConstraintDescriptorFlags[0], new DateTime[0]);
     }
 }