public virtual bool IsActive(HashSet <GuildWars2.ArenaNet.Model.EventState> events) { return(events.Where(es => EventStates.Contains(new EventState() { Event = es.EventId, State = es.StateEnum })).Count() > 0); }
public virtual MetaEventStage AddEvent(Guid ev, EventStateType state) { EventStates.Add(new EventState() { Event = ev, State = state }); return(this); }
public EventCloseEventArgs(Guid EventId, EventStates state, Decimal cashPrice, Decimal nonCashPrice, Decimal loss, string overview) { this.EventId = EventId; State = state; CashPrice = cashPrice; NonCashPrice = nonCashPrice; Loss = loss; Overview = overview; }
private void HandleSwitchNewEventToRemoved(UiEvent currentEvent, EventStates prevState) { var currentStatus = EventHelper.GetCurrentEventStatus(currentEvent.EventData); if (StatusesForOwner.IsStatusForOwner(currentStatus) && (prevState == EventStates.NewEvent)) { ownerForm.indication.DecNewEventsCount(); } }
public static void EventStateChanged(Guid id, EventStates states, bool stateChanged) { if (!stateChanged) { return; } if (InterestedPlanningStates.Contains(states.PlanningState) || InterestedRecordingStates.Contains(states.RecordingState) || InterestedRecordedStates.Contains(states.RecordedState)) { var context = GlobalHost.ConnectionManager.GetHubContext <EventStateHub>(); context.Clients.All.eventStateChanged(id, states.PlanningState.ToString(), states.RecordingState.ToString(), states.RecordedState.ToString()); } }
public void CloseEvent(Guid eventId, EventStates state, Decimal cashPrice, Decimal nonCashPrice, Decimal loss, string overview) { if (eventId == Guid.Empty) { return; } using (IDbConnection connection = CreateConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { IDbCommand command = connection.CreateCommand(); command.Transaction = transaction; command.CommandText = @" UPDATE [dbo].[event] SET [review] = @overview ,[price_cash] = @price_cash ,[price_non_cash] = @price_non_cash ,[loss] = @loss ,[state] = @state WHERE [event_id] = @eventId "; addParameter(command, "@eventId", eventId); addParameter(command, "@state", state); addParameter(command, "@price_cash", cashPrice); addParameter(command, "@price_non_cash", nonCashPrice); addParameter(command, "@loss", loss); addParameter(command, "@overview", overview); command.ExecuteNonQuery(); if (state == EventStates.Refuse) { command.Parameters.Clear(); command.CommandText = @" DELETE FROM [dbo].[service_event] WHERE [event_id] = @eventId "; addParameter(command, "@eventId", eventId); } command.ExecuteNonQuery(); transaction.Commit(); } } }
public virtual bool IsFailed(HashSet <GuildWars2.ArenaNet.Model.EventState> events) { IEnumerable <Guid> eventIds = EventStates.Select(es => es.Event).Distinct(); return(events.Where(es => eventIds.Contains(es.EventId) && es.StateEnum == EventStateType.Fail).Count() > 0); }
public static string GetEventStateReference(EventStates en) { return referenceBase.GetReference(en); }
public HomeFilter(EventStates states) { _states = states; }
public void CloseEvent(Guid eventId, EventStates state, Decimal cashPrice, Decimal nonCashPrice, Decimal loss, string overview) { if (eventId == Guid.Empty) return; using (IDbConnection connection = CreateConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { IDbCommand command = connection.CreateCommand(); command.Transaction = transaction; command.CommandText = @" UPDATE [dbo].[event] SET [review] = @overview ,[price_cash] = @price_cash ,[price_non_cash] = @price_non_cash ,[loss] = @loss ,[state] = @state WHERE [event_id] = @eventId "; addParameter(command, "@eventId", eventId); addParameter(command, "@state", state); addParameter(command, "@price_cash", cashPrice); addParameter(command, "@price_non_cash", nonCashPrice); addParameter(command, "@loss", loss); addParameter(command, "@overview", overview); command.ExecuteNonQuery(); if (state == EventStates.Refuse) { command.Parameters.Clear(); command.CommandText = @" DELETE FROM [dbo].[service_event] WHERE [event_id] = @eventId "; addParameter(command, "@eventId", eventId); } command.ExecuteNonQuery(); transaction.Commit(); } } }
private static IFormatProvider FP = System.Globalization.CultureInfo.InvariantCulture; // needed to have C default decimal separator #endregion public static string ChangeParamsToText(string source, List <string> parameters) { //scan source int sourceLength = source.Length; int sourceLastIndex = sourceLength - 1; EventStates state = EventStates.Scan; Stack <EventStates> states = new Stack <EventStates>(); string fragment = ""; string param = ""; char c; bool isParamStart = false, isParamEnd = false; bool isEnd = false; // analysis: for (int i = 0; i < sourceLength; i++) { c = source[i]; isParamStart = c == '('; isParamEnd = c == ')'; isEnd = i == sourceLastIndex; // identifier is considered ended after whitespace character, comment start or end of data switch (state) { case EventStates.Scan: if (isParamStart) { param += c; states.Push(state); state = EventStates.Parameter; } else { fragment += c; } break; case EventStates.Parameter: param += c; if (isParamEnd) { string n = ""; foreach (char c1 in param) { if (c1 >= '0' && c1 <= '9') { n += c1; } } int cyf = int.Parse(n); if (cyf <= parameters.Count) { fragment += parameters[cyf - 1]; } else { fragment += param; } state = states.Pop(); param = ""; } break; } } return(fragment); }
public ScnEvent(string source, List <string> parameters) { //initialize Values = new List <object>(); //scana source int sourceLength = source.Length; int sourceLastIndex = sourceLength - 1; int noValues = 0; int block = 0; EventStates state = EventStates.Name; Stack <EventStates> states = new Stack <EventStates>(); string fragment = ""; char c; bool isEndLine = false; bool isWhiteSpace = false; bool isCommentStart, lastCommentStart = false, isComment = false; bool isParamStart = false, isParamEnd = false; bool isEnd = false; // analysis: for (int i = 0; i < sourceLength; i++) { c = source[i]; isEndLine = c == '\n'; isWhiteSpace = c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == ';'; // all whitespace and separators defined in SCN format isCommentStart = c == '/'; isParamStart = c == '('; isParamEnd = c == ')'; isComment = isCommentStart && lastCommentStart; // true on second '/' in a row lastCommentStart = isCommentStart; isEnd = (isWhiteSpace && fragment != "") || isComment || i == sourceLastIndex; // identifier is considered ended after whitespace character, comment start or end of data switch (state) { case EventStates.Name: if (!isWhiteSpace) { fragment += c; } if (isParamStart) { states.Push(state); state = EventStates.Parameter; } else if (isEnd) { Name = fragment; state = EventStates.Type; fragment = ""; } break; case EventStates.Type: if (!isWhiteSpace) { fragment += c; } if (isEnd) { if (Type == EventTypes.UpdateValues) { Type = Tools.GetEventTypeFromString(fragment); state = EventStates.Value; block = 1; noValues = 2; } else { Type = Tools.GetEventTypeFromString(fragment); state = EventStates.Timing; } fragment = ""; } break; case EventStates.Comment: if (isEndLine) { state = states.Pop(); fragment = ""; } break; case EventStates.Parameter: if (isParamEnd) { fragment += c; string p = fragment.Substring(fragment.IndexOf('(')); string n = ""; foreach (char c1 in p) { if (c1 >= '0' && c1 <= '9') { n += c1; } } int cyf = int.Parse(n); fragment = fragment.Replace(p, parameters[cyf - 1]); state = states.Pop(); } else { fragment += c; } break; case EventStates.Timing: if (c == '-' || c == '.' || (c >= '0' && c <= '9')) { fragment += c; continue; } else if (isEnd) { Delay = float.Parse(fragment, FP); if (Type == EventTypes.GetValues || Type == EventTypes.UpdateValues || Type == EventTypes.Multiple) { state = EventStates.MemCell; } else if (Type == EventTypes.Switch) { state = EventStates.Value; block = 1; noValues = 2; } else if (Type == EventTypes.PutValues) { state = EventStates.NonNecessaryValue; noValues = 4; block = 1; } else { state = EventStates.Scan; } fragment = ""; } break; case EventStates.MemCell: if (!isWhiteSpace) { fragment += c; } if (isEnd) { MemCellName = Tools.ChangeParamsToText(fragment.TrimEnd(new[] { '/' }), parameters); if (Type == EventTypes.UpdateValues) { state = EventStates.Type; } else if (Type == EventTypes.Multiple) { state = EventStates.MultipleValue; } else { state = EventStates.Scan; } fragment = ""; } break; case EventStates.NonNecessaryValue: if (isEnd && block < noValues) { block++; } else if (isEnd) { state = EventStates.Type; } break; case EventStates.Value: if (!isWhiteSpace) { fragment += c; } if (isEnd) { double n; if (Double.TryParse(fragment, NS, FP, out n)) { Values.Add(n); } else { Values.Add(Tools.ChangeParamsToText(fragment.TrimEnd(new[] { '/' }), parameters)); } fragment = ""; block++; } if (block > noValues) { state = EventStates.Scan; } break; case EventStates.MultipleValue: if (!isWhiteSpace) { fragment += c; } if (fragment == "endevent" || fragment == "condition") { state = EventStates.Scan; fragment = ""; break; } if (isEnd) { Values.Add(Tools.ChangeParamsToText(fragment.TrimEnd(new[] { '/' }), parameters)); fragment = ""; } break; } if (isComment && state != EventStates.Comment) { states.Push(state); state = EventStates.Comment; } } }
public virtual bool IsSuccessful(HashSet <GuildWars2.ArenaNet.Model.V1.EventState> events) { IEnumerable <Guid> eventIds = EventStates.Select(es => es.Event).Distinct(); return(events.Where(es => eventIds.Contains(es.EventId) && es.StateEnum == EventStateType.Success).Count() == eventIds.Count()); }
public static string GetEventStateReference(EventStates en) { return(referenceBase.GetReference(en)); }