Ejemplo n.º 1
0
 public void Handle(ProductCreated @event)
 {
     _auditRepository.Add(new Audit()
     {
         Id          = @event.EventId.ToString(),
         Name        = @event.GetType().ToString(),
         Details     = @event.Name,
         CreatedTime = @event.EventPublished.UtcDateTime
     });
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostAudit([FromBody] Audit audit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _auditRepository.Add(audit);
            await _unitOfWork.SaveChangesAsync();

            return(CreatedAtAction("GetAudit", new { id = audit.Id }, audit));
        }
Ejemplo n.º 3
0
        public void Save()
        {
            var correlationId = Guid.NewGuid();
            var auditDate     = DateTime.UtcNow;

            foreach (var item in _trackedItems)
            {
                var updated = item.Operation == AuditOperation.Delete ? null : _stateService.GetState(item.TrackedEntity);

                var initialState = item.InitialState == null ? null : JsonConvert.SerializeObject(item.InitialState);
                var updatedState = updated == null ? null : JsonConvert.SerializeObject(updated);

                var diff = _diffService.GenerateDiff(item.InitialState, updated);

                var audit = new Audit
                {
                    Id            = Guid.NewGuid(),
                    EntityType    = item.TrackedEntity.GetType().Name,
                    EntityId      = item.TrackedEntity.Id,
                    UserId        = _userId,
                    UserName      = _userName,
                    UserAction    = _userAction.ToString(),
                    AuditDate     = auditDate,
                    InitialState  = initialState,
                    UpdatedState  = updatedState,
                    Diff          = JsonConvert.SerializeObject(diff),
                    CorrelationId = correlationId
                };

                _auditRepository.Add(audit);
            }
        }
        public async Task <IActionResult> AddCountry([FromBody] CountryModel model)
        {
            //var currentUser = CurrentUser();
            //model. = currentUser?.UserId;

            var add = await _countryManager.AddCountry(model);

            await _auditRepository.Add(new AuditModel { AuditType = "Add Country", Description = User.Identity.Name + "Added a new Country", AuthUser = User.Identity.Name });

            return(Ok(new ApiResponse <CountryModel>()
            {
                Data = model,
                Message = "Succeeded",
                StatusCode = HttpStatusCode.OK
            }));
        }
Ejemplo n.º 5
0
        public void Process()
        {
            this.ContinueNow = true;

            _auditRepository.Add(new Audit {
                OrderId = OrderInfo.Id, Message = "Order Processor started.", Code = 10000
            });
        }
Ejemplo n.º 6
0
        public virtual void Raise(AbstractModel model)
        {
            var audit = new Audit()
            {
                Value = model.ToString()
            };

            _auditRepository.Add(audit);
            _auditRepository.Complete();
        }
 public async Task <int> AddAudit(MarkDTO task)
 {
     try
     {
         var audit = new Audits
         {
             Id      = Guid.NewGuid(),
             Who     = task.Task.Id.ToString(),
             Created = DateTime.Now
         };
         var list = ((Task <List <Marks> >)task.Task).Result;
         audit.Total   = list.Sum(x => x.Score);
         audit.Filters = task.Filter;
         return(await _auditRepository.Add(audit));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(0);
     }
 }
Ejemplo n.º 8
0
        public async Task <IActionResult> Create([FromBody] SaveAuditResource auditResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var audit = mapper.Map <SaveAuditResource, Audit>(auditResource);

            auditRepository.Add(audit);
            if (await unitOfWork.CompleteAsync() == false)
            {
                throw new Exception(message: $"Create new audit fail on save");
            }

            audit = await auditRepository.GetOne(audit.Id);

            var result = mapper.Map <Audit, ViewAuditResource>(audit);

            return(Ok(result));
        }
Ejemplo n.º 9
0
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            AuditWorkflowData auditWorkflowData = new AuditWorkflowData();

            auditWorkflowData.PlantID         = PlantID;
            auditWorkflowData.SectorID        = SectorID;
            auditWorkflowData.AuditorID       = AuditorID;
            auditWorkflowData.ExternalAuditor = ExternalAuditor;
            auditWorkflowData.CreationDate    = CreationDate;
            auditWorkflowData.AuditInitDate   = AuditInitDate;
            auditWorkflowData.AuditTypeID     = AuditTypeID;
            auditWorkflowData.AuditStandard   = AuditStandard;
            auditWorkflowData.AuditStateID    = _auditStateRepository.GetOneByCode("PRO");
            auditWorkflowData.WorkflowId      = context.Workflow.Id;

            _auditRepository.Add(auditWorkflowData);

            //Responsible of sector-plant
            List <string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(PlantID, SectorID);

            EmailAddresses.AddRange(sectorPlantReferrents);

            //If auditor is internal, send email
            if (!string.IsNullOrEmpty(AuditorID))
            {
                EmailAddresses.Add(_auditRepository.GetAuditorEmail(AuditorID));
            }

            auditWorkflowData = _auditRepository.GetOneByWorkflowId(auditWorkflowData.WorkflowId);
            var emailType = "schedule";

            this.EmailSubject = EmailStrings.GetSubjectAudit(auditWorkflowData.AuditTypeName, emailType);
            this.EmailMessage = EmailStrings.GetMessageAudit(auditWorkflowData, _emailSettings.Url, emailType);

            return(ExecutionResult.Next());
        }
Ejemplo n.º 10
0
 public async Task Audit(AuditType type, string message)
 {
     await auditRepository.Add(type, message);
 }
Ejemplo n.º 11
0
 public virtual void Raise(AbstractModel model)
 {
     _auditRepository.Add(model.ToString());
 }
Ejemplo n.º 12
0
 public IReadOnlyList <ProjectCard> Get()
 {
     _audit.Add("Get all cards");
     return(_repository.GetBacklogCards());
 }