Ejemplo n.º 1
0
        private Future <object> SubscribeToSessionChannel()
        {
            Promise <object> promise = new Promise <object>();

            try
            {
                ClientExtensions.JoinConference(Client, new JoinConferenceArgs(SessionChannel)
                {
                    OnSuccess = (o) =>
                    {
                        promise.Resolve(o);
                    },
                    OnFailure = (e) =>
                    {
                        promise.Reject(e.Exception);
                    },
                    OnRemoteClient = (remoteClient) =>
                    {
                        Connection connection = CreateConnection(remoteClient);
                        Connections.Add(connection);
                        return(connection);
                    }
                });
            }
            catch (Exception e)
            {
                promise.Reject(e);
            }

            return(promise);
        }
Ejemplo n.º 2
0
 public StopLossOrder(OrderID id, DateTime createTime, OrderState state, ClientExtensions clientExtensions, OrderType type, double guaranteedExecutionPremium, TradeID tradeID, ClientID clientTradeID, PriceValue price, double distance, TimeInForce timeInForce, DateTime gtdTime, OrderTriggerCondition triggerCondition, bool guaranteed, TransactionID fillingTransactionID, DateTime filledTime, TradeID tradeOpenedID, TradeID tradeReducedID, List <TradeID> tradeClosedIDs, TransactionID cancellingTransactionID, DateTime cancelledTime, OrderID replacesOrderID, OrderID replacedByOrderID)
 {
     this.Id                         = id;
     this.CreateTime                 = createTime;
     this.State                      = state;
     this.ClientExtensions           = clientExtensions;
     this.Type                       = type;
     this.GuaranteedExecutionPremium = guaranteedExecutionPremium;
     this.TradeID                    = tradeID;
     this.ClientTradeID              = clientTradeID;
     this.Price                      = price;
     this.Distance                   = distance;
     this.TimeInForce                = timeInForce;
     this.GtdTime                    = gtdTime;
     this.TriggerCondition           = triggerCondition;
     this.Guaranteed                 = guaranteed;
     this.FillingTransactionID       = fillingTransactionID;
     this.FilledTime                 = filledTime;
     this.TradeOpenedID              = tradeOpenedID;
     this.TradeReducedID             = tradeReducedID;
     this.TradeClosedIDs             = tradeClosedIDs;
     this.CancellingTransactionID    = cancellingTransactionID;
     this.CancelledTime              = cancelledTime;
     this.ReplacesOrderID            = replacesOrderID;
     this.ReplacedByOrderID          = replacedByOrderID;
 }
Ejemplo n.º 3
0
 public TradeClientExtensionsModifyRejectTransaction(
     string id,
     DateTime time,
     int?userID,
     string accountID,
     string?batchID,
     string?requestID,
     TransactionType type,
     string tradeID,
     string?clientTradeID,
     ClientExtensions tradeClientExtensionsModify,
     TransactionRejectReason rejectReason)
     : base(
         id,
         time,
         userID,
         accountID,
         batchID,
         requestID,
         type,
         tradeID,
         clientTradeID,
         tradeClientExtensionsModify)
 {
     RejectReason = rejectReason;
 }
Ejemplo n.º 4
0
 public StopOrderTransaction(TransactionID id, DateTime time, int userID, AccountID accountID, TransactionID batchID, RequestID requestID, TransactionType type, InstrumentName instrument, double units, PriceValue price, PriceValue priceBound, TimeInForce timeInForce, DateTime gTDTime, OrderPositionFill positionFill, OrderTriggerCondition triggerCondition, StopOrderReason reason, ClientExtensions clientExtensions, TakeProfitDetails takeProfitOnFill, StopLossDetails stopLossOnFill, TrailingStopLossDetails trailingStopLossOnFill, ClientExtensions tradeClientExtensions, OrderID replacesOrderID, TransactionID cancellingTransactionID)
 {
     this.Id                      = id;
     this.Time                    = time;
     this.UserID                  = userID;
     this.AccountID               = accountID;
     this.BatchID                 = batchID;
     this.RequestID               = requestID;
     this.Type                    = type;
     this.Instrument              = instrument;
     this.Units                   = units;
     this.Price                   = price;
     this.PriceBound              = priceBound;
     this.TimeInForce             = timeInForce;
     this.GTDTime                 = gTDTime;
     this.PositionFill            = positionFill;
     this.TriggerCondition        = triggerCondition;
     this.Reason                  = reason;
     this.ClientExtensions        = clientExtensions;
     this.TakeProfitOnFill        = takeProfitOnFill;
     this.StopLossOnFill          = stopLossOnFill;
     this.TrailingStopLossOnFill  = trailingStopLossOnFill;
     this.TradeClientExtensions   = tradeClientExtensions;
     this.ReplacesOrderID         = replacesOrderID;
     this.CancellingTransactionID = cancellingTransactionID;
 }
