コード例 #1
0
 /// <summary>
 /// Gets the value of one of this object's properties.
 /// </summary>
 public virtual object GetValue(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field, object defaultValue)
 {
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.Description)
     {
         return((this.Description == null) ? defaultValue : this.Description);
     }
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.ID)
     {
         return(this.ID);
     }
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.CreatedBy)
     {
         return((this.CreatedBy == null) ? defaultValue : this.CreatedBy);
     }
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.CreatedDate)
     {
         return((this.CreatedDate == null) ? defaultValue : this.CreatedDate);
     }
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.ModifiedBy)
     {
         return((this.ModifiedBy == null) ? defaultValue : this.ModifiedBy);
     }
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.ModifiedDate)
     {
         return((this.ModifiedDate == null) ? defaultValue : this.ModifiedDate);
     }
     throw new Exception("Field '" + field.ToString() + "' not found!");
 }
コード例 #2
0
        /// <summary>
        /// Gets the maximum size of the field value.
        /// </summary>
        public static int GetMaxLength(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field)
        {
            switch (field)
            {
            case Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.Description:
                return(50);

            case Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.ID:
                return(0);
            }
            return(0);
        }
コード例 #3
0
 /// <summary>
 /// Assigns a value to a field on this object.
 /// </summary>
 /// <param name="field">The field to set</param>
 /// <param name="newValue">The new value to assign to the field</param>
 /// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
 public virtual void SetValue(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field, object newValue, bool fixLength)
 {
     if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.Description)
     {
         this.Description = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
     }
     else if (field == Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.ID)
     {
         throw new Exception("Field '" + field.ToString() + "' is a primary key and cannot be set!");
     }
     else
     {
         throw new Exception("Field '" + field.ToString() + "' not found!");
     }
 }
コード例 #4
0
        /// <summary>
        /// Gets the system type of a field on this object
        /// </summary>
        public static System.Type GetFieldType(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field)
        {
            if (field.GetType() != typeof(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants))
            {
                throw new Exception("The field parameter must be of type 'Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants'.");
            }

            switch ((Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants)field)
            {
            case Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.Description: return(typeof(string));

            case Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants.ID: return(typeof(System.Guid));
            }
            return(null);
        }
コード例 #5
0
 /// <summary>
 /// Returns the actual database name of the specified field.
 /// </summary>
 internal static string GetDatabaseFieldName(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field)
 {
     return(GetDatabaseFieldName(field.ToString()));
 }
コード例 #6
0
 /// <summary>
 /// Assigns a value to a field on this object.
 /// </summary>
 /// <param name="field">The field to set</param>
 /// <param name="newValue">The new value to assign to the field</param>
 public virtual void SetValue(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field, object newValue)
 {
     SetValue(field, newValue, false);
 }
コード例 #7
0
 /// <summary>
 /// Gets the value of one of this object's properties.
 /// </summary>
 public virtual object GetValue(Gravitybox.Datastore.EFDAL.Entity.AppliedPatch.FieldNameConstants field)
 {
     return(GetValue(field, null));
 }