protected virtual AuditDeleteRequest GetAuditRequest() { //EntityType entityType; //if (SiteSchema.Instance.TableToType.TryGetValue(Row.Table, out entityType)) { var auditRequest = new AuditDeleteRequest(Row.Table, Row.IdField[Row].Value); var parentIdRow = Row as IParentIdRow; if (parentIdRow != null) { var parentIdField = (Field)parentIdRow.ParentIdField; //EntityType parentEntityType; if (!parentIdField.ForeignTable.IsNullOrEmpty()) //SiteSchema.Instance.TableToType.TryGetValue(parentIdField.ForeignTable, out parentEntityType)) { auditRequest.ParentTypeId = parentIdField.ForeignTable; auditRequest.ParentId = parentIdRow.ParentIdField[Row]; } } return(auditRequest); } //return null; }
public static void AuditDelete(IDbConnection connection, string schema, AuditDeleteRequest request) { var fld = Dependency.Resolve<IAuditLogRow>(schema); var audit = ((Row)fld).CreateNew(); audit.TrackAssignments = true; fld.EntityTypeIdField[audit] = request.EntityType; fld.EntityIdField[audit] = request.EntityId; fld.ParentTypeIdField[audit] = request.ParentTypeId; fld.OldParentIdField[audit] = request.ParentId; fld.NewParentIdField[audit] = request.ParentId; fld.DateField[audit] = DateTime.UtcNow; fld.AuditTypeIdField[audit] = (Int32)AuditType.Delete; fld.UserIdField[audit] = (long)(request.UserId == null ? Authorization.UserId.TryParseID() : request.UserId.Value); connection.Insert(audit); }
public static void AuditDelete(IDbConnection connection, string schema, AuditDeleteRequest request) { var fld = IoC.Resolve <IAuditLogRow>(schema); var audit = ((Row)fld).CreateNew(); audit.TrackAssignments = true; fld.EntityTypeIdField[audit] = request.EntityType; fld.EntityIdField[audit] = request.EntityId; fld.ParentTypeIdField[audit] = request.ParentTypeId; fld.OldParentIdField[audit] = request.ParentId; fld.NewParentIdField[audit] = request.ParentId; fld.DateField[audit] = DateTime.UtcNow; fld.AuditTypeIdField[audit] = (Int32)AuditType.Delete; fld.UserIdField[audit] = (int)(request.UserId == null ? SecurityHelper.CurrentUserId : request.UserId.Value); new SqlInsert(audit).Execute(connection); }
public static void AuditDelete(IDbConnection connection, string schema, AuditDeleteRequest request) { var fld = Dependency.Resolve <IAuditLogRow>(schema); var audit = ((Row)fld).CreateNew(); audit.TrackAssignments = true; fld.EntityTypeIdField[audit] = request.EntityType; fld.EntityIdField[audit] = request.EntityId; fld.ParentTypeIdField[audit] = request.ParentTypeId; fld.OldParentIdField[audit] = request.ParentId; fld.NewParentIdField[audit] = request.ParentId; fld.DateField[audit] = DateTime.UtcNow; fld.AuditTypeIdField[audit] = (Int32)AuditType.Delete; fld.UserIdField[audit] = (long)(request.UserId == null ? Authorization.UserId.TryParseID() : request.UserId.Value); connection.Insert(audit); }
protected AuditDeleteRequest GetAuditDeleteRequest(IDeleteRequestHandler handler) { var idField = ((IIdRow)handler.Row).IdField; var auditRequest = new AuditDeleteRequest(handler.Row.Table, idField[handler.Row].Value); var parentIdRow = handler.Row as IParentIdRow; if (parentIdRow != null) { var parentIdField = (Field)parentIdRow.ParentIdField; //EntityType parentEntityType; if (!parentIdField.ForeignTable.IsNullOrEmpty()) //SiteSchema.Instance.TableToType.TryGetValue(parentIdField.ForeignTable, out parentEntityType)) { auditRequest.ParentTypeId = parentIdField.ForeignTable; auditRequest.ParentId = parentIdRow.ParentIdField[handler.Row]; } } return auditRequest; }
protected AuditDeleteRequest GetAuditDeleteRequest(IDeleteRequestHandler handler) { var idField = ((IIdRow)handler.Row).IdField; var auditRequest = new AuditDeleteRequest(handler.Row.Table, idField[handler.Row].Value); var parentIdRow = handler.Row as IParentIdRow; if (parentIdRow != null) { var parentIdField = (Field)parentIdRow.ParentIdField; //EntityType parentEntityType; if (!parentIdField.ForeignTable.IsNullOrEmpty()) //SiteSchema.Instance.TableToType.TryGetValue(parentIdField.ForeignTable, out parentEntityType)) { auditRequest.ParentTypeId = parentIdField.ForeignTable; auditRequest.ParentId = parentIdRow.ParentIdField[handler.Row]; } } return(auditRequest); }