示例#1
0
        public Subscriber(IEnumerable <Capability>?capabilities,
                          SubscriberId id,
                          SubscriberType type,
                          String?tenantId,
                          String manufacturer,
                          String productInfo,
                          String versionInfo)
        {
            manufacturer.ThrowIfEmpty();
            productInfo.ThrowIfEmpty();
            versionInfo.ThrowIfEmpty();

            this.Id           = id;
            this.Type         = type;
            this.Manufacturer = manufacturer;
            this.TenantId     = tenantId;
            this.ProductInfo  = productInfo;
            this.VersionInfo  = versionInfo;

            if (capabilities is not null)
            {
                foreach (Capability capability in capabilities)
                {
                    if (capability is not null)
                    {
                        this.Capabilities.Add(capability.Name, capability);
                    }
                }
            }
        }
示例#2
0
        public void SubscriberType_To_CommonIPTVServiceV7SubscriberType()
        {
            //*** Arrange ***
            var subscriber = new SubscriberType()
            {
            };

            //*** Act ***
            var apmaxSubscriberTypeV3 = ObjectFactory.CreateInstanceAndMap <SubscriberType, Common.IPTVServiceV7.SubscriberType>(_commonMapper, subscriber);

            Assert.IsNotNull(apmaxSubscriberTypeV3);
        }
示例#3
0
        public void Can_Retrieve_Subscriber_By_Phone_Number_And_Equipment_Id()
        {
            //http://andpserver.cloudapp.net/ANDP.Provisioning.API.Rest/api/apmax/subscriber/phone/6051231234/equipment/1
            //http://localhost/ANDP.Provisioning.API.Rest/api/apmax/subscriber/phone/6051231234/equipment/1

            HttpResponseMessage response = _client.GetAsync("subscriber/phone/6053511186/equipment/1").Result;
            var result = response.Content.ReadAsStringAsync().Result;

            SubscriberType subscriber = Newtonsoft.Json.JsonConvert.DeserializeObject <SubscriberType>(result);

            Assert.IsTrue(response.IsSuccessStatusCode);
            Assert.AreEqual("Nathan Test", subscriber.SubscriberName);
            Assert.AreEqual("6053511186", subscriber.SubscriberDefaultPhoneNumber);
            Assert.AreEqual("7dd60aa3-4552-4d03-95b6-78891a052f9c", subscriber.SubscriberGuid);
        }
示例#4
0
 public Subscriber(IEnumerable <Capability>?capabilities,
                   SubscriberId id,
                   SubscriberType type,
                   String?tenantId,
                   String manufacturer,
                   String productInfo)
     :
     this(capabilities,
          id,
          type,
          tenantId,
          manufacturer,
          productInfo,
          Assembly.GetCallingAssembly().GetName().Version?.ToString() ?? String.Empty)
 {
 }
示例#5
0
        public void Can_Map_Provisioning_API_SubscriberType_To_ApMax_SubscriberTypeV4()
        {
            //*** Arrange ***
            var provSubscriberType = new SubscriberType()
            {
                SubscriberName = "Bob Bobby",
                SubscriberDefaultPhoneNumber = "6055551234",
                PlacementType      = PlacementType.PlacementType_None,
                SubscriberTimezone = Timezone.MountainTime
            };

            //*** Act ***
            var apmaxSubscriberTypeV4 = ObjectFactory.CreateInstanceAndMap <SubscriberType, Common.SubscriberV4.SubscriberType>(_commonMapper, provSubscriberType);

            Assert.IsNotNull(apmaxSubscriberTypeV4);
        }
示例#6
0
        public void Can_Map_Provisioning_API_SubscriberType_To_ApMax_SubscriberTypeV3()
        {
            //*** Arrange ***
            var subscriberType = new SubscriberType()
            {
                SubscriberName = "Bob Bobby",
                SubscriberDefaultPhoneNumber = "6055551234",
                PlacementType        = PlacementType.PlacementType_None,
                BillingAccountNumber = "123456789",
                SubscriberTimezone   = Timezone.CentralTime
            };

            //*** Act ***
            var apmaxSubscriberTypeV3 = ObjectFactory.CreateInstanceAndMap <SubscriberType, Common.SubscriberV3.SubscriberType>(_commonMapper, subscriberType);

            Assert.IsNotNull(apmaxSubscriberTypeV3);
        }
