Пример #1
0
        protected override void PrepareOperationLog(AUObjectOperationContext context)
        {
            if (this.RelationExisted == false)
            {
                AUOperationLog log = AUOperationLog.CreateLogFromEnvironment();

                log.ResourceID    = this._Object.ID;
                log.SchemaType    = this._Object.SchemaType;
                log.OperationType = this.OperationType;
                log.Category      = this._Object.Schema.Category;
                log.Subject       = string.Format("{0}: {1} 从 {2} 至 {3}",
                                                  EnumItemDescriptionAttribute.GetDescription(this.OperationType), this._Object.Name,
                                                  AUCommon.DisplayNameFor(this._SourceObject), AUCommon.DisplayNameFor(this._ActualTarget));

                log.SearchContent = this._Object.ToFullTextString() +
                                    " " + AUCommon.FullTextFor(this._SourceObject) +
                                    " " + this._ActualTarget.ToFullTextString();

                context.Logs.Add(log);
            }
            else
            {
                AUOperationLog log = AUOperationLog.CreateLogFromEnvironment();

                log.ResourceID    = this._Object.ID;
                log.SchemaType    = this._Object.SchemaType;
                log.OperationType = this.OperationType;
                log.Category      = this._Object.Schema.Category;
                log.Subject       = string.Format("{0}: {1} 从 {2} 至 {3}(跳过已经存在的关系)",
                                                  EnumItemDescriptionAttribute.GetDescription(this.OperationType), this._Object.Name,
                                                  AUCommon.DisplayNameFor(this._SourceObject), AUCommon.DisplayNameFor(this._Target));

                log.SearchContent = this._Object.ToFullTextString() +
                                    " " + AUCommon.DisplayNameFor(this._SourceObject) +
                                    " " + this._ActualTarget.ToFullTextString();

                context.Logs.Add(log);
            }
        }