Esempio n. 1
0
            public GetConflictsResult.Conflict[] GetConflictsFor(string id)
            {
                var getConflictsCommand = new GetConflictsCommand(id);

                RequestExecutor.Execute(getConflictsCommand, Context);
                return(getConflictsCommand.Result.Results);
            }
    public async Task <Item> getPlaylist(int gameweek)
    {
        var request  = RequestGenerator.search(gameweek);
        var response = await executor.Execute(request);

        SearchList list = JsonConvert.DeserializeObject <SearchList>(response, new JsonSerializerSettings {
            NullValueHandling = NullValueHandling.Ignore
        });

        return(findItem(list));
    }
Esempio n. 3
0
        /**
         * Get dashboard data of user
         * @param user: the id of current user
         * */
        public Task <DashboardResponse> GetDashboard()
        {
            var uri  = GetUserUri("dashboard");
            var exec = new RequestExecutor <DashboardResponse>(this);

            return(exec.Execute(uri, null, method: "GET"));
        }
        private async void btnSendReview_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCarOvner.Text) || string.IsNullOrEmpty(txtReview.Text))
            {
                MessageBox.Show(@"Поле Номер 'Имя владельца авто' и 'Отзыв' обязательны для заполнения");
                return;
            }

            var currentStatus = PanelRefresh.StartRefresh(this, pbReview);
            await Task.Run(() =>
            {
                var review = new Review
                {
                    ReviewDateTime = DateTime.Now,
                    SourceUrl      = null,
                    UserName       = txtCarOvner.Text,
                    UserReview     = txtReview.Text
                };
                history.Review = review;
                RequestExecutor.Execute(() =>
                {
                    var result = WCFServiceFactory.CreateVtecTeamService().UpdateReflashHistory(history);

                    this.Invoke(() => pbReview.Image = !result ? Properties.Resources.Error : null);
                    MessageBox.Show(result ? "Запрос успешно отправлен" : "Не удалось отправить запрос.");
                });
            });

            pbReview.Visible = false;
            PanelRefresh.StopRefresh(currentStatus);
        }
Esempio n. 5
0
        /**
         * @param user: The id of current user
         * @param placeId: ID of the place to delete
         * */
        public Task <ResponseBase> DeletePlace(string user, string placeId)
        {
            var uri  = GetUserUri("place/" + placeId);
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, null, method: "DELETE"));
        }
Esempio n. 6
0
        /**
         * Disallow user to see me
         * */
        public Task <ResponseBase> DisallowContactToSeeMe(string anotherUser)
        {
            var uri  = GetUserUri("allow/" + anotherUser);
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, null, method: "DELETE"));
        }
Esempio n. 7
0
        public bool AttachmentExists(string documentId, string name)
        {
            var command = new HeadAttachmentCommand(documentId, name, null);

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            return(command.Result != null);
        }
Esempio n. 8
0
        /**
         * @param user: Request location of user
         * */
        public Task <ResponseBase> RequestLocationUpdates(string user)
        {
            var uri  = GetUserUri("update/locations");
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, null, method: "POST"));
        }
Esempio n. 9
0
        /// <summary>
        /// Get places for user
        /// </summary>
        /// <returns></returns>
        public Task <PlacesResponse> GetPlaces()
        {
            var uri  = GetUserUri("places");
            var exec = new RequestExecutor <PlacesResponse>(this);

            return(exec.Execute(uri, null, method: "GET"));
        }
Esempio n. 10
0
        private async void Run()
        {
            Console.WriteLine("Client Start");

            var connection = new SignalRConnection();

            IClientLogger myLogger          = new ClientConsoleLogger();
            var           connectionOptions = new ConnectionOptions("http://127.0.0.1:15117/signalr", myLogger);
            await connection.Connect(connectionOptions);

            var requestReceiver = new RequestReceiver(connection);
            var requestExecutor = new RequestExecutor(connection);

            do
            {
                var response = await requestReceiver.ReadAsync <TestResponse>(new TestRequest { Test = "Hello Server!" });

                requestExecutor.Execute(new MyRequest {
                    Hessage = "Hello Server with responseless request"
                });
                Console.WriteLine(response.Text);
            } while (true);

            Console.WriteLine("Client End");
        }
        public long GetCountFor(string id)
        {
            var operation = new GetRevisionsCountOperation(id);
            var command   = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            return(command.Result);
        }
