Exemplo n.º 1
0
        private IEnumerable <string> GetSignals(ClientHubInfo hubInfo, string connectionId)
        {
            // Try to find the associated hub type
            HubDescriptor hubDescriptor = _manager.EnsureHub(hubInfo.Name,
                                                             _hubResolutionErrorsTotalCounter,
                                                             _hubResolutionErrorsPerSecCounter,
                                                             _allErrorsTotalCounter,
                                                             _allErrorsPerSecCounter);

            // Add this to the list of hub desciptors this connection is interested in
            _hubs.Add(hubDescriptor);

            // Update the name (Issue #344)
            hubInfo.Name = hubDescriptor.Name;

            // Create the signals for hubs
            // 1. The hub name e.g. MyHub
            // 2. The connection id for this hub e.g. MyHub.{guid}
            // 3. The command signal for this connection
            var clientSignals = new[] {
                hubInfo.Name,
                hubInfo.CreateQualifiedName(connectionId)
            };

            return(clientSignals);
        }
Exemplo n.º 2
0
        private IEnumerable <string> GetSignals(ClientHubInfo hubInfo, string clientId)
        {
            var clientSignals = new[] {
                hubInfo.CreateQualifiedName(clientId),
                hubInfo.CreateQualifiedName(clientId) + "." + PersistentConnection.SignalrCommand
            };

            // Create the signals for hubs
            return(hubInfo.Methods.Select(hubInfo.CreateQualifiedName)
                   .Concat(clientSignals));
        }
Exemplo n.º 3
0
        private IEnumerable <string> GetSignals(ClientHubInfo hubInfo, string connectionId)
        {
            var clientSignals = new[] {
                hubInfo.CreateQualifiedName(connectionId),
                SignalCommand.AddCommandSuffix(hubInfo.CreateQualifiedName(connectionId))
            };

            // Try to find the associated hub type
            Type hubType = _hubTypeResolver.ResolveType(hubInfo.Name);

            if (hubType == null)
            {
                throw new InvalidOperationException(String.Format("Unable to resolve hub {0}.", hubInfo.Name));
            }

            // Set the full type name
            hubInfo.Name = hubType.FullName;

            // Create the signals for hubs
            return(hubInfo.Methods.Select(hubInfo.CreateQualifiedName)
                   .Concat(clientSignals));
        }
Exemplo n.º 4
0
        public ShippingOrderResponse CreateShipping(ClientHubInfo picHub, OrderModel model)
        {
            // Create Shipping Order
            var soRequest = new ShippingOrderRequest();

            soRequest.ApiKey       = apiKey;
            soRequest.ApiSecretKey = apiSecretKey;
            soRequest.ClientID     = int.Parse(clientId);
            soRequest.Password     = password;
            soRequest.SessionToken = GhnSigin();

            soRequest.GHNOrderCode = string.Empty;
            var str = new Guid();

            soRequest.ClientOrderCode      = model.OrderCode;
            soRequest.SealCode             = string.Empty;
            soRequest.PickHubID            = picHub.PickHubID;
            soRequest.RecipientName        = model.FullName;
            soRequest.RecipientPhone       = model.Phone;
            soRequest.DeliveryAddress      = model.Address;
            soRequest.DeliveryDistrictCode = picHub.DistrictCode;

            soRequest.CODAmount   = double.Parse(model.TotalMoney.ToString());
            soRequest.ServiceID   = model.ServiceId;
            soRequest.Weight      = 200; // 100 cm
            soRequest.Length      = 200; // 100 cm
            soRequest.Height      = 200; // 100 cm
            soRequest.ContentNote = model.Note;

            client.EndPoint    = baseUri + "CreateShippingOrder";
            client.Method      = RestClient.HttpVerbEnum.Post;
            client.PostData    = JsonConvert.SerializeObject(soRequest);
            client.ContentType = RestClient.ContentTypeConst.Json;

            var responseCreateShippingOrder = JsonConvert.DeserializeObject <ShippingOrderResponse>(client.MakeRequest());

            return(responseCreateShippingOrder);
        }
Exemplo n.º 5
0
        private IEnumerable<string> GetSignals(ClientHubInfo hubInfo, string connectionId)
        {
            var clientSignals = new[] {
                hubInfo.CreateQualifiedName(connectionId),
                hubInfo.CreateQualifiedName(connectionId) + "." + SignalCommand.SignalrCommand
            };

            // Try to find the associated hub type
            Type hubType = _hubTypeResolver.ResolveType(hubInfo.Name);

            if (hubType == null)
            {
                throw new InvalidOperationException(String.Format("Unable to resolve hub {0}.", hubInfo.Name));
            }

            // Set the full type name
            hubInfo.Name = hubType.FullName;

            // Create the signals for hubs
            return hubInfo.Methods.Select(hubInfo.CreateQualifiedName)
                                  .Concat(clientSignals);
        }
Exemplo n.º 6
0
        private IEnumerable<string> GetSignals(ClientHubInfo hubInfo, string clientId)
        {
            var clientSignals = new[] {
                hubInfo.CreateQualifiedName(clientId),
                hubInfo.CreateQualifiedName(clientId) + "." + PersistentConnection.SignalrCommand
            };

            // Create the signals for hubs
            return hubInfo.Methods.Select(hubInfo.CreateQualifiedName)
                                  .Concat(clientSignals);
        }