public CprBroker.Schemas.Part.SubscriptionType ToOioSubscription(string appToken) { CprBroker.Schemas.Part.SubscriptionType ret = null; if (this.DataSubscription != null) { ChangeSubscriptionType dataSubscription = new ChangeSubscriptionType(); ret = dataSubscription; } else // birthdate subscription { BirthdateSubscriptionType birthdateSubscription = new BirthdateSubscriptionType(); birthdateSubscription.AgeYears = this.BirthdateSubscription.AgeYears; birthdateSubscription.PriorDays = this.BirthdateSubscription.PriorDays; ret = birthdateSubscription; } ret.SubscriptionId = this.SubscriptionId.ToString(); ret.ApplicationToken = appToken; ret.Persons = new SubscriptionPersonsType(); if (this.IsForAllPersons) { ret.Persons.Item = true; } else if (this.Criteria == null) { ret.Persons.Item = new PersonUuidsType() { UUID = this.SubscriptionPersons .Select(sp => sp.PersonUuid.Value.ToString()) .ToArray() }; } else { ret.Persons.Item = Utilities.Strings.Deserialize <SoegObjektType>(this.Criteria.ToString()); } Channel channel = this.Channels.Single(); switch ((ChannelType.ChannelTypes)channel.ChannelTypeId) { case ChannelType.ChannelTypes.WebService: CprBroker.Schemas.Part.WebServiceChannelType webServiceChannel = new WebServiceChannelType(); webServiceChannel.WebServiceUrl = channel.Url; ret.NotificationChannel = webServiceChannel; break; case ChannelType.ChannelTypes.FileShare: CprBroker.Schemas.Part.FileShareChannelType fileShareChannel = new FileShareChannelType(); fileShareChannel.Path = channel.Url; ret.NotificationChannel = fileShareChannel; break; } return(ret); }
private void SendSubscribtionMessageAsync(string queue, ChangeSubscriptionType type) { connectToServerTask.ContinueWith(task => { if (task.Exception != null) { return(task); } return(clientConnection.Send(JObject.FromObject(new ChangeSubscriptionMessage { Type = type, Queues = { queue } }))); }) .Unwrap() .IgnoreExceptions(); }