public virtual void DeleteInstance(IWorkflowInstance instance) { EntityEventManager.RaiseEvent <IWorkflowInstance>(EventStep.Before, EventType.Delete, instance); InstanceService.Delete(instance); EntityEventManager.RaiseEvent <IWorkflowInstance>(EventStep.After, EventType.Delete, instance); WorkflowInstanceLog(instance, "删除"); }
public virtual void AddInstance(IWorkflowInstance instance) { EntityEventManager.RaiseEvent <IWorkflowInstance>(EventStep.Before, EventType.Insert, instance); InstanceService.Insert(instance); EntityEventManager.RaiseEvent <IWorkflowInstance>(EventStep.After, EventType.Insert, instance); WorkflowInstanceLog(instance, "新增"); }
public virtual int Insert(TEntity item) { int result = 0; if (item is ILastUpdateTime) { (item as ILastUpdateTime).LastUpdateTime = DateTime.Now; } if (item is IEntity) { var i = item as IEntity; if (i.Id.IsNullOrEmpty()) { i.Id = Guid.NewGuid().ToString(); i.RentId = 1; } } EntityEventManager.RaiseEvent <TEntity>(EventStep.Before, EventType.Insert, item); result = Dao.Get().Insert(item); if (result > 0) { if (item is IExtProperty) { (item as IExtProperty).SetProperty(); } EntityEventManager.RaiseEvent <TEntity>(EventStep.After, EventType.Insert, item); } return(result); }
public virtual int Delete(object id) { TEntity item = default(TEntity); if (id is TEntity) { item = (TEntity)id; } else { item = Get(id); } EntityEventManager.RaiseEvent <TEntity>(EventStep.Before, EventType.Delete, item); int result = Dao.Get().Delete(item); if (result > 0) { EntityEventManager.RaiseEvent <TEntity>(EventStep.After, EventType.Delete, item); } return(result); }
public virtual int Update(TEntity item) { if (item is ILastUpdateTime) { (item as ILastUpdateTime).LastUpdateTime = DateTime.Now; } if (item is IEntity) { var i = item as IEntity; i.RentId = 1; } EntityEventManager.RaiseEvent <TEntity>(EventStep.Before, EventType.Update, item); int result = Dao.Get().Update(item); if (result > 0) { if (item is IExtProperty) { (item as IExtProperty).SetProperty(); } EntityEventManager.RaiseEvent <TEntity>(EventStep.After, EventType.Update, item); } return(result); }