Esempio n. 12
0
        public T Get <T>(string id, DateTime date)
        {
            var operation = new GetRevisionOperation(Session, id, date);
            var command   = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisionsFor <T>().FirstOrDefault());
        }
Esempio n. 13
0
        public List <MetadataAsDictionary> GetMetadataFor(string id, int start = 0, int pageSize = 25)
        {
            var operation = new GetRevisionOperation(Session, id, start, pageSize, true);
            var command   = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisionsMetadataFor());
        }
Esempio n. 14
0
        public IEnumerator <StreamResult <T> > Stream <T>(IDocumentQuery <T> query)
        {
            var streamOperation = new StreamOperation(this);
            var command         = streamOperation.CreateRequest(query.GetIndexQuery());

            RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo);
            var result = streamOperation.SetResult(command.Result);

            return(YieldResults(query, result));
        }
Esempio n. 15
0
        public Dictionary <string, T> Get <T>(IEnumerable <string> changeVectors)
        {
            var operation = new GetRevisionOperation(Session, changeVectors);

            var command = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisions <T>());
        }
Esempio n. 16
0
        public List <T> GetFor <T>(string id, int start = 0, int pageSize = 25)
        {
            var operation = new GetRevisionOperation(Session, id, start, pageSize);

            var command = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisionsFor <T>());
        }
Esempio n. 17
0
        public T Get <T>(string changeVector)
        {
            var operation = new GetRevisionOperation(Session, changeVector);

            var command = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevision <T>());
        }
Esempio n. 18
0
        private IEnumerator <TimeSeriesStreamResult <T> > StreamTimeSeriesInternal <T>(IDocumentQuery <T> query) where T : ITimeSeriesQueryStreamResult, new()
        {
            var streamOperation = new StreamOperation(this);
            var command         = streamOperation.CreateRequest(query.GetIndexQuery());

            RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo);
            var result = streamOperation.SetResultForTimeSeries(command.Result);

            return(YieldTimeSeriesResults(query, result));
        }
Esempio n. 19
0
        public void Changes()
        {
            var store = new DocumentStore().Initialize();

            #region events_1
            store.OnBeforeStore         += (s, e) => { };
            store.OnAfterSaveChanges    += (s, e) => { };
            store.OnBeforeDelete        += (s, e) => { };
            store.OnBeforeQueryExecuted += (s, e) => { };
            #endregion

            #region urls_1
            new DocumentStore
            {
                Urls = new []
                {
                    "http://ravendb-1:8080",
                    "http://ravendb-2:8080",
                    "http://ravendb-3:8080"
                }
            }.Initialize();
            #endregion

            #region request_executor_1
            RequestExecutor requestExecutor = store.GetRequestExecutor();

            using (requestExecutor.ContextPool.AllocateOperationContext(out JsonOperationContext context))
            {
                var command = new GetDocumentsCommand(start: 0, pageSize: 10);
                requestExecutor.Execute(command, context);

                GetDocumentsResult result = command.Result;
            }
            #endregion

            #region request_executor_2
            int numberOfCachedItems = requestExecutor.Cache.NumberOfItems;

            requestExecutor.Cache.Clear();
            #endregion

            #region request_executor_3
            var numberOfSentRequests = requestExecutor.NumberOfServerRequests;
            #endregion

            #region request_executor_4
            requestExecutor.DefaultTimeout = TimeSpan.FromSeconds(180);
            #endregion

            #region request_executor_5
            using (store.SetRequestsTimeout(TimeSpan.FromMilliseconds(180)))
            {
            }
            #endregion
        }
Esempio n. 20
0
        /**
         * Register WP8 notification token
         * @param notificationUri: The token
         * */
        public Task <ResponseBase> RegisterNotificationUrl(string notificationUri)
        {
            var data = new NotificationConfigData();

            data.Uri = notificationUri;

            var uri  = GetUserUri("wp8NotificationURL");
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, data, method: "POST"));
        }
Esempio n. 21
0
        /**
         * @param user: the id of current user
         * @param visible: true or false to set visibility of user
         * */
        public Task <ResponseBase> ChangeVisibility(bool visible)
        {
            var data = new ChangeVisibilityData();

            data.Visibility = visible;

            var uri  = GetUserUri("visibility");
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, data, method: "PUT"));
        }