Ejemplo n.º 5
0
 public MarketOrder(OrderID id, DateTime createTime, OrderState state, ClientExtensions clientExtensions, OrderType type, InstrumentName instrument, double units, TimeInForce timeInForce, PriceValue priceBound, OrderPositionFill positionFill, MarketOrderTradeClose tradeClose, MarketOrderPositionCloseout longPositionCloseout, MarketOrderPositionCloseout shortPositionCloseout, MarketOrderMarginCloseout marginCloseout, MarketOrderDelayedTradeClose delayedTradeClose, TakeProfitDetails takeProfitOnFill, StopLossDetails stopLossOnFill, TrailingStopLossDetails trailingStopLossOnFill, ClientExtensions tradeClientExtensions, TransactionID fillingTransactionID, DateTime filledTime, TradeID tradeOpenedID, TradeID tradeReducedID, List <TradeID> tradeClosedIDs, TransactionID cancellingTransactionID, DateTime cancelledTime)
 {
     this.Id                      = id;
     this.CreateTime              = createTime;
     this.State                   = state;
     this.ClientExtensions        = clientExtensions;
     this.Type                    = type;
     this.Instrument              = instrument;
     this.Units                   = units;
     this.TimeInForce             = timeInForce;
     this.PriceBound              = priceBound;
     this.PositionFill            = positionFill;
     this.TradeClose              = tradeClose;
     this.LongPositionCloseout    = longPositionCloseout;
     this.ShortPositionCloseout   = shortPositionCloseout;
     this.MarginCloseout          = marginCloseout;
     this.DelayedTradeClose       = delayedTradeClose;
     this.TakeProfitOnFill        = takeProfitOnFill;
     this.StopLossOnFill          = stopLossOnFill;
     this.TrailingStopLossOnFill  = trailingStopLossOnFill;
     this.TradeClientExtensions   = tradeClientExtensions;
     this.FillingTransactionID    = fillingTransactionID;
     this.FilledTime              = filledTime;
     this.TradeOpenedID           = tradeOpenedID;
     this.TradeReducedID          = tradeReducedID;
     this.TradeClosedIDs          = tradeClosedIDs;
     this.CancellingTransactionID = cancellingTransactionID;
     this.CancelledTime           = cancelledTime;
 }
Ejemplo n.º 6
0
 public StopOrder()
 {
     this.Id                      = new OrderID();
     this.CreateTime              = new DateTime();
     this.State                   = new OrderState();
     this.ClientExtensions        = new ClientExtensions();
     this.Type                    = new OrderType(EOrderType.STOP);
     this.Instrument              = new InstrumentName();
     this.Price                   = new PriceValue();
     this.PriceBound              = new PriceValue();
     this.TimeInForce             = new TimeInForce(ETimeInForce.GTC);
     this.GtdTime                 = new DateTime();
     this.PositionFill            = new OrderPositionFill(EOrderPositionFill.DEFAULT);
     this.TriggerCondition        = new OrderTriggerCondition(EOrderTriggerCondition.DEFAULT);
     this.TakeProfitOnFill        = new TakeProfitDetails();
     this.StopLossOnFill          = new StopLossDetails();
     this.TrailingStopLossOnFill  = new TrailingStopLossDetails();
     this.TradeClientExtensions   = new ClientExtensions();
     this.FillingTransactionID    = new TransactionID();
     this.FilledTime              = new DateTime();
     this.TradeOpenedID           = new TradeID();
     this.TradeReducedID          = new TradeID();
     this.TradeClosedIDs          = new List <TradeID>();
     this.CancellingTransactionID = new TransactionID();
     this.CancelledTime           = new DateTime();
     this.ReplacesOrderID         = new OrderID();
     this.ReplacedByOrderID       = new OrderID();
 }
