public IEnumerable <JObject> SelectAuditTypes() { for (AuditType t = AuditType.Insert; t <= AuditType.Delete; t++) { yield return(new JObject().AddRange("id", (int)t, "value", t.UnCamel())); } }
/// <summary> /// Creates the audit log. /// </summary> /// <param name="entity">The entity.</param> /// <param name="auditType">Type of the audit.</param> /// <returns></returns> /// <exception cref="System.InvalidOperationException"></exception> private static AuditChangeLog CreateAuditLog(Entity <int> entity, AuditType auditType) { var entityType = entity.GetType(); var auditableAttr = entityType.GetCustomAttributes(typeof(AuditableAttribute), false); if (!auditableAttr.Any()) { throw new InvalidOperationException(string.Format("A valid auditable attribute could not be found on \"{0}\".", entityType.Name)); } var attribute = auditableAttr.OfType <AuditableAttribute>().First(); // var auditLog = (AuditChangeLog)Activator.CreateInstance(attribute.AuditLogType, new object[] { auditType, entity }); var auditLog = (AuditChangeLog)Activator.CreateInstance(attribute.AuditLogType); auditLog.InitLog(entity); auditLog.Action = auditType; auditLog.Owner = entity; auditLog.OwnerId = entity.Id; auditLog.OwnerType = entity.GetType().Name; auditLog.ActionBy = MonahrqContext.GetUserName; auditLog.CreateDate = DateTime.Now; return(auditLog); }
public AuditItem(int objectId, string comment, AuditType type, int userId) { Id = objectId; Comment = comment; AuditType = type; UserId = userId; }
private void ToExamine() { Guid id = Guid.Parse(Request.QueryString["CompanyId"]); CompanyType type = (CompanyType)byte.Parse(Request.QueryString["CompanyType"]); AccountBaseType accounType = (AccountBaseType)byte.Parse(Request.QueryString["AccountType"]); AuditType auditType = (AuditType)int.Parse(Request.QueryString["AuditType"]); var address = ChinaPay.B3B.TransactionWeb.PublicClass.AddressShow.GetAddressBaseInfo(hfldAddressCode.Value); bool isUpgrade = false; CompanyUpgrade companyUpgrade = null; if (auditType == AuditType.ApplyAudit) { isUpgrade = true; companyUpgrade = CompanyUpgradeService.QueryCompanyUpgrade(id); } if ((type == CompanyType.Provider && !isUpgrade) || (isUpgrade && companyUpgrade.Type == CompanyType.Provider)) { AccountCombineService.AuditProviderInfo(id, GetProviderAuditInfo(address, isUpgrade)); } else { if (accounType == AccountBaseType.Individual) { AccountCombineService.AuditSupplier(id, GetSupplierIndividualAuditInfo(address, isUpgrade)); } else { AccountCombineService.AuditSupplier(id, GetSupplierEnterpriseInfo(address, isUpgrade)); } } }
public string GetAuditDescription(AuditType action, bool forApproval = false) { var pad = forApproval ? " Subject to approval." : string.Empty; // var agency = Agent == null ? string.Empty : $" - {Agent?.Name}"; switch (action) { case AuditType.Create: return($" User ({UserName}({PhoneNumber}) created.{pad}"); case AuditType.Update: return($"User ({UserName}({PhoneNumber}) was updated.{pad}"); case AuditType.Delete: return($"Deletion of user ({UserName}({PhoneNumber}).{pad}"); case AuditType.View: return($"View user ({UserName}({PhoneNumber})"); case AuditType.Suspend: return($"Suspended user ({UserName}({PhoneNumber})"); case AuditType.List: return($"Accessed List of Users "); case AuditType.Authorize: default: break; } return(null); }
public void WriteToAuditLog(AuditType type, string actor = null, string information = null) { try { using (var conn = new SqlConnection(Configuration.BEKDBConnectionString)) { using (var cmd = new SqlCommand("[dbo].[spCreateAuditLogEntry]", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Type", SqlDbType.Int).Value = type; cmd.Parameters.Add("@TypeDescription", SqlDbType.NVarChar).Value = EnumUtils <AuditType> .GetDescription(type); cmd.Parameters.Add("@Actor", SqlDbType.NVarChar).Value = actor; cmd.Parameters.Add("@Information", SqlDbType.NVarChar).Value = information; cmd.CommandTimeout = 0; conn.Open(); cmd.ExecuteNonQuery(); } } } catch // (Exception ex) { } //For now, swallow any exception }
/// <summary> /// Register the /// </summary> private NLogAudit(AuditType minType, AuditTarget[] targets) { var config = new NLog.Config.LoggingConfiguration(); var minLevel = Translate(minType); foreach (var t in targets) { NLog.Targets.Target target = null; switch (t) { case AuditTarget.Console: target = new NLog.Targets.ColoredConsoleTarget("console"); break; case AuditTarget.File: target = new NLog.Targets.FileTarget("logfile") { FileName = GetDefaultLogFileName() }; break; case AuditTarget.Db: default: throw new NotImplementedException($"Audit target {t}"); } config.AddRule(minLevel, NLog.LogLevel.Fatal, target); } NLog.LogManager.Configuration = config; logger = NLog.LogManager.GetCurrentClassLogger(); Audit.Register(this); }
public string GetAuditDescription(AuditType action, bool forApproval) { var pad = forApproval ? " Subject to approval." : string.Empty; switch (action) { case AuditType.Create: return($"Bank (({Name}) created."); case AuditType.Update: return($"Bank({Name}) was updated."); case AuditType.Delete: return($"Deletion of bank ({Name})"); case AuditType.View: return($"View bank ({Name})"); case AuditType.Suspend: return($"Suspended bank ({Name})"); case AuditType.List: return($"Accessed List of Banks"); case AuditType.Authorize: default: break; } return(null); }
public async Task CreateAudit <TEntity>(TEntity entity, AuditType action) where TEntity : class, IEntityBase, IAuditDescriptionBase { var type = entity.GetType(); var trail = new AuditTrail() { EntityId = $"{entity.GetId()}", Action = Enum.GetName(typeof(AuditType), action), Entity = type.Name, Description = entity.GetAuditDescription(action) }; var entry = Db.Entry(entity); var props = from prop in type.GetProperties() let info = prop.PropertyType.GetTypeInfo() let map = prop.GetCustomAttributes(typeof(NotMappedAttribute), true) // let empty = prop.GetCustomAttributes(typeof(ByPassAttribute), true) where prop.Name != "Id" && (info.IsValueType || prop.PropertyType.IsAssignableFrom(typeof(string))) && !map.Any() select prop; switch (action) { case AuditType.Create: trail.NewValues = props.Aggregate(new StringBuilder(Environment.NewLine), (s, prop) => s.AppendLine($"{prop.Name}: {entry.CurrentValues[prop.Name]}")).ToString(); break; case AuditType.Update: var original = await entry.GetDatabaseValuesAsync(); props = from prop in props where !Equals(entry.CurrentValues[prop.Name], original[prop.Name]) select prop; trail.NewValues = props.Aggregate(new StringBuilder(Environment.NewLine), (s, prop) => s.AppendLine($"{prop.Name}: {entry.CurrentValues[prop.Name]}")).ToString(); trail.OriginalValues = props.Aggregate(new StringBuilder(Environment.NewLine), (s, prop) => s.AppendLine($"{prop.Name}: {original[prop.Name]}")).ToString(); break; case AuditType.Delete: trail.OriginalValues = props.Aggregate(new StringBuilder(Environment.NewLine), (s, prop) => s.AppendLine($"{prop.Name}: {entry.CurrentValues[prop.Name]}")).ToString(); break; case AuditType.Authorize: case AuditType.Suspend: case AuditType.Resume: case AuditType.List: case AuditType.View: default: break; } Db.AuditTrails.Add(trail); await Db.SaveChangesAsync(); }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); RegisterOEMSkins("register.css"); if (!IsPostBack) { string id = Request.QueryString["CompanyId"]; string auditTypeValue = Request.QueryString["AuditType"]; AuditType auditType = (AuditType)int.Parse(auditTypeValue); this.hfdCompanyId.Value = id; this.hfdAuditType.Value = auditTypeValue; if (!string.IsNullOrWhiteSpace(id)) { Guid companyId = Guid.Parse(id); if (auditType == AuditType.NormalAudit) { BindInfo(companyId); } else { BindUpgradeInfo(companyId); } } } }
public AddToAuditLogMessage(AuditType auditType, string description, int authStaffID = 0) { m_id = 18264; // Modify Channel Data Message AuditEntryType = auditType; Description = description; AuthorizedStaffID = authStaffID; }
public AuditEntry(string target, string subcategory, string subcategoryGuid, AuditType auditType) { Target = target; Subcategory = subcategory; SubcategoryGUID = subcategoryGuid; AuditType = auditType; }
/// <summary> /// 设置节点审核状态 /// 主要用于辅助流程无效或退回 /// </summary> /// <param name="audityType">审核状态</param> public virtual void SetAudityType(AuditType audityType) { foreach (var node in this.nodes) { node.SetAuditType(audityType); } }
public IEnumerable <AuditLog> GetLog(AuditType logType, DateTime?sinceDate = null) { var result = _auditService.GetLogs(Enum <AuditType> .Parse(logType.ToString()), sinceDate); var mapped = _umbracoMapper.MapEnumerable <IAuditItem, AuditLog>(result); return(mapped); }
/// <summary> /// 设置未审核节点状态 /// 主要用于辅助流程无效或退回 /// </summary> /// <param name="audityType">审核状态</param> internal protected virtual void SetAuditType(AuditType audityType) { if (this.AuditType == WorkFlowEngine.AuditType.UnAudit) { this.conclusion.AuditType = audityType; } }
public override int GetHashCode() { unchecked { var hashCode = 1561563491; hashCode = (hashCode * 157) + Id.GetHashCode(); hashCode = (hashCode * 157) + WorkflowID.GetHashCode(); hashCode = (hashCode * 157) + ExecutionID.GetHashCode(); hashCode = (hashCode * 157) + ExecutionOrigin.GetHashCode(); hashCode = (hashCode * 157) + IsSubExecution.GetHashCode(); hashCode = (hashCode * 157) + IsRemoteWorkflow.GetHashCode(); hashCode = (hashCode * 157) + WorkflowName.GetHashCode(); hashCode = (hashCode * 157) + AuditType.GetHashCode(); hashCode = (hashCode * 157) + PreviousActivity.GetHashCode(); hashCode = (hashCode * 157) + PreviousActivityType.GetHashCode(); hashCode = (hashCode * 157) + PreviousActivityId.GetHashCode(); hashCode = (hashCode * 157) + NextActivity.GetHashCode(); hashCode = (hashCode * 157) + NextActivityType.GetHashCode(); hashCode = (hashCode * 157) + NextActivityId.GetHashCode(); hashCode = (hashCode * 157) + ServerID.GetHashCode(); hashCode = (hashCode * 157) + ParentID.GetHashCode(); hashCode = (hashCode * 157) + ExecutingUser.GetHashCode(); hashCode = (hashCode * 157) + ExecutionOriginDescription.GetHashCode(); hashCode = (hashCode * 157) + ExecutionToken.GetHashCode(); hashCode = (hashCode * 157) + AdditionalDetail.GetHashCode(); hashCode = (hashCode * 157) + Environment.GetHashCode(); hashCode = (hashCode * 157) + AuditDate.GetHashCode(); return(hashCode); } }
public void Add(AuditType type, int userId, int objectId, string entityType, string comment, string parameters = null) { using (var scope = ScopeProvider.CreateScope()) { _auditRepository.Save(new AuditItem(objectId, type, userId, entityType, comment, parameters)); scope.Complete(); } }
/// <summary> /// Adds one audit entry to auditInfo entities. /// </summary> /// <param name="affectedEntityName">Name of the affected entity.</param> /// <param name="actionType">Type of the action.</param> /// <param name="actionData">The action data.</param> private void AddAuditEntryToList(string affectedEntityName, AuditType actionType, string actionData) { // create a new audit unit AuditInfoEntity auditInfo = ConstructAuditInfo(affectedEntityName, actionType, actionData); // adds for further DB persist AddAuditEntryToList(auditInfo); }
/// <summary> /// Initializes a new instance of the <see cref="MetamodelEntity"/> class. /// </summary> /// <param name="entityType">Type of the entity.</param> public MetamodelEntity(Type entityType) { this.EntId = 0; this.AuditType = AuditType.None; this.EntityType = entityType; this.DtoTypes = new List <Type>(); this.Fields = new List <IMetamodelField>(); }
/// <summary> /// 流程退回 /// </summary> /// <param name="flowEngine"></param> public bool Returned(FlowEngine flowEngine, AuditType auditType, string auditDesc, int userId) { if (this.Audit(flowEngine, auditType, auditDesc, userId)) { flowEngine.Returned(); return(true); } return(false); }
public AuditType Update(AuditType auditType) { AuditsTypes typeDB = _mapper.Map <AuditType, AuditsTypes>(auditType); _ctx.AuditsTypes.Update(typeDB); _ctx.SaveChanges(); return(_mapper.Map <AuditsTypes, AuditType>(typeDB)); }
public void UpdateCheckShippingAuditTypeBySysNo(int soSysNo, AuditType auditType, string autoAuditMemo) { DataCommand command = DataCommandManager.GetDataCommand("SO_Update_CheckShippingAuditType"); command.SetParameterValue("@SOSysNo", soSysNo); command.SetParameterValue("@AuditType", (int)auditType); command.SetParameterValue("@AutoAuditMemo", autoAuditMemo); command.ExecuteNonQuery(); }
public IAuditor GetAuditor(AuditType type) { if (type == AuditType.User) { return(userAuditor); } return(messageAuditor); }
private void Audit(AuditType type, string message, int userId, int objectId) { var uow = _dataUowProvider.GetUnitOfWork(); using (var auditRepo = _repositoryFactory.CreateAuditRepository(uow)) { auditRepo.AddOrUpdate(new AuditItem(objectId, message, type, userId)); uow.Commit(); } }
public void Add(AuditType type, string comment, int userId, int objectId) { using (var uow = UowProvider.GetUnitOfWork()) { var repo = RepositoryFactory.CreateAuditRepository(uow); repo.AddOrUpdate(new AuditItem(objectId, comment, type, userId)); uow.Commit(); } }
public IEnumerable <AuditLog> GetCurrentUserLog(AuditType logType, DateTime?sinceDate) { long totalRecords; var dateQuery = sinceDate.HasValue ? Query <IAuditItem> .Builder.Where(x => x.CreateDate >= sinceDate) : null; var result = Services.AuditService.GetPagedItemsByUser(Security.GetUserId(), 1, int.MaxValue, out totalRecords, auditTypeFilter: new[] { logType }, customFilter: dateQuery); return(Mapper.Map <IEnumerable <AuditLog> >(result)); }
public async Task Add(AuditType type, string message) { var dbAudit = new DbAudit(type, message); SetInitialRecordValues(dbAudit); using (var ctx = GetContext()) { await ctx.AuditLogs.InsertOneAsync(dbAudit); } }
/// <summary> /// Sets the audit trail information for an entity. /// </summary> /// <param name="name">The name.</param> /// <param name="entId">The entity identifier.</param> /// <param name="auditType">Type of the audit.</param> public void SetAudit(string name, int entId, AuditType auditType) { IMetamodelEntity entity = this.GetEntityByName(name); if (entity != null) { entity.EntId = entId; entity.AuditType = auditType; } }
public IEnumerable <AuditLog> GetLog(AuditType logType, DateTime?sinceDate) { if (sinceDate == null) { sinceDate = DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0, 0)); } return(Mapper.Map <IEnumerable <AuditLog> >( Log.Instance.GetLogItems(Enum <LogTypes> .Parse(logType.ToString()), sinceDate.Value))); }
public IEnumerable <IAuditItem> Get(AuditType type, IQuery <IAuditItem> query) { var sqlClause = GetBaseQuery(false) .Where <LogDto>(x => x.Header == type.ToString()); var translator = new SqlTranslator <IAuditItem>(sqlClause, query); var sql = translator.Translate(); var dtos = Database.Fetch <LogDto>(sql); return(dtos.Select(x => new AuditItem(x.NodeId, Enum <AuditType> .Parse(x.Header), x.UserId ?? Constants.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList()); }
public static void AddAuditEntry(GamePlayer player, AuditType type, AuditSubtype subType, string oldValue, string newValue) { AddAuditEntry(player.Client, type, subType, oldValue, newValue); }
public static void AddAuditEntry(GameClient client, AuditType type, AuditSubtype subType, string oldValue, string newValue) { AddAuditEntry(client, (int)type, (int)subType, oldValue, newValue); }
public static void AddAuditEntry(GameClient client, AuditType type, AuditSubtype subType) { AddAuditEntry(client, (int)type, (int)subType, "", ""); }
public static void AddAuditEntry(AuditType type, AuditSubtype subType, string oldValue, string newValue) { AddAuditEntry((int)type, (int)subType, oldValue, newValue); }
/// <summary> /// 设置节点审核状态 /// 主要用于辅助流程无效或退回 /// </summary> /// <param name="audityType">审核状态</param> public virtual void SetAudityType(AuditType audityType) { foreach (var node in this.nodes) { node.SetAuditType(audityType); } }
/// <summary> /// Purpose: Grabs all audit types /// Accepts: Nothing /// Returns: List<AuditType> /// </summary> public List<AuditType> GetAllAuditTypes() { List<AuditType> audittypes = new List<AuditType>(); try { AuditTypeData data = new AuditTypeData(); List<QSRDataObjects.AuditType> dataAudits = data.GetAllAuditTypes(); foreach (QSRDataObjects.AuditType at in dataAudits) { AuditType audittype = new AuditType(); audittype.AuditTypeID = Convert.ToInt32(at.AuditTypeID); audittype.Description = at.Description; audittype.IsAdmin = at.IsAdmin; audittypes.Add(audittype); } } catch (Exception ex) { ErrorRoutine(ex, "AuditType", "GetAllAuditTypes"); } return audittypes; }
public void AddToAuditTypes(AuditType auditType) { base.AddObject("AuditTypes", auditType); }
public static AuditType CreateAuditType(int ID, string auditTypeDescription, bool inUse, byte[] rowVersion) { AuditType auditType = new AuditType(); auditType.Id = ID; auditType.AuditTypeDescription = auditTypeDescription; auditType.inUse = inUse; auditType.RowVersion = rowVersion; return auditType; }
/// <summary> /// 流程退回 /// </summary> /// <param name="flowEngine"></param> public bool Returned(FlowEngine flowEngine, AuditType auditType, string auditDesc, int userId) { if (this.Audit(flowEngine, auditType, auditDesc, userId)) { flowEngine.Returned(); return true; } return false; }
/// <summary> /// 流程审核 /// </summary> /// <param name="flowEngine">流程</param> /// <param name="auditType">审核类型</param> /// <param name="auditDesc">审核描述</param> /// <param name="userId">Sys_User.Id</param> /// <returns>true 审核成功 false 不能审核</returns> public bool Audit(FlowEngine flowEngine, AuditType auditType, string auditDesc, int userId) { using (AppBLL bll = new AppBLL()) { Participant participant = null; Conclusion conclusion = null; IList<FunctionEntity> userFuncs = bll.FillList<FunctionEntity>("Usp_Funcs_ByUser", new { UserId = userId }); foreach (var userFunc in userFuncs) { participant = new Participant() { Category = 1, Department = -1, Reference = (long)userFunc.Id }; conclusion = new Conclusion(auditType, (long)userId, DateTime.Now) { Description = auditDesc }; if (flowEngine.Audit(conclusion, participant)) { return true; } } participant = new Participant() { Category = 0, Department = userId, Reference = -1 }; conclusion = new Conclusion(auditType, userId, DateTime.Now) { Description = auditDesc }; if (flowEngine.Audit(conclusion, participant)) { return true; } } return false; }
public RenderAuditType(AuditType at) { AuditTypeID = Convert.ToInt32(at.AuditTypeID); Description = Convert.ToString(at.Description); IsAdmin = Convert.ToBoolean(at.IsAdmin); }
public WealthTrackerEventArgs(AuditType auditType, Item item, object parent, Mobile from) { m_auditType = auditType; m_item = item; m_parent = parent; m_from = from; }
/// <summary> /// Initializes a new instance of the <see cref="Conclusion"/> class. /// </summary> /// <param name="auditType">审核类型</param> /// <param name="auditer">审核人</param> /// <param name="auditDate">审核日期</param> public Conclusion(AuditType auditType, long auditer, DateTime? auditDate) { this.auditer = auditer; this.AuditType = auditType; this.AuditDate = auditDate; }