public void Apply(ClientUpdated domainEvent) { //TODO: refactor all this shitty code into one method.. FirstName = domainEvent.FirstName; LastName = domainEvent.LastName; Gender = domainEvent.Gender; DateOfBirth = domainEvent.DateOfBirth; Email = domainEvent.Email; ContactNumber = domainEvent.ContactNumber; AddressLine1 = domainEvent.AddressLine1; AddressLine2 = domainEvent.AddressLine2; Suburb = domainEvent.Suburb; City = domainEvent.City; ExcerciseFrequency = domainEvent.ExcerciseFrequency; IsSmoker = domainEvent.IsSmoker; CurrentMedications = domainEvent.CurrentMedications; PreviousAilments = domainEvent.PreviousAilments; GeneralPractionerName = domainEvent.GeneralPractionerName; MedicalClearance = domainEvent.MedicalClearance; HasHadPreviousTherapy = domainEvent.HasHadPreviousTherapy; TouchPreference = domainEvent.TouchPreference; ContraIndicationsArteriosclerosis = domainEvent.ContraIndicationsArteriosclerosis; ContraIndicationsArthritis = domainEvent.ContraIndicationsArthritis; ContraIndicationsAsthma = domainEvent.ContraIndicationsAsthma; ContraIndicationsCancer = domainEvent.ContraIndicationsCancer; ContraIndicationsColdOrFlu = domainEvent.ContraIndicationsColdOrFlu; ContraIndicationsContactLenses = domainEvent.ContraIndicationsContactLenses; ContraIndicationsCutsBurnsBruises = domainEvent.ContraIndicationsCutsBurnsBruises; ContraIndicationsDepression = domainEvent.ContraIndicationsDepression; ContraIndicationsDiabetes = domainEvent.ContraIndicationsDiabetes; ContraIndicationsDizziness = domainEvent.ContraIndicationsDizziness; ContraIndicationsEpilepsy = domainEvent.ContraIndicationsEpilepsy; ContraIndicationsHeadache = domainEvent.ContraIndicationsHeadache; ContraIndicationsHeartDisease = domainEvent.ContraIndicationsHeartDisease; ContraIndicationsHemophilia = domainEvent.ContraIndicationsHemophilia; ContraIndicationsHernia = domainEvent.ContraIndicationsHernia; ContraIndicationsHighBloodPressure = domainEvent.ContraIndicationsHighBloodPressure; ContraIndicationsImflammation = domainEvent.ContraIndicationsImflammation; ContraIndicationsIrritatedSkinRash = domainEvent.ContraIndicationsIrritatedSkinRash; ContraIndicationsIsPregnant = domainEvent.ContraIndicationsIsPregnant; ContraIndicationsLowBloodPressure = domainEvent.ContraIndicationsLowBloodPressure; ContraIndicationsMusculoskletalProblems = domainEvent.ContraIndicationsMusculoskletalProblems; ContraIndicationsPinsPacemaker = domainEvent.ContraIndicationsPinsPacemaker; ContraIndicationsSeverePain = domainEvent.ContraIndicationsSeverePain; ContraIndicationsSleepDisturbance = domainEvent.ContraIndicationsSleepDisturbance; ContraIndicationsStomachUlcers = domainEvent.ContraIndicationsStomachUlcers; ContraIndicationsSunburn = domainEvent.ContraIndicationsSunburn; ContraIndicationsVaricoseVeins = domainEvent.ContraIndicationsVaricoseVeins; CurrentStressLevels = domainEvent.CurrentStressLevels; CurrentPainOrTensionLevels = domainEvent.CurrentPainOrTensionLevels; AreasNotToBeMassaged = domainEvent.AreasNotToBeMassaged; }
private void AcceptCallback(IAsyncResult ar) { Socket s = _serverSocket.EndAccept(ar); var client = new Client(s); try { //Add to Client list client.ConnectionDateTime = DateTime.UtcNow; client.LastPacketReceived = DateTime.UtcNow; client.Guid = Guid.NewGuid(); Console.WriteLine(@"Client connected : {0}", client.Guid); lock (LstClients) LstClients.Add(client.Guid, client); ClientConnected.Invoke(client, ClientEventType.Connected); _serverSocket.BeginAccept(AcceptCallback, _serverSocket); client.Socket.BeginReceive(client.Buffer, 0, sizeof(int), SocketFlags.None, ReceiveCallback, client); //Initiatilze connection //Get information :) Sender sender = new Sender(this, client); sender.RequestCountry(); while (LstClients[client.Guid].Country == null) { Thread.Sleep(1); } if (LstClients[client.Guid] != null) { ClientUpdated.Invoke(LstClients[client.Guid], ClientEventType.UpdatedCountry); } } catch (Exception) { if (client.Socket != null) { client.Socket.Close(); lock (LstClients) LstClients.Remove(client.Guid); ClientDisconnected.Invoke(client, ClientEventType.Disconnected); } } }
async void OnSave(object sender, EventArgs e) { ClientViewModel client = new ClientViewModel { FirstName = FirstName.Text, LastName = LastName.Text, Address = Address.Text, City = City.Text, Zip = Zip.Text, County = County.Text, PhoneNumber = PhoneNumber.Text }; BindingContext = new ClientViewModel { Id = client.Id, FirstName = client.FirstName, LastName = client.LastName, Address = client.Address, City = client.City, Zip = client.Zip, County = client.County, PhoneNumber = client.PhoneNumber }; if (client.Id == 0) { await _connection.InsertAsync(client); ClientAdded?.Invoke(this, client); } else { await _connection.UpdateAsync(client); ClientUpdated?.Invoke(this, client); } await Navigation.PopAsync(); //OnPropertyChanged("client"); }
private static string AwayCuFun(ClientUpdated msg) => AwayFun(msg.IsAway, msg.AwayMessage);
public void UpdateClientUpdated(ClientUpdated msg) { var obj = GetClient(msg.ClientId); if (obj == null) { Log.Warn("Internal Book protocol error. Update 'ClientUpdated' has no local object ({$msg})", msg); return; } { var tmpv = AwayCuFun(msg); if (tmpv != null) { obj.AwayMessage = (str)tmpv; } } { var tmpv = TalkPowerCuFun(msg); if (tmpv != null) { obj.TalkPowerRequest = (TalkPowerRequest)tmpv; } } { var tmpv = msg.Name; if (tmpv != null) { obj.Name = (str)tmpv; } } { var tmpv = msg.UnreadMessages; if (tmpv != null) { obj.UnreadMessages = (u32)tmpv; } } { var tmpv = msg.InputMuted; if (tmpv != null) { obj.InputMuted = (bool)tmpv; } } { var tmpv = msg.InputHardwareEnabled; if (tmpv != null) { obj.InputHardwareEnabled = (bool)tmpv; } } { var tmpv = msg.OutputHardwareEnabled; if (tmpv != null) { obj.OutputHardwareEnabled = (bool)tmpv; } } { var tmpv = msg.Description; if (tmpv != null) { obj.Description = (str)tmpv; } } { var tmpv = msg.IsPrioritySpeaker; if (tmpv != null) { obj.IsPrioritySpeaker = (bool)tmpv; } } { var tmpv = msg.IsChannelCommander; if (tmpv != null) { obj.IsChannelCommander = (bool)tmpv; } } { var tmpv = msg.AvatarHash; if (tmpv != null) { obj.AvatarHash = (str)tmpv; } } { var tmpv = msg.TalkPowerGranted; if (tmpv != null) { obj.TalkPowerGranted = (bool)tmpv; } } { var tmpv = msg.PhoneticName; if (tmpv != null) { obj.PhoneticName = (str)tmpv; } } { var tmpv = msg.IsRecording; if (tmpv != null) { obj.IsRecording = (bool)tmpv; } } { var tmpa = msg.ServerGroups; if (tmpa != null) { obj.ServerGroups.Clear(); obj.ServerGroups.UnionWith(tmpa); } } { var tmpv = msg.Badges; if (tmpv != null) { obj.Badges = (str)tmpv; } } { var tmpv = msg.TalkPower; if (tmpv != null) { obj.TalkPower = (i32)tmpv; } } { var tmpv = msg.IconId; if (tmpv != null) { obj.IconId = (IconHash)tmpv; } } }
internal void ApplyEvent(ClientView view, ClientUpdated @event) { view.Name = @event.Data.Name; view.Email = @event.Data.Email; }
private static void ClientStatusUpdatedEvent(long id, StateUpdateData statusData) => ClientUpdated?.Invoke(id, statusData);
public void When(ClientUpdated clientUpdated) { }
public Task Handle(ClientUpdated @event, CancellationToken cancellationToken = default(CancellationToken)) { store.Append(@event.ClientId, @event); return(session.SaveChangesAsync(cancellationToken)); }
public Task Handle(ClientUpdated notification, CancellationToken cancellationToken) { throw new NotImplementedException(); }
internal void ApplyEvent(ClientUpdated @event) { ClientName = @event.Data.Name; }
partial void PostClientUpdated(ClientUpdated msg);
private void OnDataItemAdded(PersonalDataItem item) { Model.PersonalData.DataItems.Add(item); ClientUpdated.InvokeAsync(Model); AddItemFormCleared(true); }
private static TalkPowerRequest?TalkPowerCuFun(ClientUpdated msg) => TalkPowerFun(msg.TalkPowerRequestTime, msg.TalkPowerRequestMessage);
private str AwayCuFun(ClientUpdated msg) => default;
private List <Guid> FindClientAccountIds(IDocumentSession session, ClientUpdated @event) { return(FindClientAccountIds(session, @event.ClientId)); }
public void Apply(ClientUpdated @event, ClientView view) { view.Name = @event.Data.Name; view.Email = @event.Data.Email; }
internal static void OnClientUpdated(Version e) { ClientUpdated?.Invoke(null, e); }
public Task Handle(ClientUpdated @event) { store.Append(@event.Id, @event); return(session.SaveChangesAsync()); }