/// <summary> /// Domain to data access converter for FileAttributes /// </summary> /// <param name="AuditDomainObject"></param> /// <param name="AuditRecord"></param> /// <returns></returns> public static Audit ConvertStringAttributes(AuditObject AuditDomainObject, Audit AuditRecord) { foreach (var stringObject in AuditDomainObject.AuditAttributes.Where(P => P.Value is StringAuditAttributeObject)) { var attribute = stringObject.Value as StringAuditAttributeObject; if (attribute != null) { var stringAttribute = new StringAttribute { Key = stringObject.Key, Value = attribute.Value, DateCreated = attribute.DateCreated == DateTime.MinValue ? DateTime.Now : attribute.DateCreated }; AuditRecord.Attribute.Add(stringAttribute); } } return AuditRecord; }
/// <summary> /// Create a new StringAttribute object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="key">Initial value of the Key property.</param> /// <param name="dateCreated">Initial value of the DateCreated property.</param> /// <param name="value">Initial value of the Value property.</param> public static StringAttribute CreateStringAttribute(global::System.Int32 id, global::System.String key, global::System.DateTime dateCreated, global::System.String value) { StringAttribute stringAttribute = new StringAttribute(); stringAttribute.Id = id; stringAttribute.Key = key; stringAttribute.DateCreated = dateCreated; stringAttribute.Value = value; return stringAttribute; }