示例#7
0
        private async Task SubscriberDefaults()
        {
            List <string> distinctstates = null;

            using (var odw = new OracleDatabaseWorker(tbOracleConnectionStringText))
            {
                distinctstates = await Task.FromResult(odw.GetDistinctDataColumn(subTable, "STATE"));
            }
            List <Task> ts  = new List <Task>();
            var         del = new MyDelegate((lst) =>
            {
                using (var uow = new UnitOfWork(Tsdl))
                {
                    if (!uow.Query <SubscriberType>().Any(x => x.TypeName == "SUBSCRIBER"))
                    {
                        var st = new SubscriberType(uow)
                        {
                            TypeName = "SUBSCRIBER"
                        };
                        uow.CommitChanges();
                    }
                    //do states
                    foreach (var st in lst)
                    {
                        if (!uow.Query <NewNetServices.Module.BusinessObjects.CableManagement.State>().Any(x => x.ShortName == st || x.LongName == st))
                        {
                            var stat = new NewNetServices.Module.BusinessObjects.CableManagement.State(uow)
                            {
                                ShortName = st, LongName = st
                            };
                            uow.CommitChanges();
                        }
                    }
                }
                return(true);
            });
            var stateres = del.BeginInvoke(distinctstates, null, null);
        }
示例#8
0
        /// <summary>
        /// ReceiverIds should be null or empty for case you want to wide broadcast for ALL online users
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="response"></param>
        /// <param name="receiverIds"></param>
        /// <param name="receiverType">Ignored in case ReceiverIds is null or empty. If none - will send wide broadcast</param>
        public async Task Broadcast <T>(T response, List <string> receiverIds, SubscriberType receiverType = SubscriberType.None)
        {
            receiverIds = receiverIds ?? new List <string>();

            CloseUnactiveConnections();

            string message = "";

            if (response is string)
            {
                message = response.ToString();
            }
            else
            {
                response.ToJson();
            }
            var data = message.GetByteSegment();

            var receivers = _clients.Where(s => s.Connection.State == WebSocketState.Open);

            receivers = receivers.Where(s => s.User != null);

            var userReceiverIds = new List <string>();

            foreach (var receiverId in receiverIds)
            {
                var userReceivers = new List <string>();
                if (receiverType.HasFlag(SubscriberType.User))
                {
                    var result = EnergoServer.Current.TryToLookupUser(receiverId);
                    if (result != null)
                    {
                        userReceivers.Add(result.Id);
                    }
                }
                if (receiverType.HasFlag(SubscriberType.Room) && !userReceivers.Any())
                {
                    var room = EnergoServer.Current.TryToLookupRoom(receiverId);
                    if (room != null)
                    {
                        userReceivers = room.Players.Values.Select(m => m.Player.Id).ToList();
                    }
                }
                if (receiverType.HasFlag(SubscriberType.Channel) && !userReceivers.Any())
                {
                    var channel = ServerContext.Current.Chat.LookupChannel(null, receiverId);
                    if (channel != null)
                    {
                        //for private it's not possible to get correct list of subscribers, because there are all
                        //users ever sent messages in private
                        if (channel.Type == ChatChannelType.Private)
                        {
                            userReceivers.Add(channel.Id);
                        }
                        else
                        {
                            userReceivers = channel.Subscribers.Keys.ToList();
                        }
                    }
                }
                if (userReceivers.Any())
                {
                    userReceiverIds.AddRange(userReceivers);
                }
            }
            if (userReceiverIds.Any())
            {
                receivers = receivers.Where(s => userReceiverIds.Contains(s.User.Id));
            }

            await Task.WhenAll(receivers.Select(s => s.SendData(data)));
        }
示例#9
0
 /// <summary>
 /// receiversId could be roomId, userId or null (global broadcast)
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="response"></param>
 /// <param name="receiverId"></param>
 /// <param name="receiverType"></param>
 public async void Broadcast <T>(T response, string receiverId = null, SubscriberType receiverType = SubscriberType.None)
 {
     await Broadcast(response, receiverId == null?null : new List <string> {
         receiverId
     }, receiverType);
 }
