Beispiel #1
0
 private void UpdateEntityChangeLog(IEntitySchema es, object entity, List <string> modifiedColumns)
 {
     if (es.IsHistory)
     {
         int          num = Convert.ToInt32(es.GetKeyValue(entity));
         SysChangeLog log = new SysChangeLog {
             LogId        = this.GetNextIdentity(),
             EntityName   = es.EntityName,
             ChangeTime   = new DateTime?(DateTime.Now),
             ChangeUserId = new int?(this._currentUser.User_ID),
             ObjectId     = new int?(num)
         };
         this._context.Insert(log);
         object oldEntity = this.GetOldEntity(es, entity);
         foreach (string str in modifiedColumns)
         {
             object obj3 = oldEntity.GetPropertyValue(str, null);
             object obj4 = entity.GetPropertyValue(str, null);
             if ((((obj3 != null) && (obj4 == null)) || ((obj3 == null) && (obj4 != null))) || (((obj3 != null) && (obj4 != null)) && !obj3.Equals(obj4)))
             {
                 SysChangeLogDetail detail = new SysChangeLogDetail {
                     DetailId      = this.GetNextIdentity(),
                     LogId         = new long?(log.LogId),
                     CurrentValue  = Convert.ToString(obj4),
                     OriginalValue = Convert.ToString(obj3),
                     DataType      = new int?(es.PropertyTypeEnums[str]),
                     FieldName     = str
                 };
                 this._context.Insert(detail);
             }
         }
     }
 }
Beispiel #2
0
        private string GetChangeFieldDisplayText(SysChangeLog log, SysChangeLogDetail logDetail)
        {
            string    result = string.Empty;
            SysEntity entity = this.EntityCache.SysEntity.FirstOrDefault(p => p.EntityName == log.EntityName);

            if (entity != null)
            {
                SysField field = entity.Fields.FirstOrDefault(p => p.FieldName == logDetail.FieldName);
                if (field != null)
                {
                    result = field.DisplayText;
                }
            }
            return(result);
        }