Ejemplo n.º 7
0
 public MarketOrder()
 {
     this.Id                      = new OrderID();
     this.CreateTime              = new DateTime();
     this.State                   = new OrderState();
     this.ClientExtensions        = new ClientExtensions();
     this.Type                    = new OrderType(EOrderType.MARKET);
     this.Instrument              = new InstrumentName();
     this.TimeInForce             = new TimeInForce(ETimeInForce.FOK);
     this.PriceBound              = new PriceValue();
     this.PositionFill            = new OrderPositionFill(EOrderPositionFill.DEFAULT);
     this.TradeClose              = new MarketOrderTradeClose();
     this.LongPositionCloseout    = new MarketOrderPositionCloseout();
     this.ShortPositionCloseout   = new MarketOrderPositionCloseout();
     this.MarginCloseout          = new MarketOrderMarginCloseout();
     this.DelayedTradeClose       = new MarketOrderDelayedTradeClose();
     this.TakeProfitOnFill        = new TakeProfitDetails();
     this.StopLossOnFill          = new StopLossDetails();
     this.TrailingStopLossOnFill  = new TrailingStopLossDetails();
     this.TradeClientExtensions   = new ClientExtensions();
     this.FillingTransactionID    = new TransactionID();
     this.FilledTime              = new DateTime();
     this.TradeOpenedID           = new TradeID();
     this.TradeReducedID          = new TradeID();
     this.TradeClosedIDs          = new List <TradeID>();
     this.CancellingTransactionID = new TransactionID();
     this.CancelledTime           = new DateTime();
 }
Ejemplo n.º 8
0
 public StopOrder(OrderID id, DateTime createTime, OrderState state, ClientExtensions clientExtensions, OrderType type, InstrumentName instrument, double units, PriceValue price, PriceValue priceBound, TimeInForce timeInForce, DateTime gtdTime, OrderPositionFill positionFill, OrderTriggerCondition triggerCondition, TakeProfitDetails takeProfitOnFill, StopLossDetails stopLossOnFill, TrailingStopLossDetails trailingStopLossOnFill, ClientExtensions tradeClientExtensions, TransactionID fillingTransactionID, DateTime filledTime, TradeID tradeOpenedID, TradeID tradeReducedID, List <TradeID> tradeClosedIDs, TransactionID cancellingTransactionID, DateTime cancelledTime, OrderID replacesOrderID, OrderID replacedByOrderID)
 {
     this.Id                      = id;
     this.CreateTime              = createTime;
     this.State                   = state;
     this.ClientExtensions        = clientExtensions;
     this.Type                    = type;
     this.Instrument              = instrument;
     this.Units                   = units;
     this.Price                   = price;
     this.PriceBound              = priceBound;
     this.TimeInForce             = timeInForce;
     this.GtdTime                 = gtdTime;
     this.PositionFill            = positionFill;
     this.TriggerCondition        = triggerCondition;
     this.TakeProfitOnFill        = takeProfitOnFill;
     this.StopLossOnFill          = stopLossOnFill;
     this.TrailingStopLossOnFill  = trailingStopLossOnFill;
     this.TradeClientExtensions   = tradeClientExtensions;
     this.FillingTransactionID    = fillingTransactionID;
     this.FilledTime              = filledTime;
     this.TradeOpenedID           = tradeOpenedID;
     this.TradeReducedID          = tradeReducedID;
     this.TradeClosedIDs          = tradeClosedIDs;
     this.CancellingTransactionID = cancellingTransactionID;
     this.CancelledTime           = cancelledTime;
     this.ReplacesOrderID         = replacesOrderID;
     this.ReplacedByOrderID       = replacedByOrderID;
 }
        public static ITypeSearch <T> Filter <T>(this ITypeSearch <T> query, IFilterStatementRequest request) where T : IContent
        {
            if (request?.Filters?.Items == null)
            {
                return(query);
            }
            var filterBuilder = ClientExtensions.BuildFilter <T>(SearchClient.Instance);

            filterBuilder = request.Filters.Items.Aggregate(filterBuilder, (builder, item) =>
            {
                if (item.Connector == FilterStatementConnector.And)
                {
                    return(builder.And(GetExpression <T>(item)));
                }
                else
                {
                    var expression = GetExpression <T>(item);
                    if (expression == null)
                    {
                        expression = GetExpression <T>(item);
                    }
                    return(expression == null ? builder : builder.Or(expression));
                }
            });

            if (filterBuilder.HasFilter)
            {
                query = TypeSearchExtensions.Filter(query, filterBuilder);
            }

            return(query);
        }