示例#10
0
 public void AddTcmSubscriber(string phoneNumber, bool tcmEnabled, bool dndEnabled, SubscriberType subscriberType)
 {
     _tcmService.AddTCMSubscriber(_loginInformation.LoginToken, phoneNumber, tcmEnabled, dndEnabled, subscriberType);
 }
示例#11
0
 public void AddUniversalCallManagerSubscriber(UniversalCallMgrSubType universalCallMgrSubType, SubscriberType subscriberType)
 {
     _ucmService.AddUniversalCallManagerSubscriber(_loginInformation.LoginToken, universalCallMgrSubType, subscriberType);
 }
示例#12
0
 internal void AddClpSubscriberRecord(CallLoggingType callLoggingType, SubscriberType subscriberType)
 {
     _callLoggingService.AddClpSubscriberRecord(_loginInformation.LoginToken, callLoggingType, subscriberType);
 }
 public void AddConferencingSub(ConferenceType conferenceType, SubscriberType subscriberType)
 {
     _odConferencingService.AddConferenceSub(_loginInformation.LoginToken, conferenceType, subscriberType);
 }
示例#14
0
        public void Subscribe(Godot.Object Target, string MemberName, string VariableName, SubscriberType Type)
        {
            if (!ModIDUtil.Validate(VariableName))
            {
                return;
            }

            string ModID = ModIDUtil.ModID(VariableName);

            if (Configs.ContainsKey(ModID))
            {
                Configs[ModID].Subscribe(Target, MemberName, VariableName, Type);
            }
        }
示例#15
0
 public String ConvertFrom(SubscriberType value)
 {
     return(value.ToString());
 }
 public void AddSubscriberRecord(OCMSubcriberType ocmSubcriberType, SubscriberType subscriberType)
 {
     _ocmService.AddSubscriberRecord(_loginInformation.LoginToken, ocmSubcriberType, subscriberType);
 }
示例#17
0
        public string InsertFreeConference(FreeConferenceType freeConferenceType, SubscriberType subscriberType, bool dedicated)
        {
            var response = _largeScaleConferenceClient.InsertFreeConference(_loginInformation.LoginToken, freeConferenceType, dedicated, subscriberType);

            return(response);
        }
示例#18
0
        public static string GetString(int stringType, string inString)
        {
            string outString = String.Empty; // "<span style='color: Orange'>?</span>";

            try
            {
                if (Relationship == null)
                {
                    Initialise();
                }

                if (inString.Length == 0)
                {
                    return(inString);
                }

                switch (stringType)
                {
                case (int)StringType.LocationType:
                {
                    outString = LocationType.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.Direction:
                {
                    outString = Direction.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.Sector:
                {
                    outString = Sector.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.InvoiceStatus:
                {
                    outString = InvoiceStatus.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.SecurityQuestion:
                {
                    outString = SecurityQuestion.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.SubscriberType:
                {
                    outString = SubscriberType.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.Sex:
                {
                    outString = Sex.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.Title:
                {
                    outString = Title.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.Status:
                {
                    outString = Status.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.ContractType:
                {
                    outString = ContractType.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.MaritalStatus:
                {
                    outString = MaritalStatus.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }

                case (int)StringType.Relationship:
                {
                    outString = Relationship.FindLast(delegate(Item i) { return(i.Value == inString); }).Text;
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }

            return(outString);
        }
示例#19
0
        public void Subscribe(Godot.Object Target, string MemberName, string Property, SubscriberType Type)
        {
            if (!ModIDUtil.Validate(Property))
            {
                return;
            }

            if (!Properties.ContainsKey(Property))
            {
                return;
            }

            if (!Subscribers.ContainsKey(Property))
            {
                Subscribers[Property] = new List <Subscriber>();
            }

            Subscriber NewSubscriber = new Subscriber
            {
                Target     = Target,
                MemberName = MemberName,
                Type       = Type
            };

            Subscribers[Property].Add(NewSubscriber);

            if (Type == SubscriberType.Member)
            {
                Target.Set(MemberName, Get(Property));
            }
            else
            {
                Target.Call(MemberName, Get(Property));
            }
        }