コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: AuditLogService.cs プロジェクト: CodeFork/Serenity
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: AuditLogBehavior.cs プロジェクト: CodeFork/Serenity
        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;
        }
コード例 #6
0
        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);
        }