/// <summary> /// Constructor /// </summary> /// <param name="action"></param> /// <param name="user"></param> public UserInfo(EntityAction action, User user) { InitializeComponent(); entityAction = action; this.dataLogic = new FileDb(); GridHelper.InitializeGrid <Address>(dgvAddresses); User = user; if (action == EntityAction.Edit) { PopulateInfo(); } else { User = new User(); User.PrimaryKey = Guid.NewGuid(); } if (User.Addresses == null) { User.Addresses = new List <Address>(); } }
public IPacket ReadPacket(IMinecraftDataReader reader) { EntityID = reader.ReadVarInt(); Action = (EntityAction) reader.ReadByte(); return this; }
public Task ValidateAccessToEntityAsync( ITenantEntity entity, EntityAction desiredAction) { if (null == entity) { return(Task.CompletedTask); } // this call may throw exception if the user doesn't have // the validated TenantId claim var _userTenantId = _tenantIdProvider.GetTenantId(); if (TenantSpec.BelongsToSite(_userTenantId)) { // simple tenant access (no permissions) // 'site user' can access entities within any tenant // for the purposes of administration return(Task.CompletedTask); } if (_userTenantId != entity.TenantId) { var message = $"User belonging to tenant {_userTenantId} has been denied access " + $"to entity '{entity.GetType().Name}' belonging to tenant {entity.TenantId}"; throw new UnauthorizedAccessException(message); } return(Task.CompletedTask); }
public SchoolYearScoreEditor(string schoolYear, string gradeyear, string refStudentID) { InitializeComponent(); _StudentID = refStudentID; beforeXml.AddElement("SubjectGradeYear"); afterXml.AddElement("SubjectGradeYear"); beforeXml.AddElement("SubjectCollection"); beforeXml.AddElement("EntryCollection"); afterXml.AddElement("SubjectCollection"); afterXml.AddElement("EntryCollection"); entityAction = EntityAction.Update; comboBoxEx3.Items.AddRange(new object[] { "1", "2", "3", "4" }); //2019/7/10 - 原本顯示身分證號,但是應該顯示學號 by俊威,佳樺 labelX10.Text = Student.Instance.Items[_StudentID].StudentNumber + " " + Student.Instance.Items[_StudentID].Name; this.comboBoxEx1.Text = schoolYear; this.comboBoxEx3.Text = gradeyear; comboBoxEx1.Enabled = false; ReLoad(null, null); ValidateAll(); btnSave.Visible = CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; dataGridViewX1.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; comboBoxEx1.Enabled = CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; comboBoxEx3.Enabled = CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX1.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX2.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX3.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX4.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX5.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX6.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; textBoxX7.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable; }
public void InvokeEntityActionCorrectly(EntityAction actionToInvoke) { // Arrange EntityAction testAction = actionToInvoke; BIWEntity testEntity = new BIWEntity(); BIWEntity returnedEntity = null; switch (actionToInvoke) { case EntityAction.SELECT: inspectorController.OnEntityClick += (entity) => { returnedEntity = entity; }; break; case EntityAction.LOCK: inspectorController.OnEntityLock += (entity) => { returnedEntity = entity; }; break; case EntityAction.DELETE: inspectorController.OnEntityDelete += (entity) => { returnedEntity = entity; }; break; case EntityAction.SHOW: inspectorController.OnEntityChangeVisibility += (entity) => { returnedEntity = entity; }; break; } // Act inspectorController.EntityActionInvoked(testAction, testEntity, null); // Assert Assert.AreEqual(testEntity, returnedEntity, "The entity does not match!"); }
public Task ValidateAccessToEntityAsync( ITenantEntity entity, EntityAction desiredAction) { if (null == entity) { return(Task.CompletedTask); } var userTenantId = _tenantIdProvider.GetTenantId(); if (TenantSpec.BelongsToSite(userTenantId)) { // simplistic access rules for prototype phase: // 'site user' can access any tenant // for the purposes of administration return(Task.CompletedTask); } // non-'site user' if (userTenantId != entity.TenantId) { string message = BuildAccessDeniedMessage(entity, desiredAction); throw new UnauthorizedAccessException(message); } // 'tenant user' can perform any modification read its own tenant information if (desiredAction != EntityAction.Read) { string message = BuildAccessDeniedMessage(entity, desiredAction); throw new UnauthorizedAccessException(message); } return(Task.CompletedTask); }
// Update is called once per frame void Update() { if (m_state != EntityState.Alive) { return; } if (m_currentAction != null) { m_currentAction.Update(); if (m_currentAction.IsComplete()) { m_currentAction.End(); m_currentAction = null; if (m_actionQueue.Count > 0) { m_currentAction = m_actionQueue.Dequeue(); m_currentAction.Start(); } } } else { if (m_actionQueue.Count > 0) { m_currentAction = m_actionQueue.Dequeue(); m_currentAction.Start(); } } }
/// <summary> /// Create an instance of this class. /// </summary> /// <param name="entity"></param> /// <param name="entityAction"></param> /// <param name="actionEventArgs"></param> protected EntityChangeEventArgs(IEntity entity, EntityAction entityAction, EventArgs actionEventArgs = null) : base() { Entity = entity; Action = entityAction; ActionEventArgs = actionEventArgs ?? EventArgs.Empty; }
void UpdateRoll(Vector3 V) { if (this.CheckButtonDown(this._rollButton) && V.sqrMagnitude > 0.001f) { EntityAction.ActionData freeData = this.GetFreeData(); freeData.dir = V.normalized; if (this._player.DoAction("roll", freeData)) { this.rollAction = this._player.GetAction("roll"); } } else if (this.rollAction != null) { if (this.rollAction.IsReleasable() && !this.CheckButtonPressed(this._rollButton)) { this.rollAction.ReleaseAction(); } if (this.rollAction.IsActive) { if (V.sqrMagnitude > 0.001f) { EntityAction.ActionData freeData2 = this.GetFreeData(); freeData2.dir = V.normalized; this.rollAction.UpdateData(freeData2); } } else { this.rollAction = null; } } }
public ProcessResult WaitInvoke <T>(EntityAction <T> action) where T : Entity { InvokeResult invokeResult = Invoke(action); while (true) { ProcessResult processResult = GetProcessStatus(invokeResult); System.Threading.Thread.Sleep(100); switch (processResult.Status) { case ProcessStatus.NotExists: case ProcessStatus.Aborted: throw new SystemException("Process status: " + processResult.Status + "; Error: " + processResult.Message); case ProcessStatus.Completed: case ProcessStatus.OK: return(processResult); case ProcessStatus.InProcess: if (processResult.Seconds > 30) { throw new TimeoutException(); } continue; default: throw new InvalidOperationException(); } } }
public void DOAction(EntityAction action) { if (handlers.TryGetValue(action.GetType(), out IActionHandler handler)) { handler.OnAction(action); } }
private string BuildAccessDeniedMessage(ITenantEntity entity, EntityAction desiredAction) { // deny the attempt to access a tenant // that the user doesn't belong to return($"User belonging to tenant {_tenantIdProvider.GetTenantId()} has been denied '{desiredAction}' access " + $"to entity '{entity.GetType().Name}' belonging to tenant {entity.TenantId}"); }
ActionResult?CheckFrameAction(EntityState aEntityState) { if (aEntityState.mobData?.canFall != true) { return(null); } EntityAction currentEntityAction = this.stateMachine.GetState() as EntityAction; Debug.Assert(currentEntityAction != null); if (!currentEntityAction.canBeInterrupted) { return(null); } FallAction fallAction = new FallAction(this.id); ActionResult fallActionResult = fallAction.GetActionResult(GM.boardManager.currentState); if (fallActionResult.boardState != null) { return(fallActionResult); } ExitAction exitAction = new ExitAction(this.id); ActionResult exitActionResult = exitAction.GetActionResult(GM.boardManager.currentState); if (exitActionResult.boardState != null) { return(exitActionResult); } return(null); }
public void OnAction(EntityAction action) { if (action is T act) { DoAction(act); } }
public static EntityAction ReadFrom(System.IO.BinaryReader reader) { Model.MoveAction?moveAction = null; if (reader.ReadBoolean()) { moveAction = Model.MoveAction.ReadFrom(reader); } Model.BuildAction?buildAction = null; if (reader.ReadBoolean()) { buildAction = Model.BuildAction.ReadFrom(reader); } Model.AttackAction?attackAction = null; if (reader.ReadBoolean()) { attackAction = Model.AttackAction.ReadFrom(reader); } Model.RepairAction?repairAction = null; if (reader.ReadBoolean()) { repairAction = Model.RepairAction.ReadFrom(reader); } var result = new EntityAction(moveAction, buildAction, attackAction, repairAction); return(result); }
public void InvokeEntityActionCorrectly() { // Arrange DCLBuilderInWorldEntity testEntity = new GameObject("_DCLBuilderInWorldEntity").AddComponent <DCLBuilderInWorldEntity>(); testEntity.entityUniqueId = "testId"; EntityListAdapter testEntityListAdapter = new GameObject("_EntityListAdapter").AddComponent <EntityListAdapter>(); testEntity.entityUniqueId = "testId"; EntityAction testEntityAction = EntityAction.SHOW; DCLBuilderInWorldEntity returnedEntity = null; EntityListAdapter returnedEntityListAdapter = null; EntityAction retournedEntityAction = EntityAction.DELETE; inspectorView.OnEntityActionInvoked += (action, entityToApply, adapter) => { retournedEntityAction = action; returnedEntity = entityToApply; returnedEntityListAdapter = adapter; }; // Act inspectorView.EntityActionInvoked(testEntityAction, testEntity, testEntityListAdapter); // Assert Assert.AreEqual(testEntity.entityUniqueId, returnedEntity.entityUniqueId, "The entity does not match!!"); Assert.AreEqual(testEntityListAdapter, returnedEntityListAdapter, "The entity list adapter does not match!!"); Assert.AreEqual(testEntityAction, retournedEntityAction, "The entity action does not match!!"); }
protected override void OnRecv(Connection connection) { var entity = BattleManager.Instance.GetEntity(message.id); if (entity != null) { Vector3 pos = new Vector3(message.position.x, 0, message.position.y); if (entity.machine != null && entity.machine.current != null && entity.machine.current.type == (int)ActionType.Run) { var run = entity.machine.current as EntityAction; if (run != null) { run.AddPathPoint(pos, Vector3.zero, true); } } EntityAction action = ObjectPool.GetInstance <EntityAction>(); action.skillid = message.skill; action.duration = message.duration; action.target = message.target; action.speed = message.speed; entity.PlayAction(ActionType.Attack, action); } }
private void CommandUnitsMelee() { foreach (var meleeUnit in Around.MyUnitsMelees) { var moveAction = new MoveAction(); var attackAction = new AttackAction(); var action = new EntityAction(); if (Around.Behavior == BehaviorType.Aggressive) { var nearestEnemy = Around.GetNearestEntity(meleeUnit.Position, PlayerType.Enemy); moveAction = new MoveAction(nearestEnemy.Position, true, false); attackAction = new AttackAction(nearestEnemy.Id, null); } else { // var topBuilding = Around.MyBuildings // .OrderByDescending(b => b.Position.X + b.Position.Y) // .FirstOrDefault(); // moveAction = new MoveAction(GetRndPositionAround(topBuilding, false), true, false); moveAction = new MoveAction(meleeUnit.Position, true, false); } action = new EntityAction(moveAction, null, attackAction, null); actions.Add(meleeUnit.Id, action); } }
void INetworkProvider.EntityAction(int entityId, EntityAction action) { PlayerAction translated; switch (action) { case EntityAction.StartSneaking: translated = PlayerAction.StartSneak; break; case EntityAction.StopSneaking: translated = PlayerAction.StopSneak; break; case EntityAction.StartSprinting: translated = PlayerAction.StartSprint; break; case EntityAction.StopSprinting: translated = PlayerAction.StopSprint; break; default: return; } SendPlayerAction(translated, null, null); }
public override bool TakeAction(EntityAction entityAction) { if (!entityAction.IsExecutable) { return(false); } // weapon attack if (entityAction is WeaponAttack weaponAttack) { Attack(weaponAttack); return(true); } // cast spell if (entityAction is SpellCast spellCast) { return(Cast(spellCast)); } // move if (entityAction is MoveAction moveAction) { return(Move(moveAction.Destination, true)); } return(false); }
public EntityAction Delete(int id) { //Chheck Is Parent EntityAction result = rep.Delete(id); return(result); }
public void PlayAnimation(EntityAction action, EntityParamPluginAnimationClip clip) { if (action == null || clip == null) { return; } var animationClip = GetAnimationClip(clip.animationClip); if (animationClip == null) { return; } if (mCurrentAnimationClip == null || animationClip != mCurrentAnimationClip || animationClip.isLooping == false) { animator.Play("empty", 0); animator.Update(0); if (clip.beginAt > 0) { animator.Play(clip.animationClip, 0, clip.beginAt / animationClip.length); } else { animator.CrossFade(clip.animationClip, 0.5f, 0); } mCurrentAnimationClip = animationClip; mParamAnimationClip = clip; } }
private static string GetRelativeUrl(string baseUrl, EntityAction entityAction, EntityUrl entityUrl, bool isPrimaryEntity) { string relativeUrl = baseUrl; if (entityUrl.IsFullPath) { relativeUrl = entityUrl.URL; } else if (!isPrimaryEntity || (isPrimaryEntity && string.IsNullOrEmpty(entityAction.EntityKey))) { // Not Primary: Add Sub URL // Primary w/ out ID: Add Sub URL relativeUrl += entityUrl.URL; } if (!string.IsNullOrEmpty(entityAction.EntityKey)) { if (entityAction.EntityKey.Contains("?")) { //Note : This is added to build link with search parameters relativeUrl += entityAction.EntityKey; } else { relativeUrl += "/" + entityAction.EntityKey; } } return(relativeUrl); }
public void Articles_Data_Post_Insert_Test() { AuthorRefrence author = new AuthorRefrence(lastName: "test", name: "test", userName: "******" ); author.Id = 1; Category cat = new Category(name: "test", slug: "test", isParent: true, lineAge: ""); cat.Id = 1; var model = new Post(title: "Test", sendDate: DateTime.Now, publishedDate: null, visitCount: 0, content: "test", description: "test", postImage: "test", slug: "test", authorId: 1, tagId: 1, categoryId: 1, author: author, category: cat) { Id = rep.GetNextId() }; uni.BeginTransAction(); EntityAction result = rep.Create(model); Assert.AreEqual(result, EntityAction.Added); uni.RollBack(); }
public static void RenderFilter(RenderContext ctx) { var filter = ctx.Query.Get("Filter"); if (filter == null) { return; } var widgets = from property in filter.GetType().GetProperties().Select(x => x.Name) let widget = filter.Get(property) as Widget where widget != null select widget; if (!widgets.Any()) { return; } if (ctx.Entity.Actions == null) { ctx.Entity.Actions = new EntityActionCollection(); } var filterAction = ctx.Entity.Actions.FirstOrDefault(x => x.Name.EqualsIgnoreCase("Filter")); if (filterAction == null) { var filterArgs = Enumerable.Empty <KeyValuePair <string, object> >(); var href = QueryPathBuilder.BuildPath(ctx, ctx.Query, ctx.PathTemplate, null, filterArgs); // removendo informacao de paginacao href = new Route(href).UnsetArgs("limit", "offset"); filterAction = new EntityAction(); filterAction.Name = "Filters"; filterAction.Href = href; filterAction.Method = "GET"; filterAction.Title = "Filtros"; ctx.Entity.Actions.Add(filterAction); } if (filterAction.Fields == null) { filterAction.Fields = new FieldCollection(); } foreach (var widget in widgets) { var field = widget.ToMediaField(); if (field.Title == null) { field.Title = field?.Name.ChangeCase(TextCase.ProperCase); } filterAction.Fields.Add(field); } }
public IPacket ReadPacket(IMinecraftDataReader reader) { EntityID = reader.ReadVarInt(); Action = (EntityAction)reader.ReadByte(); return(this); }
/// <summary> /// Get list of data massagers for the entity. /// </summary> /// <returns></returns> protected override BoolMessage PerformValidation(IActionContext ctx, EntityAction entityAction) { var massager = new StatusUpdateMassager(); massager.Massage(ctx.Item, entityAction); return(base.PerformValidation(ctx, entityAction)); }
private Task DispatchPacket(EntityAction packet) { Logger.LogWarning("EntityAction is not implemented."); // TODO Set Entity Action return(Task.CompletedTask); }
public EntityAction Create(Post entity) { entity.Id = rep.GetNextId(); EntityAction result = rep.Create(entity); return(result); }
public void ExecuteOnEntity <T, W>(int id, ExclusiveGroup.ExclusiveGroupStruct groupid, ref W value, EntityAction <T, W> action) where T : IEntityStruct { ExecuteOnEntity(id, (int)groupid, ref value, action); }
/// <summary> /// Performs the validation on the model. /// </summary> /// <param name="ctx">The action context.</param> /// <param name="entityAction">The type of entity action</param> /// <returns></returns> protected virtual BoolMessage PerformValidation(IActionContext ctx, EntityAction entityAction) { if (_settings == null) { return(BoolMessage.True); } if (!_settings.EnableValidation) { return(BoolMessage.True); } IEntity entity = ctx.Item as IEntity; bool isValid = entity.Validate(ctx.Errors); if (!isValid) { if (ctx.CombineMessageErrors) { string errorMessage = ctx.Errors.Message(); return(new BoolMessage(false, errorMessage)); } return(BoolMessage.False); } return(BoolMessage.True); }
private object GetEntity(EntityAction action, IDictionary<string, object> parameters) { var repositoryType = typeof (IDynamicRepository<>).MakeGenericType(action.Type); var getCommand = repositoryType.GetMethod("Get"); var repository = _Locator.GetInstance(repositoryType); // Todo this seems to bypass our security checks for this method... possibly we should have a thing to check this one too. Not sure how, maybe checking access should be a reusable service instead of a pipeline component. // I would really like to have a stage to do this repository to entity fetching, maybe a DomainRepositoryActionInvoker stage? return getCommand.Invoke(repository, parameters.Where(p => p.Key.ToLowerInvariant() == "id").Select(p => p.Value).ToArray()); }
public override int TryReadPacket(byte[] buffer, int length) { int offset = 1; byte action = 0; if (!DataUtility.TryReadInt32(buffer, ref offset, out EntityId)) return -1; if (!DataUtility.TryReadByte(buffer, ref offset, out action)) return -1; Action = (EntityAction)action; return offset; }
public override int TryReadPacket(byte[] Buffer, int Length) { int offset = 1; byte action = 0; if (!TryReadInt(Buffer, ref offset, out EntityId)) return -1; if (!TryReadByte(Buffer, ref offset, out action)) return -1; this.Action = (EntityAction)action; return offset; }
//This is just initialisation. i can write raw things. public override EntityState Me_Start() { return new EntityState { type = EntityType.Doodle, canMove = true, position = transform.position, useGravity = useGravity, isAlive = isAlive, initial = _state = new EntityAction { speed = Vector2.zero, control = Control.Stop } }; }
public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) { EntityId = stream.ReadInt32(); Action = (EntityAction)stream.ReadInt8(); JumpBoost = stream.ReadInt32(); return mode; }
public EntityActionPacket(int entityId, EntityAction action, int jumpBoost) { EntityId = entityId; Action = action; JumpBoost = jumpBoost; }
public void EntityAction() { EntityAction action = new EntityAction("MyAction1"); Assert.AreEqual("MyAction1", action.Name); Assert.IsNotNull(action.Parameters); Assert.AreEqual(0, action.Parameters.Count()); action = new EntityAction("MyAction2", "Param1", new string[] { "Param2_1", "Param2_2" }); Assert.AreEqual("MyAction2", action.Name); Assert.AreEqual(2, action.Parameters.Count()); Assert.AreEqual("Param1", action.Parameters.ElementAt(0) as string); string[] param2 = action.Parameters.ElementAt(1) as string[]; Assert.AreEqual(2, param2.Length); }
public EntityActionFilter(Process process, Entity entity, EntityAction entityAction) { _process = process; _entity = entity; _entityAction = entityAction; }
/// <summary> /// Ctor. /// </summary> /// <param name="entityAspect"></param> /// <param name="action"></param> public EntityChangingEventArgs(IEntity entity, EntityAction action) : base(entity) { Action = action; Cancel = false; }
public override int CompareTo(EntityAction other) { return 0; }
/// <summary> /// Ctor. /// </summary> /// <param name="entityAspect"></param> /// <param name="action"></param> public EntityChangedEventArgs(IEntity entity, EntityAction action) : base(entity) { Action = action; }
public EntityActionPacket(int entityId, EntityAction action) { EntityId = entityId; Action = action; }
/// <summary> /// Spikes can't be attacked and will damage any entity that interacts with it, provided said entity can be damaged /// </summary> public override void Interact(EntityAction action) { attack.Execute(action.Agent); }
/// <summary> /// Ctor. /// </summary> /// <param name="entity"></param> /// <param name="action"></param> /// <param name="actionEventArgs"></param> public EntityChangingEventArgs(IEntity entity, EntityAction action, EventArgs actionEventArgs) : base(entity, action, actionEventArgs) { Cancel = false; }
public void ReadPacket(MinecraftStream stream) { EntityId = stream.ReadInt32(); Action = (EntityAction)stream.ReadUInt8(); }
/// <summary> /// Ctor. /// </summary> /// <param name="entity"></param> /// <param name="action"></param> /// <param name="actionEventArgs"></param> public EntityChangedEventArgs(IEntity entity, EntityAction action, EventArgs actionEventArgs) : base(entity, action, actionEventArgs ) { }