Esempio n. 22
0
        /**
         * Allow one or more users to see me.
         * @param user: the id of current user
         * @param anotherUsers: List of emails
         * */
        public Task <ResponseBase> AllowContactToSeeMe(List <string> anotherUsers)
        {
            var data = new AllowedContactsData();

            data.Emails = anotherUsers;

            var uri  = GetUserUri("allow");
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, data, method: "POST"));
        }
Esempio n. 23
0
        public IHttpActionResult ExecuteStoredRequest(string id)
        {
            Request request = RequestRepo.FindById(id);

            if (request == null)
            {
                return(BadRequest($"Could not find a stored request with ID of [{id}]"));
            }

            return(Ok(RequestExecutor.Execute(request)));
        }
Esempio n. 24
0
        /// <summary>
        /// Signup to Lokki service
        /// @param emailAddress: The email of user
        /// @param deviceIdentifier: The deviceID of user's device.
        /// </summary>
        public Task <SignupResponse> Signup(string emailAddress, string deviceIdentifier)
        {
            var data = new SignupRequestData();

            data.Email    = emailAddress;
            data.DeviceId = deviceIdentifier;

            var uri  = GetApiUri("signup");
            var exec = new RequestExecutor <SignupResponse>(this);

            return(exec.Execute(uri, data, method: "POST"));
        }
Esempio n. 25
0
        public void StreamInto <T>(IDocumentQuery <T> query, Stream output)
        {
            var streamOperation = new StreamOperation(this);
            var command         = streamOperation.CreateRequest(query.GetIndexQuery());

            RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo);

            using (command.Result.Response)
                using (command.Result.Stream)
                {
                    command.Result.Stream.CopyTo(output);
                }
        }
Esempio n. 26
0
        /// <summary>
        /// Create new place for user
        /// </summary>
        /// <returns></returns>
        public Task <UpdatePlaceResponse> UpdatePlace(string id, string name, double lat, double lon, double radius)
        {
            var uri  = GetUserUri("place/" + id);
            var exec = new RequestExecutor <UpdatePlaceResponse>(this);

            var data = new PlaceData();

            data.Name      = name;
            data.Latitude  = lat;
            data.Longitude = lon;
            data.Radius    = radius;
            data.Image     = "";
            return(exec.Execute(uri, data, method: "PUT"));
        }
Esempio n. 27
0
        public IEnumerator <StreamResult <T> > Stream <T>(IDocumentQuery <T> query, out StreamQueryStatistics streamQueryStats)
        {
            var stats           = new StreamQueryStatistics();
            var streamOperation = new StreamOperation(this, stats);
            var command         = streamOperation.CreateRequest(query.GetIndexQuery());

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            using (var result = streamOperation.SetResult(command.Result))
            {
                streamQueryStats = stats;

                return(YieldResults(query, result));
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Saves all the changes to the Raven server.
        /// </summary>
        public void SaveChanges()
        {
            var saveChangesOperation = new BatchOperation(this);

            using (var command = saveChangesOperation.CreateRequest())
            {
                if (command == null)
                {
                    return;
                }

                RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
                saveChangesOperation.SetResult(command.Result);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Report location to backend
        /// </summary>
        public Task <ResponseBase> ReportLocationToServer(double lat, double lon, double acc, long time)
        {
            var data = new ReportLocationData();

            data.Location           = new LocationData();
            data.Location.Latitude  = lat;
            data.Location.Longitude = lon;
            data.Location.Accuracy  = acc;
            data.Location.Time      = time;

            var uri  = GetUserUri("location");
            var exec = new RequestExecutor <ResponseBase>(this);

            return(exec.Execute(uri, data, method: "POST"));
        }
        private IEnumerator <TimeSeriesStreamResult <T> > StreamTimeSeriesInternal <T>(IDocumentQuery <T> query, out StreamQueryStatistics streamQueryStats) where T : ITimeSeriesQueryStreamResult, new()
        {
            var stats           = new StreamQueryStatistics();
            var streamOperation = new StreamOperation(this, stats);
            var command         = streamOperation.CreateRequest(query.GetIndexQuery());

            RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo);
            streamOperation.EnsureIsAcceptable(query.IndexName, command.Result);

            var result = streamOperation.SetResultForTimeSeries(command.Result);

            streamQueryStats = stats;

            return(YieldTimeSeriesResults(query, result));
        }