Ejemplo n.º 10
0
        protected Future <object> UnsubscribeFromChannel(string channel)
        {
            Promise <object> promise = new Promise <object>();

            try
            {
                ClientExtensions.LeaveConference(Client, new LeaveConferenceArgs(channel)
                {
                    OnSuccess = (o) =>
                    {
                        promise.Resolve(o);
                    },
                    OnFailure = (e) =>
                    {
                        promise.Reject(e.Exception);
                    }
                });
            }
            catch (Exception e)
            {
                promise.Reject(e);
            }

            return(promise);
        }
Ejemplo n.º 11
0
 public Order(OrderID id, DateTime createTime, OrderState state, ClientExtensions clientExtensions)
 {
     this.Id               = id;
     this.CreateTime       = createTime;
     this.State            = state;
     this.ClientExtensions = clientExtensions;
 }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.Clear();

            //var client = new HttpClient();

            var client = ClientExtensions.CreateClient(new RedisStore("localhost:6379"));

            client.BaseAddress = new Uri("http://localhost:1337");

            while (true)
            {
                var response = client.GetAsync("/time").Result;

                var content = response.Content.ReadAsStringAsync().Result;

                Console.WriteLine(content);
                Console.WriteLine(response.Headers.CacheControl.ToString());

                if (Console.ReadLine() == "done")
                {
                    break;
                }
            }
        }
Ejemplo n.º 13
0
 public Order()
 {
     this.Id               = new OrderID();
     this.CreateTime       = new DateTime();
     this.State            = new OrderState();
     this.ClientExtensions = new ClientExtensions();
 }
Ejemplo n.º 14
0
        public async Task SecondTimeComesFromCacheBecauseOfQueryProvider()
        {
            var ETagThatHashingGenerates = "U/I5fgFOxAXw7An1tsyvLTZrQhvqCDIAagv7s5NopKA="; // this is based on the collection data

            var handler = _server.CreateHandler();
            var client  = ClientExtensions.CreateClient(handler);

            client.BaseAddress = _server.BaseAddress;
            client.DefaultRequestHeaders.Add(TestViewModelCollectionQueryProvider.HeaderName,
                                             new TimedEntityTagHeaderValue(ETagThatHashingGenerates).ETag.Tag);
            var response = await client.GetAsync("/api/withquery");

            var response2 = await client.GetAsync("/api/withquery");

            var serverCch = response2.GetCacheCowHeader();

            Assert.NotNull(serverCch);
            Assert.True(serverCch.ShortCircuited);

            var cch = response2.Headers.GetCacheCowHeader();

            Assert.NotNull(cch);
            Assert.False(cch.DidNotExist);
            Assert.True(cch.CacheValidationApplied);
            Assert.True(cch.RetrievedFromCache);
        }
        object IValueConverter.Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Operation operation = value as Operation;

            if (operation == null)
            {
                return(null);
            }

            byte[]   buffer    = null;
            FileInfo imagePath = new FileInfo(Path.Combine(CacheLocation, operation.Id + ".png"));

            if (!imagePath.Exists)
            {
                buffer = DownloadRoutePlan(operation);
                if (buffer == null)
                {
                    return(ClientExtensions.GetPackUri(this, "Images/NoRouteImage.png"));
                }

                imagePath.Directory.Create();
                File.WriteAllBytes(imagePath.FullName, buffer);
            }
            else
            {
                buffer = File.ReadAllBytes(imagePath.FullName);
            }

            BitmapImage image = new BitmapImage();

            image.BeginInit();
            image.StreamSource = new MemoryStream(buffer);
            image.EndInit();
            return(image);
        }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            Console.WriteLine("Getting the Time");
            //var client = new HttpClient();
            var client = ClientExtensions.CreateClient(new RedisStore("localhost"));

            client.BaseAddress = new Uri("http://localhost:1337");

            while (true)
            {
                var response = client.GetAsync("/time1").Result;

                Console.WriteLine(response.StatusCode);
                Console.WriteLine(response.Headers.CacheControl.ToString());

                var content = response.Content.ReadAsStringAsync().Result;

                Console.WriteLine(content);
                Console.WriteLine("Hit enter To try again, or type 'done' to quit");

                if (Console.ReadLine() == "done")
                {
                    break;
                }
            }
        }
