Example #1
0
        private Guid?LogHistoryTracking(IHistoryTracker obj, string subObjectName)
        {
            var recordType = ObjectContext.GetObjectType(obj.GetType()).FullName;
            //var recordId = ((EntityBase)obj).Id;
            var objectName = obj.ObjectName;

            var userId          = Guid.Parse("98e83503-936e-4ebb-9a61-4cb2b2adbc95");//guid system
            var historyTracking = new HistoryTrackingAudit
            {
                Id            = Guid.NewGuid(),
                RecordId      = Guid.NewGuid(),
                RecordType    = recordType,
                ObjectName    = objectName ?? string.Empty,
                SubObjectName = subObjectName,
                InsertedById  = userId,
                InsertedAt    = DateTime.Now,
                UpdatedById   = userId,
                UpdatedAt     = DateTime.Now,
            };

            if (!string.IsNullOrEmpty(historyTracking.ObjectName))
            {
                _unitOfWork.HistoryTrackingAuditRepository.Add(historyTracking);
                return(historyTracking.Id);
            }
            return(null);
        }
        private static Guid?LogHistoryTracking(IHistoryTracker obj, string subObjectName)
        {
            var recordType = ObjectContext.GetObjectType(obj.GetType()).FullName;
            //var recordId = ((EntityBase)obj).Id;
            var objectName = obj.ObjectName;

            var historyTracking = new HistoryTrackingAudit
            {
                Id            = Guid.NewGuid(),
                RecordId      = Guid.NewGuid(),
                RecordType    = recordType,
                ObjectName    = objectName ?? string.Empty,
                SubObjectName = subObjectName
            };

            if (!string.IsNullOrEmpty(historyTracking.ObjectName))
            {
                _unitOfWork.HistoryTrackingAuditRepository.Add(historyTracking);
                return(historyTracking.Id);
            }
            return(null);
        }