Exemple #1
0
        public static void AuditUndelete(IDbConnection connection, string schema, AuditUndeleteRequest 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.UndoDelete;
            fld.UserIdField[audit] = (int)(request.UserId == null ? Authorization.UserId.TryParseID() : request.UserId.Value);

            connection.Insert(audit);
        }
Exemple #2
0
        public static void AuditUndelete(IDbConnection connection, string schema, AuditUndeleteRequest 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.UndoDelete;
            fld.UserIdField[audit]       = (int)(request.UserId == null ? SecurityHelper.CurrentUserId : request.UserId.Value);

            new SqlInsert(audit).Execute(connection);
        }
Exemple #3
0
        public static void AuditUndelete(IDbConnection connection, string schema, AuditUndeleteRequest 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.UndoDelete;
            fld.UserIdField[audit]       = (int)(request.UserId == null ? Authorization.UserId.TryParseID() : request.UserId.Value);

            connection.Insert(audit);
        }
        protected virtual AuditUndeleteRequest GetAuditRequest()
        {
            //EntityType entityType;
            //if (SiteSchema.Instance.TableToType.TryGetValue(Row.Table, out entityType))
            {
                var auditRequest = new AuditUndeleteRequest(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);
            }
        }