Ejemplo n.º 17
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            var client      = ClientExtensions.CreateClient(new RedisStore("localhost:6379"));
            var baseAddress = new Uri("http://localhost:1337");

            client.BaseAddress = baseAddress;


            while (true)
            {
                Console.WriteLine("Hit Enter to Call the API");
                Console.ReadLine();
                var response = await client.GetAsync("/cache/time");

                Console.WriteLine(response.StatusCode);
                Console.WriteLine(response.Headers.CacheControl.ToString());
                var content = await response.Content.ReadAsStringAsync();

                Console.WriteLine(content);
                Console.WriteLine("Type 'done' to quit");
                if (Console.ReadLine() == "done")
                {
                    break;
                }
            }
        }
Ejemplo n.º 18
0
        private async Task <FeedResource <Address> > GetMasterAddressesViaGatewayAsync(
            DocumentServiceRequest request,
            ResourceType resourceType,
            string resourceAddress,
            string entryUrl,
            bool forceRefresh,
            bool useMasterCollectionResolver)
        {
            INameValueCollection addressQuery = new DictionaryNameValueCollection(StringComparer.Ordinal);

            addressQuery.Add(HttpConstants.QueryStrings.Url, HttpUtility.UrlEncode(entryUrl));

            INameValueCollection headers = new DictionaryNameValueCollection(StringComparer.Ordinal);

            if (forceRefresh)
            {
                headers.Set(HttpConstants.HttpHeaders.ForceRefresh, bool.TrueString);
            }

            if (useMasterCollectionResolver)
            {
                headers.Set(HttpConstants.HttpHeaders.UseMasterCollectionResolver, bool.TrueString);
            }

            if (request.ForceCollectionRoutingMapRefresh)
            {
                headers.Set(HttpConstants.HttpHeaders.ForceCollectionRoutingMapRefresh, bool.TrueString);
            }

            addressQuery.Add(HttpConstants.QueryStrings.Filter, this.protocolFilter);

            string resourceTypeToSign = PathsHelper.GetResourcePath(resourceType);

            headers.Set(HttpConstants.HttpHeaders.XDate, DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
            string token = this.tokenProvider.GetUserAuthorizationToken(
                resourceAddress,
                resourceTypeToSign,
                HttpConstants.HttpMethods.Get,
                headers,
                AuthorizationTokenType.PrimaryMasterKey,
                payload: out _);

            headers.Set(HttpConstants.HttpHeaders.Authorization, token);

            Uri targetEndpoint = UrlUtility.SetQuery(this.addressEndpoint, UrlUtility.CreateQuery(addressQuery));

            string identifier = GatewayAddressCache.LogAddressResolutionStart(request, targetEndpoint);

            using (HttpResponseMessage httpResponseMessage = await this.httpClient.GetAsync(targetEndpoint, headers))
            {
                using (DocumentServiceResponse documentServiceResponse =
                           await ClientExtensions.ParseResponseAsync(httpResponseMessage))
                {
                    GatewayAddressCache.LogAddressResolutionEnd(request, identifier);
                    return(documentServiceResponse.GetResource <FeedResource <Address> >());
                }
            }
        }
Ejemplo n.º 19
0
 public UpdateOrderClientExtensionsResponse UpdateOrderClientExtensions(AccountId accountId, OrderSpecifier orderSpecifier,
                                                                        ClientExtensions clientExtensions = null, ClientExtensions tradeClientExtensions = null)
 => Execute <UpdateOrderClientExtensionsResponse>(new UpdateOrderClientExtensionsEndpoint()
 {
     AccountId             = accountId,
     OrderSpecifier        = orderSpecifier,
     ClientExtensions      = clientExtensions,
     TradeClientExtensions = tradeClientExtensions
 });
Ejemplo n.º 20
0
 public override void RenegotiateSessionChannel(Connection connection)
 {
     try
     {
         ClientExtensions.Renegotiate(Client, SessionChannel, connection);
     }
     catch (Exception e)
     {
     }
 }
Ejemplo n.º 21
0
 public override void Reconnect(PeerClient remoteClient, Connection connection)
 {
     try
     {
         ClientExtensions.ReconnectRemoteClient(Client, remoteClient, connection);
     }
     catch (Exception e)
     {
     }
 }
 public TradeClientExtensionsModifyTransaction()
 {
     this.Id            = new TransactionID();
     this.Time          = new DateTime();
     this.AccountID     = new AccountID();
     this.BatchID       = new TransactionID();
     this.RequestID     = new RequestID();
     this.Type          = new TransactionType(ETransactionType.TRADE_CLIENT_EXTENSIONS_MODIFY);
     this.TradeID       = new TradeID();
     this.ClientTradeID = new ClientID();
     this.TradeClientExtensionsModify = new ClientExtensions();
 }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            // setup
            _server = new TestServer(new WebHostBuilder()
                                     .UseStartup <Startup>());
            var handler = _server.CreateHandler();

            _client             = ClientExtensions.CreateClient(handler);
            _client.BaseAddress = _server.BaseAddress;

            Task.Run(RunAsync).Wait();
        }
