protected virtual void OnPosted(PostEvent msg) { if (sourceConnection != null && !sourceConnection.IsStopped) { sourceConnection.Post(msg.From, msg.Message); } }
public static NccPost FirePostEvent(this IMediator _mediator, NccPost post, PostEvent postEvent, NccPost newPost = null, ILogger logger = null) { try { var posts = new NccPost[] { }; if (postEvent == PostEvent.Create) { posts = _mediator.SendAll(new OnPostCreated(post)).Result; } else if (postEvent == PostEvent.Edit) { posts = _mediator.SendAll(new OnPostEdited(post, newPost)).Result; } else if (postEvent == PostEvent.Show) { posts = _mediator.SendAll(new OnPostShow(post)).Result; } return(post = posts?.LastOrDefault()); } catch (Exception ex) { logger?.LogError(ex.Message, ex); } return(null); }
public void TestEventWithError() { IptDataModel client = new IptDataModelClient(); PostEvent pEvent = new PostEvent(); SIFHeaderType header = createHeader(); header.EventAction = SIFHeaderTypeEventAction.Add; header.EventActionSpecified = true; header.TopicName = "FoodserviceMilkSales"; pEvent.SIFHeader = header; pEvent.Event = createXML( @"<FoodserviceMilkSales RefId='D21CF29B7FB44965A9CF950E1E60B21E' xmlns='" + Statics.XMLNS_SIF_US_DATAMODEL + @"'> <SchoolInfoRefId>AA66800BE0D84E80AA5838FA97EE3A3E</SchoolInfoRefId> <Date>2001-10-31</Date> <Program Type='Foodservice'>NSLP</Program> <SaleQuantities> <SaleQuantity> <Value>99999</Value> <MealStatus Type='Free' /> <SaleUnit>6 oz</SaleUnit> <ChargeToChild Currency='USD'>999.99</ChargeToChild> </SaleQuantity> <SaleQuantity> <Value>99999</Value> <MealStatus Type='Reduced' /> <SaleUnit>6 oz</SaleUnit> <ChargeToChild Currency='USD'>999.99</ChargeToChild> </SaleQuantity> </SaleQuantities> </FoodserviceMilkSales>"); bool exceptionThrown = false; try { EventStatus evStatus = client.Event(pEvent); } catch (FaultException <DataModelErrorType> ex) { exceptionThrown = true; Assert.AreEqual(ex.Detail.Category, InfrastructureErrorCategoryType.Item9, "Expected Category of 9"); Assert.AreEqual(ex.Detail.Code, "3", "Expected Code of 3"); } catch (Exception ex) { Assert.Fail("Unable to parse SOAP Fault into expected exception type : " + ex.ToString()); } Assert.IsTrue(exceptionThrown, "A SOAP Fault was not returned"); }
public StatusType Event(ref SIFHeaderType SIFHeader, System.Xml.XmlElement Event1) { PostEvent inValue = new PostEvent(); inValue.SIFHeader = SIFHeader; inValue.Event = Event1; EventStatus retVal = ((IptDataModel)(this)).Event(inValue); SIFHeader = retVal.SIFHeader; return(retVal.Status); }
public void Handle(PostEvent eEvent, object mObj) { switch (eEvent) { case PostEvent.eBuyIBMComputer: BuyIBMComputer((int)mObj); break; case PostEvent.eSellIBMComputer: SellIBMComputer((int)mObj); break; } }
public void PostEventTest() { var myEvent = new Event() { Name = "Awesome Event", Description = "Partayy!", StartDate = DateTime.Now }; var factory = new Infrastructure.EventFactory(); var useCase = new PostEvent(_dbContext, factory); var @event = useCase.Execute(myEvent); Assert.NotEqual(@event.Id, Guid.Empty); }
public void TestEvent() { IptDataModel client = new IptDataModelClient(); PostEvent pEvent = new PostEvent(); SIFHeaderType header = createHeader(); header.EventAction = SIFHeaderTypeEventAction.Add; header.EventActionSpecified = true; header.TopicName = "SchoolCourseInfo"; pEvent.SIFHeader = header; pEvent.Event = createXML( @"<SchoolCourseInfo RefId='9D75101A8C3D00AA001A0000A2E35B35' SchoolInfoRefId='101A8C3D00AA001A0000A2E35B359D75' SchoolYear='2006' xmlns='" + Statics.XMLNS_SIF_US_DATAMODEL + @"'> <CourseCode>CS101</CourseCode> <StateCourseCode>08-001</StateCourseCode> <DistrictCourseCode>CS101</DistrictCourseCode> <SubjectAreaList> <SubjectArea> <Code>05</Code> <OtherCodeList> <OtherCode Codeset='Text'>Graphic Arts</OtherCode> </OtherCodeList> </SubjectArea> </SubjectAreaList> <CourseTitle>Gif, JPeg, or Png: What's the Difference?</CourseTitle> <Description>Explore the various types of files related to graphic arts.</Description> <InstructionalLevel> <Code>0571</Code> </InstructionalLevel> <CourseCredits Type='0585'>2</CourseCredits> <CoreAcademicCourse>No</CoreAcademicCourse> <GraduationRequirement>No</GraduationRequirement> </SchoolCourseInfo>"); EventStatus evStatus = client.Event(pEvent); runAssertions(evStatus.SIFHeader); Assert.IsNotNull(evStatus.Status, "Status is null"); StatusType status = evStatus.Status; Console.WriteLine("Invoked with return code " + status.Code); Assert.AreEqual(status.Code, InfrastructureStatusCodeType.Item0); Assert.AreEqual(status.Desc, "Success"); }
public void CanSendSingleInvite() { var @event = new PostEvent(_context, _eventFactory).Execute(new Event() { Name = "test", Description = "Test event", StartDate = DateTime.Now }); var emails = new List <string>() { "*****@*****.**" }; var input = new InvitationInput(emails, @event.Id); new SendInvitesUseCase(_context, _invitationFactory, _emailService).Execute(input); var createdEvent = (Infrastructure.Entities.Event) new GetEvent(new EventRepository(_context)).Execute(@event.Id); Assert.NotEmpty(createdEvent.SentInvitations); }
private void PostProcess(PostEvent e) { if (e.Completed) { _groupPreprocessor.Compress(); _context.Compress(); _context.InitNull(_storage.Ids); Collect(); DataConfig.DataUpdates = false; return; } DataConfig.DataUpdates = true; if (e.IsAdd) { AddNewAccount(e.Account); } else { EditAccount(e.Account); } }
public MessageProcessor( MainContext mainContext, MainStorage mainStorage, DomainParser parser, MainPool mainPool, GroupPreprocessor groupPreprocessor, NewAccountProcessor newAccountProcessor, EditAccountProcessor editAccountProcessor, NewLikesProcessor newLikesProcessor, DataLoader dataLoader) { _context = mainContext; _storage = mainStorage; _parser = parser; _pool = mainPool; _groupPreprocessor = groupPreprocessor; var newAccountObservable = newAccountProcessor .DataReceived; var editAccountObservable = editAccountProcessor .DataReceived; var newLikesObservable = newLikesProcessor .DataReceived; _likeWorker = new SingleThreadWorker <LikeEvent>(ProcessLike, "Like thread started"); _loadWorker = new SingleThreadWorker <LoadEvent>(LoadAccount, "Import thread started"); _postWorker = new SingleThreadWorker <PostEvent>(PostProcess, "Post thread started"); _importGcSubscription = dataLoader .CallGc .Subscribe(_ => { _loadWorker.Enqueue(LoadEvent.GC); }); _likeLoadedSubscription = dataLoader .LikeLoaded .Subscribe( x => _likeWorker.Enqueue(new LikeEvent(x, true)), _ => {}, () => _likeWorker.Enqueue(LikeEvent.EndEvent) ); _dataLoaderSubscription = dataLoader .AccountLoaded .Subscribe( item => { _loadWorker.Enqueue(new LoadEvent(item)); }, _ => {}, () => { _loadWorker.Enqueue(LoadEvent.EndEvent); }); _newAccountProcessorSubscription = newAccountObservable .Subscribe(x => { _postWorker.Enqueue(PostEvent.Add(x)); }); _editAccountProcessorSubscription = editAccountObservable .Subscribe(x => { _postWorker.Enqueue(PostEvent.Edit(x)); }); _newLikesProcessorSubscription = newLikesObservable .Subscribe(NewLikes); var updateObservable = newAccountObservable .Select(_ => Interlocked.Increment(ref _editQuery)) .Merge(editAccountObservable.Select(_ => Interlocked.Increment(ref _editQuery))) .Merge(newLikesObservable.Select(_ => Interlocked.Increment(ref _editQuery))); _secondPhaseEndSubscription = updateObservable .Throttle(TimeSpan.FromMilliseconds(2000)) .Subscribe(_ => { _postWorker.Enqueue(PostEvent.End()); _likeWorker.Enqueue(LikeEvent.EndEvent); }); }
protected virtual void OnPosted(PostEvent msg) { if (sourceConnection!=null && !sourceConnection.IsStopped) { sourceConnection.Post(msg.From, msg.Message); } }
EventStatus IptDataModel.Event(PostEvent request) { return(base.Channel.Event(request)); }
public void RemovePost(PostEvent @event) { _postEvents.Remove(@event); }
private void ProcessMessages() { var name = _settings.Settings.InstanceName; const int maxUpdates = 100; var updates = new StatisticEvent[maxUpdates]; foreach (var typeChannels in _channels) { foreach (var channel in typeChannels.Value) { StatChannel.Mesg msg; for (var i = 0; i < maxUpdates & channel.TryDequeue(out msg); i++) { switch (msg.Action) { case Actions.Posted: if (msg.ids == null) { updates[i] = new PostEvent(name, msg.id, typeChannels.Key, msg.Length, msg.Time); } else { updates[i] = new SerialPostEvent(name, msg.Time, msg.Length); } break; case Actions.ExternalGet: if (msg.ids == null) { updates[i] = new ExternalGetEvent(name, msg.id, typeChannels.Key, msg.Length, msg.Time); } else { updates[i] = new ExternalSerialGetEvent(name, msg.ids, typeChannels.Key, msg.Length, msg.Time); } break; case Actions.CacheGet: updates[i] = new CachedGetEvent(name, msg.id, typeChannels.Key, msg.Length, msg.Time); break; case Actions.BecameUnactual: updates[i] = new UnactualGetEvent(name, msg.id, typeChannels.Key, msg.Time); break; case Actions.RebalanceStarted: updates[i] = new RebalanceEvent(name, msg.Time, typeChannels.Key, "Started"); break; case Actions.RebalanceQueued: updates[i] = new RebalanceEvent(name, msg.Time, typeChannels.Key, "Queued"); break; case Actions.RebalanceEnded: updates[i] = new RebalanceEvent(name, msg.Time, typeChannels.Key, "Ended", msg.Length); break; case Actions.BranchChanged: updates[i] = new BranchChangedEvent(name, msg.Time, msg.Length, typeChannels.Key); break; } } } } _statQueue.PutEvent(updates); }
public virtual EventStatus Event(PostEvent request) { return EventImplementation(request); }
public virtual EventStatus Event(PostEvent request) { return(EventImplementation(request)); }
//Form Event Functions private void formTimer_Tick(object sender, EventArgs e) { if (this.AppConsole != null) { var nl = this.AppConsole.CLF.NextLines; if (nl != null) { var l = this.rtbConsole.Lines.ToList<string>(); l.InsertRange(l.Count - 1, nl); this.rtbConsole.Lines = l.ToArray<string>(); this.AppConsole.updateSelection(); } else if (this.rtbConsole.ReadOnly) { this.rtbConsole.ReadOnly = false; } } if (this.PostEventFire) { this.PostEventFire = false; if (this.PostEventWait > 0) { this.PostEventWait--; } if (this.PostEventWait == 0) { this.Enabled = true; //this.InitAll(); this.Show(); this.Focus(); if (this.PostEnable != null && this.PostEnable(sender, e)) { this.PostEnable = null; } } } }
public void AddPost(PostEvent @event) { _postEvents.Add(@event); }