// form Properties ///////////////////////////

        public virtual HistoryEvent CreateFormPropertyUpdateEvt(ExecutionEntity execution, string propertyId, string propertyValue, string taskId)
        {
            IDGenerator idGenerator = Context.ProcessEngineConfiguration.IdGenerator;

            HistoricFormPropertyEventEntity historicFormPropertyEntity = NewHistoricFormPropertyEvent();

            historicFormPropertyEntity.Id                  = idGenerator.NewGuid();//.NextId;
            historicFormPropertyEntity.EventType           = HistoryEventTypes.FormPropertyUpdate.EventName;
            historicFormPropertyEntity.TimeStamp           = ClockUtil.CurrentTime;
            historicFormPropertyEntity.ActivityInstanceId  = execution.ActivityInstanceId;
            historicFormPropertyEntity.ExecutionId         = execution.Id;
            historicFormPropertyEntity.ProcessDefinitionId = execution.ProcessDefinitionId;
            historicFormPropertyEntity.ProcessInstanceId   = execution.ProcessInstanceId;
            historicFormPropertyEntity.PropertyId          = propertyId;
            historicFormPropertyEntity.PropertyValue       = propertyValue;
            historicFormPropertyEntity.TaskId              = taskId;
            historicFormPropertyEntity.TenantId            = execution.TenantId;

            ProcessDefinitionEntity definition = execution.GetProcessDefinition();

            if (definition != null)
            {
                historicFormPropertyEntity.ProcessDefinitionKey = definition.Key;
            }

            // initialize sequence counter
            InitSequenceCounter(execution, historicFormPropertyEntity);

            return(historicFormPropertyEntity);
        }
 protected void EnsureHasId(TEntity dbEntity)
 {
     if (dbEntity.Id == null)
     {
         String nextId = _idGenerator.NewGuid();
         dbEntity.Id = nextId;
     }
 }
        public void AddPermissionToRole(Guid roleID, Guid permissionID)
        {
            var rolePermissionID = IDGenerator.NewGuid(_serverCode[0]);
            var createdBy        = _principal.Id;

            _rolePermissionService.Insert(new RolePermission()
            {
                RolePermissionID = rolePermissionID,
                PermissionID     = permissionID,
                RoleID           = roleID,
                CreatedDate      = DateTime.Now,
                CreatedBy        = createdBy
            });
        }
        public void Create(RoleEditModel roleToCreate)
        {
            var role = new ApplicationRole
            {
                Id          = IDGenerator.NewGuid(_serverCode[0]),
                Name        = roleToCreate.Name,
                Description = roleToCreate.Description,

                CreatedBy   = _principal.Id,
                CreatedDate = DateTime.Now,
                ObjectState = ObjectState.Added
            };

            _applicationRoleService.Insert(role);
        }
 public void NewGuidTest()
 {
     var id1 = IDGenerator.NewGuid("N");
     var id3 = IDGenerator.NewGuidCombo();
     var id4 = IDGenerator.NewSnowflakeID(1);
 }