Ejemplo n.º 24
0
 public MarketOrderRejectTransaction(
     TransactionID id,
     DateTime time,
     int userId,
     AccountID accountID,
     TransactionID batchID,
     RequestID requestID,
     TransactionType type,
     InstrumentName instrument,
     double units,
     TimeInForce timeInForce,
     PriceValue priceBound,
     OrderPositionFill positionFill,
     MarketOrderTradeClose tradeClose,
     MarketOrderPositionCloseout longPositionCloseout,
     MarketOrderPositionCloseout shortPositionCloseout,
     MarketOrderMarginCloseout marginCloseout,
     MarketOrderDelayedTradeClose delayedTradeClose,
     MarketOrderReason reason,
     ClientExtensions clientExtensions,
     TakeProfitDetails takeProfitOnFill,
     StopLossDetails stopLossOnFill,
     TrailingStopLossDetails trailingStopLossOnFill,
     ClientExtensions tradeClientExtensions,
     TransactionRejectReason rejectReason
     )
 {
     this.Id                     = id;
     this.Time                   = time;
     this.UserId                 = userId;
     this.AccountID              = accountID;
     this.BatchID                = batchID;
     this.RequestID              = requestID;
     this.Type                   = type;
     this.Instrument             = instrument;
     this.Units                  = units;
     this.TimeInForce            = timeInForce;
     this.PriceBound             = priceBound;
     this.PositionFill           = positionFill;
     this.TradeClose             = tradeClose;
     this.LongPositionCloseout   = longPositionCloseout;
     this.ShortPositionCloseout  = shortPositionCloseout;
     this.MarginCloseout         = marginCloseout;
     this.DelayedTradeClose      = delayedTradeClose;
     this.Reason                 = reason;
     this.ClientExtensions       = clientExtensions;
     this.TakeProfitOnFill       = takeProfitOnFill;
     this.StopLossOnFill         = stopLossOnFill;
     this.TrailingStopLossOnFill = trailingStopLossOnFill;
     this.TradeClientExtensions  = tradeClientExtensions;
     this.RejectReason           = rejectReason;
 }
