コード例 #1
0
 /// <summary>
 /// Updates UpdateDateTimeUtc and updateuserid to current, fills in createDateTimeUtc and CreatedBy if null
 /// </summary>
 public static void UpdateAuditFields(this AuditFieldsAllRequired record, UserProfile userProfile)
 {
     if (userProfile == null && record.CreatedBy == null && record.UpdatedBy == null)
     {
         throw new ApplicationException("User profile cannot be null for CreateUser/UpdateUser using AuditableFieldsAllRequired");
     }
     record.UpdateAuditFields(userProfile.UserProfileId);
 }
コード例 #2
0
 public static void UpdateAuditFields(this AuditFieldsAllRequired record, int userProfileId)
 {
     //new record fill create info
     if (record.CreateDateTimeUtc == null || record.CreateDateTimeUtc == DateTime.MinValue)
     {
         record.CreateDateTimeUtc = DateTime.UtcNow;
     }
     if (record.CreatedBy == null)
     {
         record.CreatedBy_UserProfileId = userProfileId;
     }
     record.UpdateDateTimeUtc       = DateTime.UtcNow;
     record.UpdatedBy_UserProfileId = userProfileId;
 }
コード例 #3
0
 /// <summary>
 /// Sets defaults for the record (for new records)
 /// </summary>
 public static void SetDefaults(this AuditFieldsAllRequired record, UserProfile userProfile)
 {
     record.UpdateAuditFields(userProfile);
 }