/// <summary> /// This creates an auditlog (history) for the watcher and custom field manipulations /// </summary> /// <param name="context"></param> /// <param name="issueId"></param> /// <param name="issueProjectId"></param> /// <param name="customField"></param> /// <param name="beforeValue"></param> /// <param name="afterValue"></param> /// <param name="userId"></param> /// <param name="username"></param> public void CreateAuditlog(GeminiContext context, int issueId, int issueProjectId, CustomFieldDataDto customField, string beforeValue, string afterValue, int userId, string username) { try { IssueAuditManager issueAuditManager = new IssueAuditManager(GeminiApp.Cache(), GeminiApp.UserContext(), context); UserManager userManager = new UserManager(GeminiApp.Cache(), GeminiApp.UserContext(), context); IssueAudit audit = issueAuditManager.GetIssueAuditObject(issueId, issueProjectId); audit.UserId = userId; audit.Fullname = username; if (customField == null) { issueAuditManager.LogChange(audit, ItemAttributeVisibility.AssociatedWatchers, string.Empty, string.Empty, beforeValue, afterValue); } else { issueAuditManager.LogChange(audit, ItemAttributeVisibility.AssociatedCustomFields, customField.Entity.CustomFieldId.ToString(), string.Empty, string.Empty, beforeValue, afterValue); } } catch (Exception exception) { GeminiApp.LogException(exception, false, exception.Message); } }
/// <summary> /// This creates an auditlog for the custom field manipulations /// </summary> /// <param name="context"></param> /// <param name="issueId"></param> /// <param name="issueProjectId"></param> /// <param name="customField"></param> /// <param name="beforeValue"></param> /// <param name="afterValue"></param> public void CreateAuditlog(GeminiContext context, int issueId, int issueProjectId, CustomFieldDataDto customField, string beforeValue, string afterValue) { IssueAuditManager issueAuditManager = new IssueAuditManager(GeminiApp.Cache(), GeminiApp.UserContext(), context); IssueAudit audit = issueAuditManager.GetIssueAuditObject(issueId, issueProjectId); issueAuditManager.LogChange(audit, ItemAttributeVisibility.AssociatedCustomFields, customField.Entity.CustomFieldId.ToString(), string.Empty, string.Empty, beforeValue, afterValue); }