Ejemplo n.º 25
0
        public async Task WithClientCachingReturnsFromCacheSecondRequestIfExpiryNotPassed()
        {
            var handler = _server.CreateHandler();
            var client  = ClientExtensions.CreateClient(handler);

            client.BaseAddress = _server.BaseAddress;
            var response = await client.GetAsync("/api/bettertest/1");

            var response2 = await client.GetAsync("/api/bettertest/1");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.True(response2.Headers.GetCacheCowHeader().RetrievedFromCache);
        }
 public TradeClientExtensionsModifyTransaction(TransactionID id, DateTime time, int userID, AccountID accountID, TransactionID batchID, RequestID requestID, TransactionType type, TradeID tradeID, ClientID clientTradeID, ClientExtensions tradeClientExtensionsModify)
 {
     this.Id            = id;
     this.Time          = time;
     this.UserID        = userID;
     this.AccountID     = accountID;
     this.BatchID       = batchID;
     this.RequestID     = requestID;
     this.Type          = type;
     this.TradeID       = tradeID;
     this.ClientTradeID = clientTradeID;
     this.TradeClientExtensionsModify = tradeClientExtensionsModify;
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Method which performs the work of the background task.
        /// </summary>
        /// <param name="taskInstance">The interface to an instance of the background task</param>
        private async void Update(IBackgroundTaskInstance taskInstance)
        {
            BackgroundTaskDeferral deferral = taskInstance.GetDeferral();

#if !DEBUG
            if (!(DateTime.Today.Month == 7 || DateTime.Today.Month == 8))
#else
            if (true)
#endif
            {
                PasswordCredential credential = SecurityExtensions.RetrieveCredentials();
                if (credential != null)
                {
                    credential.RetrievePassword();

                    try
                    {
                        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                        ToastNotificationManager.History.Clear();

                        using (ClientExtensions client = new ClientExtensions())
                        {
                            await client.AuthenticateAndInitDataAsync(new UserCredentials(credential.UserName, credential.Password), false);

                            CheckAndSendNotification(BackgroundTaskExtensions.EVENTS, client.AccountDetails.AbsenceEvents.Count(item => !item.IsJustified), "AbsenceNotification".GetLocalized());
                            CheckAndSendNotification(BackgroundTaskExtensions.APPOINTMENTS, client.AccountDetails.AgendaEvents.Count, "AgendaNotification".GetLocalized());
                            CheckAndSendNotification(BackgroundTaskExtensions.DIDACTICS, client.AccountDetails.DidacticsItems.Count, "DidactictNotification".GetLocalized());
                            CheckAndSendNotification(BackgroundTaskExtensions.GRADES, client.AccountDetails.Grades.Count, "GradeNotification".GetLocalized());
                            CheckAndSendNotification(BackgroundTaskExtensions.NOTES, client.AccountDetails.Notes.Count, "NoteNotification".GetLocalized());
                            CheckAndSendNotification(BackgroundTaskExtensions.ITEMS, client.AccountDetails.NoticeboardItems.Count, "NoticeboardNotification".GetLocalized());
                        }
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
            }
            else
            {
                ResourceExtensions.StoreRoamingObject(BackgroundTaskExtensions.EVENTS, 0);
                ResourceExtensions.StoreRoamingObject(BackgroundTaskExtensions.APPOINTMENTS, 0);
                ResourceExtensions.StoreRoamingObject(BackgroundTaskExtensions.DIDACTICS, 0);
                ResourceExtensions.StoreRoamingObject(BackgroundTaskExtensions.GRADES, 0);
                ResourceExtensions.StoreRoamingObject(BackgroundTaskExtensions.NOTES, 0);
                ResourceExtensions.StoreRoamingObject(BackgroundTaskExtensions.ITEMS, 0);
            }

            deferral.Complete();
        }
 public OrderClientExtensionsModifyRejectTransaction()
 {
     this.Id                          = new TransactionID();
     this.Time                        = new DateTime();
     this.AccountID                   = new AccountID();
     this.BatchID                     = new TransactionID();
     this.RequestID                   = new RequestID();
     this.Type                        = new TransactionType(ETransactionType.ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT);
     this.OrderID                     = new OrderID();
     this.ClientOrderID               = new ClientID();
     this.ClientExtensionsModify      = new ClientExtensions();
     this.TradeClientExtensionsModify = new ClientExtensions();
     this.RejectReason                = new TransactionRejectReason();
 }
Ejemplo n.º 29
0
        static void Main(string[] args)
        {
            var server = new TestServer(new WebHostBuilder()
                                        .UseStartup <Startup>());
            var handler = server.CreateHandler();

            var client = ClientExtensions.CreateClient(handler);

            client.BaseAddress = server.BaseAddress;

            var p = new ConsoleMenu(client);

            Task.Run(async() => await p.Menu()).Wait();
        }
 public OrderClientExtensionsModifyRejectTransaction(TransactionID id, DateTime time, int userID, AccountID accountID, TransactionID batchID, RequestID requestID, TransactionType type, OrderID orderID, ClientID clientOrderID, ClientExtensions clientExtensionsModify, ClientExtensions tradeClientExtensionsModify, TransactionRejectReason rejectReason)
 {
     this.Id                          = id;
     this.Time                        = time;
     this.UserID                      = userID;
     this.AccountID                   = accountID;
     this.BatchID                     = batchID;
     this.RequestID                   = requestID;
     this.Type                        = type;
     this.OrderID                     = orderID;
     this.ClientOrderID               = clientOrderID;
     this.ClientExtensionsModify      = clientExtensionsModify;
     this.TradeClientExtensionsModify = tradeClientExtensionsModify;
     this.RejectReason                = rejectReason;
 }