public static void Save(Requester requester) { log.DebugFormat("Save requester with id '{0}'", requester.ID); var service = ServiceManager.GetService <RequesterService>(); var dto = new DataConverter <Requester>().Convert <RequesterDTO>(requester); int?requesterId; if (requester.IsNew) { requesterId = service.Create(dto); } else { service.Update(dto); requesterId = dto.ID; DataPortal.Instance.ResetCachedValue(typeof(Requester), requesterId); } var actionProcessor = new ActionProcessor(); requester.ID = requesterId; requester.UserID = requesterId; ActionTypeEnum actionTypeEnum = requester.IsNew ? ActionTypeEnum.Add : ActionTypeEnum.Update; actionProcessor.ProcessAction(actionTypeEnum, requester); }
private static HandActionType ToHandActionType(ActionTypeEnum actionTypeEnum) { switch (actionTypeEnum) { //we don't consider HandActionType.Any because this case is eliminated before enum conversion is used case ActionTypeEnum.Bet: return(HandActionType.BET); case ActionTypeEnum.Check: return(HandActionType.CHECK); case ActionTypeEnum.Call: return(HandActionType.CALL); case ActionTypeEnum.Raise: return(HandActionType.RAISE); case ActionTypeEnum.Fold: return(HandActionType.FOLD); default: LogProvider.Log.Error(CustomModulesNames.PlayerXRay, "Current player failed to load"); return(HandActionType.UNKNOWN); } }
public void TrackAction(ActionTypeEnum type) { this.TrySendEvent(() => this.telemetryClient.TrackEvent("Action", new Dictionary <string, string> { { "Type", EnumHelper.GetEnumName(type) } })); this.SendPlayFabEvent("Action", "Type", EnumHelper.GetEnumName(type)); }
public static bool IsValid(ActionTypeEnum actionType) { if (ConstantHelper.DisableDOSCheck) { return(true); } HttpContext context = HttpContext.Current; // We want crawler to index Dropthings //if( context.Request.Browser.Crawler ) return false; string key = actionType.ToString() + context.Request.UserHostAddress; var hit = (HitInfo)(context.Cache[key] ?? new HitInfo()); if (hit.Hits > (int)actionType) { return(false); } else { hit.Hits++; } if (hit.Hits == 1) { context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(DURATION), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); } return(true); }
public ActionRequestInfo( HttpContext httpContext, IImplementationsContainer implementationsContainer, string entityTypeName, ActionTypeEnum actionType, string actionName = null) { ActionType = actionType; ActionName = actionName; EntityTypeName = entityTypeName; AppTypeId = implementationsContainer.InstanceInfo.AppTypeId; AppInstanceId = implementationsContainer.InstanceInfo.AppInstanceId; if (!httpContext.User.Identity.IsAuthenticated) { Roles = _anonymousRoles; return; } if (!Guid.TryParse(httpContext.User.Claims.FirstOrDefault(x => x.Type == "sub")?.Value, out var userId)) { Roles = _anonymousRoles; return; } UserId = userId; Roles = httpContext.User.Claims.Where(x => x.Type == "role").Select(x => x.Value).ToArray(); }
public static bool IsValid(ActionTypeEnum actionType) { HttpContext context = HttpContext.Current; if (context.Request.Browser.Crawler) { return(false); } string key = actionType.ToString() + context.Request.UserHostAddress; var hit = (HitInfo)(context.Cache[key] ?? new HitInfo()); if (hit.Hits > (int)actionType) { return(false); } else { hit.Hits++; } if (hit.Hits == 1) { context.Cache.Add(key, hit, null, TimeZoneManager.DateTimeNow.AddMinutes(DURATION), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); } return(true); }
private Type GetAction(ActionTypeEnum actionType) { switch (actionType) { case ActionTypeEnum.FollowedArtistNewReleaseSpotify: return(typeof(FollowedArtistNewReleaseSpotifyAction)); case ActionTypeEnum.FollowedPlaylistUpdatedSpotify: return(typeof(FollowedPlaylistUpdatedSpotifyAction)); case ActionTypeEnum.NewTopPostsReddit: return(typeof(NewTopPostsRedditAction)); case ActionTypeEnum.NewReplyToCommentReddit: return(typeof(NewReplyToCommentRedditAction)); case ActionTypeEnum.NewSmashClipTwitch: return(typeof(NewSmashClipTwitchAction)); case ActionTypeEnum.NewSubTwitch: return(typeof(NewSubTwitchAction)); case ActionTypeEnum.GameNewsSteam: return(typeof(GameNewsSteamAction)); case ActionTypeEnum.NewInventoryItemSteam: return(typeof(NewObjectInInventorySteamAction)); case ActionTypeEnum.NewYoutubeActivity: default: return(null); } }
public Task <CreateListenerResponse> CreateListenerAsync( int port, ProtocolEnum protocol, string loadBalancerArn, string targetGroupArn, ActionTypeEnum actionTypeEnum, IEnumerable <Certificate> certificates = null, string sslPolicy = null, CancellationToken cancellationToken = default(CancellationToken)) => _clientV2.CreateListenerAsync( new CreateListenerRequest() { Port = port, Protocol = protocol, LoadBalancerArn = loadBalancerArn, DefaultActions = new List <Action>() { new Action() { TargetGroupArn = targetGroupArn, Type = actionTypeEnum } }, Certificates = certificates?.ToList(), SslPolicy = sslPolicy } , cancellationToken).EnsureSuccessAsync();
public ActionModelBase(ActionTypeEnum type) { this.ID = Guid.NewGuid(); this.Type = type; this.Name = EnumLocalizationHelper.GetLocalizedName(this.Type); this.Enabled = true; }
public static bool IsValid(ActionTypeEnum actionType) { HttpContext context = HttpContext.Current; if (context.Request.Browser.Crawler) { return(false); } string key = actionType + context.Request.UserHostAddress; //var hit = (HitInfo)(context.Cache[key] ?? new HitInfo()); var hit = CacheManager.Get <HitInfo>(key) ?? new HitInfo(); if (hit.Hits > (int)actionType) { return(false); } hit.Hits++; if (hit.Hits == 1) { CacheManager.Insert(key, hit, Duration); } //context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(Duration),System.Web.Caching.Cache.NoSlidingExpiration,System.Web.Caching.CacheItemPriority.Normal, null); return(true); }
public string UserGuid; //TODO: leave for the future public DailyMaintAction(string name, string smallUrl, string bigUrl, ActionTypeEnum actionType) { ActionName = name; PictureUrl = smallUrl; BigPictureUrl = bigUrl; ActionType = actionType; }
public void ProcessAction(ActionTypeEnum actionTypeEnum, IEntity entity) { if (!Enabled) { return; } string action = string.Empty; string postAction = string.Empty; switch (actionTypeEnum) { case ActionTypeEnum.Add: postAction = "added"; break; case ActionTypeEnum.Update: postAction = "updated"; break; case ActionTypeEnum.Delete: postAction = "deleted"; break; case ActionTypeEnum.ChangeState: action = "The state of "; postAction = "changed"; break; default: break; } action += GetEntityName(entity); PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(entity.GetType()); PropertyDescriptor namePropertyInfo = descriptors["Name"]; PropertyDescriptor loginPropertyInfo = descriptors["Login"]; string description = string.Empty; if (namePropertyInfo != null) { description += namePropertyInfo.GetValue(entity) as string; } if ((description == null || description == string.Empty) && loginPropertyInfo != null) { description = loginPropertyInfo.GetValue(entity) as string; } if (description != null && description != string.Empty) { action += " '" + description + "'"; } action += " was " + postAction; LastAction = action; LastEntity = entity; LastActionTypeEnum = actionTypeEnum; }
private void AddAction(ActionTypeEnum actionType) { ActionsNumber++; ActionClass action = new ActionClass(); action.ActionType = actionType; ActionStack.Add(action); }
public static UserAction CreateAction(ActionTypeEnum actionType, LevelEnum level, string actionDescription, Guid referenceKey, Guid createdBy, DateTime createdOn, EntityStatusEnum status) { ApplicationDbContext db = new ApplicationDbContext(); UserAction action = CreateAction(db, actionType, level, actionDescription, referenceKey, createdBy, createdOn, status); db.Dispose(); return(action); }
/// <summary> /// Initializes a new instance of the <see cref="CombinedSubmissionAction" /> class. /// </summary> /// <param name="id">id (required).</param> /// <param name="integrationId">integrationId (required).</param> /// <param name="state">state (required).</param> /// <param name="actionCategory">actionCategory (required).</param> /// <param name="actionType">actionType (required).</param> /// <param name="resultData">resultData (required).</param> public CombinedSubmissionAction(string id = default(string), string integrationId = default(string), StateEnum state = default(StateEnum), ActionCategoryEnum actionCategory = default(ActionCategoryEnum), ActionTypeEnum actionType = default(ActionTypeEnum), Object resultData = default(Object)) { // to ensure "id" is required (not null) if (id == null) { throw new InvalidDataException("id is a required property for CombinedSubmissionAction and cannot be null"); } else { this.Id = id; } // to ensure "integrationId" is required (not null) if (integrationId == null) { throw new InvalidDataException("integrationId is a required property for CombinedSubmissionAction and cannot be null"); } else { this.IntegrationId = integrationId; } // to ensure "state" is required (not null) if (state == null) { throw new InvalidDataException("state is a required property for CombinedSubmissionAction and cannot be null"); } else { this.State = state; } // to ensure "actionCategory" is required (not null) if (actionCategory == null) { throw new InvalidDataException("actionCategory is a required property for CombinedSubmissionAction and cannot be null"); } else { this.ActionCategory = actionCategory; } // to ensure "actionType" is required (not null) if (actionType == null) { throw new InvalidDataException("actionType is a required property for CombinedSubmissionAction and cannot be null"); } else { this.ActionType = actionType; } // to ensure "resultData" is required (not null) if (resultData == null) { throw new InvalidDataException("resultData is a required property for CombinedSubmissionAction and cannot be null"); } else { this.ResultData = resultData; } }
public void TrackAction(ActionTypeEnum type) { if (!ChannelSession.Settings.OptOutTracking) { this.telemetryClient.TrackEvent("Action", new Dictionary <string, string> { { "Type", EnumHelper.GetEnumName(type) } }); } }
private void SingleActionNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.SingleActionNameComboBox.SelectedIndex >= 0) { ActionTypeEnum actionType = (ActionTypeEnum)this.SingleActionNameComboBox.SelectedItem; this.ActionControlContentControl.Visibility = Visibility.Visible; this.ActionControlContentControl.Content = this.actionContentContainerControl = new ActionContentContainerControl(actionType); } }
/// <summary> /// Creates an action. /// </summary> /// <param name="actionType">Action Type</param> /// <param name="userPet">Object of the UserPet</param> /// <returns>Object of the created Action</returns> public async Task <Domain.Entity.Action> CreateAction(ActionTypeEnum actionType, UserPet userPet) { if (userPet == null) { Console.WriteLine($"{nameof(ActionService)} - CreateAction - User Pet is null"); return(null); } return(await actionRepo.CreateAction(userPet, actionType)); }
public void Clear() { lock (this) { _lastAction = null; _lastEntity = null; _lastActionTypeEnum = ActionTypeEnum.None; _isError = false; } }
public IEnumerable <Order> RetrieveOrdersByActionTypeAndCompanyId(ActionTypeEnum actionType, int companyId) { var daoOrders = (from o in _iandpOrderEntities.Orders join c in _iandpOrderEntities.Companies on o.ExternalCompanyId equals c.ExternalCompanyId where o.ActionTypeId == (int)actionType && c.Id == companyId select o).ToList(); return(daoOrders); }
private void AddActionButton_Click(object sender, RoutedEventArgs e) { if (this.TypeComboBox.SelectedIndex >= 0) { ActionTypeEnum type = (ActionTypeEnum)this.TypeComboBox.SelectedItem; ActionContainerControl actionControl = new ActionContainerControl(this.window, this, type); this.AddActionControlContainer(actionControl); this.TypeComboBox.SelectedIndex = -1; } }
public ActionContainerControl(CommandWindow window, CommandEditorControlBase editorControl, ActionTypeEnum type) { this.Window = window; this.EditorControl = editorControl; this.type = type; InitializeComponent(); this.Loaded += ActionContainerControl_Loaded; }
public static void CreateActionStateCookie(HttpResponseBase response, ActionTypeEnum actionType, string message) { var cookie = new HttpCookie(Constants.ACTION_STATE_COOKIE); cookie.Values.Add(Constants.COOKIE_VALUE_ACTION_TYPE, actionType.ToString()); var encodedMessage = Convert.ToBase64String(Encoding.UTF8.GetBytes(message)); cookie.Values.Add(Constants.COOKIE_VALUE_MESSAGE, encodedMessage); response.Cookies.Add(cookie); }
public void DoActionAnimation(ActionTypeEnum actionType) { Debug.Log(" == Add animation action " + actionType); AddAction(actionType); if (!ActionStarted) { ActionStarted = true; DoNextAction(); } }
public StandardCharacter _targetCharacter; // attack target #endregion Fields #region Constructors public Action(ActionTypeEnum actionType) { _actionType = actionType; _animationSeqs = new ArrayList(); _currentAnimationSeq = null; _path = null; _isEnd = false; _targetCharacter = null; _subActions = new ArrayList(); }
//TODO: This should get a Model or a dynamic type instead of the Entity. In the current state, validation ignores required non nullable value types. public ModelStateDictionary Validate <TEntity>(TEntity entity, ActionTypeEnum actionType, IActionContextInfo actionContext) { var entityMetadata = _implementationsContainer.Metadata[typeof(TEntity).Name]; Dictionary <string, IEnumerable <string> > propertyValidationErrors = null; foreach (var property in entityMetadata.GetAllProperties()) { if (property.IsExpression) { continue; } if (actionContext.ExcludedProperties != null && actionContext.ExcludedProperties.Contains(property.Name)) { continue; } if (actionContext != null && actionContext.Masters != null && actionContext.Masters.Any(m => m.MasterProperty.InverseProperty == property || m.MasterProperty.InverseProperty?.ForeignKey == property)) { continue; } if (property.IsRequired()) { var reflectionProperty = typeof(TEntity).GetProperty(property.Name); if (reflectionProperty.PropertyType == typeof(bool)) { continue; } if (reflectionProperty.GetValue(entity) == null || (reflectionProperty.PropertyType.IsValueType && reflectionProperty.GetValue(entity).Equals(Activator.CreateInstance(reflectionProperty.PropertyType)))) { if (propertyValidationErrors == null) { propertyValidationErrors = new Dictionary <string, IEnumerable <string> >(); } propertyValidationErrors.Add(property.Name, new List <string> { $"The value for {property.Title ?? property.Name} is empty." }); } } //Todo: Add more validation logic, like passwords, email addresses, ... } if (propertyValidationErrors != null) { var modelState = new ModelStateDictionary(); foreach (var prop in propertyValidationErrors.Keys) { foreach (var error in propertyValidationErrors[prop]) { modelState.AddModelError(prop, error); } } return(modelState); } return(null); }
public List <ActionViewModel> GetActions() { var result = new List <ActionViewModel>(); foreach (int i in Enum.GetValues(typeof(ActionTypeEnum))) { ActionTypeEnum type = (ActionTypeEnum)i; var description = type.GetAttributeOfType <DescriptionActionAttribute>(); result.Add(ViewModelFiller.FillAction(i, description)); } return(result); }
private void AddAction(ActionTypeEnum actionType, Pawn myPawn, Pawn enemyPawn, GamePlay.attackDirections attackDirection, int onBoardDistance) { ActionsNumber++; ActionClass action = new ActionClass(); action.ActionType = actionType; action.myPawn = myPawn; action.enemyPawn = enemyPawn; action.attackDirection = attackDirection; action.onBoardDistance = onBoardDistance; ActionStack.Add(action); }
// Call This Function to call Transaction in Audit History Table //_backgroundService.EnqueueJob<IGeneralBackgroundJobs> //(m => m.AddAuditTrail(ActionTypeEnum.@ActionType, @TransactionSaveId, @OldDataModel, @NewDataModel, //(long)TableEnum.@tableName)); // if Model Null or no data than passs " (@tableName)Activator.CreateInstance(typeof(@tableName)) " #region Audit Trail public void AddAuditTrail <T>( ActionTypeEnum action, long recordid, T oldObject, T newObject, long?tableId) { var compObjects = new CompareLogic { Config = { MaxDifferences = 99, IgnoreCollectionOrder = true, CompareProperties = true, CompareChildren = false } }; ComparisonResult compResult = compObjects.Compare(oldObject, newObject); var deltaList = new List <AuditDelta>(); foreach (var change in compResult.Differences) { var delta = new AuditDelta(); if (!string.IsNullOrEmpty(change.PropertyName) && change.PropertyName.Substring(0, 1) == ".") { delta.FieldName = change.PropertyName.Substring(1, change.PropertyName.Length - 1); } delta.ValueBefore = change.Object1Value; delta.ValueAfter = change.Object2Value; deltaList.Add(delta); } var jsSettings = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; // Create AuditHistory Table //var auditTrail = new AuditHistory //{ // ActionType = (int)action, // TableId = tableId, // CreatedOn = DateTime.UtcNow, // RecordId = recordid, // OldValue = JsonConvert.SerializeObject(oldObject, Formatting.None, jsSettings), // NewValue = JsonConvert.SerializeObject(newObject, Formatting.None, jsSettings), // LogText = JsonConvert.SerializeObject(deltaList, Formatting.None, jsSettings) //}; var obj = JObject.Parse(JsonConvert.SerializeObject(newObject, Formatting.None, jsSettings)); if (obj != null && CommonHelper.IsNumeric(Convert.ToString(obj["CreatedBy"]))) { var createdby = (long?)obj["CreatedBy"]; if (createdby != null) { // auditTrail.CreatedBy = createdby; } } //TODO Save Audit History in Database }
public ActionContainerControl(CommandWindow window, CommandEditorControlBase editorControl, ActionTypeEnum type) { this.Window = window; this.EditorControl = editorControl; this.type = type; InitializeComponent(); this.ActionContentContainerControl = (ActionContentContainerControl)this.GetByUid("ActionContentContainerControl"); this.ActionContentContainerControl.AssignAction(this.type); this.Loaded += ActionContainerControl_Loaded; }
public void DoActionAnimation(ActionTypeEnum actionType, Pawn myPawn, Pawn enemyPawn, GamePlay.attackDirections attackDirection, int onBoardDistance) { Debug.Log(" == Add animation action " + myPawn.pawnBoardID + " " + actionType); AddAction(actionType, myPawn, enemyPawn, attackDirection, onBoardDistance); if (!ActionStarted) { ActionStarted = true; DoNextAction(); } }
public static bool IsValid(ActionTypeEnum actionType) { HttpContext context = HttpContext.Current; if (context.Request.Browser.Crawler) return false; string key = actionType + context.Request.UserHostAddress; //var hit = (HitInfo)(context.Cache[key] ?? new HitInfo()); var hit = CacheManager.Get<HitInfo>(key) ?? new HitInfo(); if (hit.Hits > (int)actionType) return false; hit.Hits++; if (hit.Hits == 1) CacheManager.Insert(key, hit, Duration); //context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(Duration),System.Web.Caching.Cache.NoSlidingExpiration,System.Web.Caching.CacheItemPriority.Normal, null); return true; }
private void AddActionButton_Click(object sender, RoutedEventArgs e) { if (this.TypeComboBox.SelectedIndex >= 0) { foreach (ActionContainerControl control in this.actionControls) { control.Minimize(); } ActionTypeEnum type = EnumHelper.GetEnumValueFromString <ActionTypeEnum>((string)this.TypeComboBox.SelectedItem); ActionContainerControl actionControl = new ActionContainerControl(this.window, this, type); this.actionControls.Add(actionControl); actionControl.OnWindowSizeChanged(this.window.RenderSize); this.TypeComboBox.SelectedIndex = -1; } }
public static bool IsValid( ActionTypeEnum actionType ) { HttpContext context = HttpContext.Current; if( context.Request.Browser.Crawler ) return false; string key = actionType.ToString() + context.Request.UserHostAddress; var hit = (HitInfo)(context.Cache[key] ?? new HitInfo()); if( hit.Hits > (int)actionType ) return false; else hit.Hits ++; if( hit.Hits == 1 ) context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(DURATION), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); return true; }
public static void SetLastAction(string message, IEntity entity, ActionTypeEnum actionTypeEnum) { LastAction = message; LastEntity = entity; LastActionTypeEnum = actionTypeEnum; }