public async Task <Dealers> DeleteDealer(Dealers dealer)
        {
            var url = URLBuilder.GetURL(Controllers.REAGENT, EndPoint.DEALER_DELETE);

            return(await requestProvider.DeleteAsync(url, dealer, new Dictionary <string, string> {
                ["id"] = dealer.Id.ToString()
            }));
        }
        public async Task <Formulas> DeleteForumula(Formulas formula)
        {
            var url = URLBuilder.GetURL(Controllers.TEST, EndPoint.TEST_FORMULA_DELETE);

            return(await requestProvider.DeleteAsync(url, formula, new Dictionary <string, string> {
                ["id"] = formula.Id.ToString()
            }));
        }
示例#3
0
        public async Task DeleteCommodityItemAsync(string id, string token = "")
        {
            var builder = new UriBuilder(GlobalSettings.Instance.UnitEndpoint)
            {
                Path = $"{ApiUrlBase}/{id}"
            };

            await _requestProvider.DeleteAsync(builder.ToString(), token);
        }
示例#4
0
        public Task <ProfileDTO> NixTeamAppointmentAsync(long targetTeamId, CancellationTokenSource cancellationTokenSource) =>
        Task <ProfileDTO> .Run(async() => {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            ProfileDTO resultProfile = null;

            NixTeamAppointmentRequest nixTeamAppointmentRequest = new NixTeamAppointmentRequest()
            {
                AccessToken = GlobalSettings.Instance.UserProfile.AccesToken,
                Url         = string.Format(GlobalSettings.Instance.Endpoints.TeamEndPoints.NixTeamAppointmentRequest, targetTeamId)
            };

            NixTeamAppointmentResponse nixTeamAppointmentResponse = null;

            try {
                nixTeamAppointmentResponse = await _requestProvider.DeleteAsync <NixTeamAppointmentRequest, NixTeamAppointmentResponse>(nixTeamAppointmentRequest);

                if (nixTeamAppointmentResponse != null)
                {
                    resultProfile = _profileFactory.BuildProfileDTO(nixTeamAppointmentResponse);
                }
                else
                {
                    throw new InvalidOperationException(TeamService.NIX_APPOINTMENT_TO_THE_TEAM_COMMON_ERROR_MESSAGE);
                }
            }
            catch (ServiceAuthenticationException exc) {
                _identityUtilService.RefreshToken();

                throw exc;
            }
            catch (HttpRequestExceptionEx exc) {
                nixTeamAppointmentResponse = JsonConvert.DeserializeObject <NixTeamAppointmentResponse>(exc.Message);

                string output = string.Format("{0}",
                                              nixTeamAppointmentResponse.Relation?.FirstOrDefault());

                output = (string.IsNullOrWhiteSpace(output) || string.IsNullOrEmpty(output)) ? TeamService.NIX_APPOINTMENT_TO_THE_TEAM_COMMON_ERROR_MESSAGE : output;

                throw new InvalidOperationException(output.Trim());
            }
            catch (Exception exc) {
                Crashes.TrackError(exc);
                throw;
            }

            return(resultProfile);
        }, cancellationTokenSource.Token);
        public async Task <Abbrevations> DeleteAbbrevation(Abbrevations abbrevation)
        {
            var url = URLBuilder.GetURL(Controllers.MAINTENANCE, EndPoint.MAINTENANCE_ABBREVATION_DELETE);

            return(await requestProvider.DeleteAsync(url, abbrevation, new Dictionary <string, string> {
                ["id"] = abbrevation.Id.ToString()
            }));
        }
        public async Task ClearBasketAsync(string guidUser, string token)
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}/{guidUser}");

            await _requestProvider.DeleteAsync(uri, token);

            LocalBasketItems = null;
        }
示例#7
0
        public async Task <PatientDto> DeletePatient(PatientDto patient)
        {
            var url = URLBuilder.GetURL(Controllers.PATIENT, EndPoint.PATIENT_DELETE);

            return(await requestProvider.DeleteAsync(url, patient, new Dictionary <string, string> {
                ["id"] = patient.Patient.Id.ToString()
            }));
        }
示例#8
0
        public async Task <UsersDto> DeleteUser(UsersDto userDto)
        {
            var url = URLBuilder.GetURL(Controllers.USER, EndPoint.USER_DELETE);

            return(await requestProvider.DeleteAsync(url, userDto, new Dictionary <string, string> {
                ["id"] = userDto.Id.ToString()
            }));
        }
        public async Task ClearBasketAsync(string guidUser, string token)
        {
            UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);

            builder.Path = guidUser;
            string uri = builder.ToString();

            await _requestProvider.DeleteAsync(uri, token);
        }
        public async Task ClearBasketAsync(string guidUser, string token)
        {
            var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
            {
                Path = $"{ApiUrlBase}/{guidUser}"
            };

            var uri = builder.ToString();
            await _requestProvider.DeleteAsync(uri, token);
        }
        public async Task Logout()
        {
            AccessToken authToken = _settingsService.AuthAccessToken;

            if (authToken != null)
            {
                string uri = Constants.PtBasedUrl + "auth";
                await _requestProvider.DeleteAsync(uri, authToken.Token);
            }
        }
示例#12
0
        public async Task DeleteUnit(int id, string token = "")
        {
            var builder = new UriBuilder(GlobalSettings.Instance.UnitEndpoint)
            {
                Path = $"{ApiUrlBase}/{id}"
            };

            var uri = builder.ToString();

            await _requestProvider.DeleteAsync(uri, token);
        }
        public async Task <Expenses> DeleteExpense(Expenses expense)
        {
            var url = URLBuilder.GetURL(Controllers.FINANCE, EndPoint.FINANCE_EXPENSES_DELETE);

            return(await requestProvider.DeleteAsync(url, expense, new Dictionary <string, string> {
                ["id"] = expense.Id.ToString()
            }));
        }
示例#14
0
        public async Task <bool> DeleteProductAsync(string guid, string token)
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}{ApiUrlItemCode}/{guid}");

            try
            {
                await _requestProvider.DeleteAsync(uri, token);

                return(true);
            }
            catch (HttpRequestExceptionEx exception) when(exception.HttpCode == System.Net.HttpStatusCode.NotFound)
            {
                return(false);
            }
        }
        public async Task DeleteTodoItemAsync(string id)
        {
            try
            {
                bool result = await requestProvider.DeleteAsync(string.Format(Constants.RestUrl, id));

                if (result)
                {
                    Debug.WriteLine("TodoItem successfully deleted.");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("ERROR: {0}", ex.Message);
            }
        }
示例#16
0
        public async Task <CartModel> DeleteCartItemAsync(string id, string token)
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}?transactionId={id}");

            CartModel cart;

            try
            {
                cart = await _requestProvider.DeleteAsync <CartModel>(uri, token);
            }
            catch (HttpRequestExceptionEx exception) when(exception.HttpCode == System.Net.HttpStatusCode.NotFound)
            {
                cart = null;
            }
            return(Cart = cart);
        }
示例#17
0
        public async Task <bool> DeleteAsync(int id, string token)
        {
            var uri = UriHelper.CombineUri(_settingsService.EndPoint(), ApiUrlBase + $"?id={id}");

            try
            {
                await _requestProvider.DeleteAsync(uri, token);
            }
            //If the status of the notification we will get
            //a BadRequest HttpStatus
            catch (HttpRequestExceptionEx ex) when(ex.HttpCode == System.Net.HttpStatusCode.BadRequest)
            {
                return(false);
            }
            return(true);
        }
示例#18
0
        public Task <bool> DeleteContactInfoAsync(long teamMemberId, CancellationTokenSource cancellationTokenSource) =>
        Task <bool> .Run(async() => {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            bool completion = false;

            AuthorisedRequest deleteTeamMemberContactInfoRequest = new AuthorisedRequest {
                AccessToken = GlobalSettings.Instance.UserProfile.AccesToken,
                Url         = string.Format(GlobalSettings.Instance.Endpoints.TeamMemberEndPoints.DeleteContactInfoEndpoint, teamMemberId)
            };

            CommonResponse deleteTeamMemberContactInfoResponse = null;

            try {
                deleteTeamMemberContactInfoResponse = await _requestProvider.DeleteAsync <AuthorisedRequest, CommonResponse>(deleteTeamMemberContactInfoRequest);

                if (deleteTeamMemberContactInfoResponse != null)
                {
                    completion = true;
                }
                else
                {
                    completion = false;
                    throw new InvalidOperationException(CANT_DELETE_CONTACT_INFO_COMMON_WARNING);
                }
            }
            catch (ServiceAuthenticationException exc) {
                _identityUtilService.RefreshToken();

                throw exc;
            }
            catch (Exception ex) {
                Crashes.TrackError(ex);

                throw;
            }

            return(completion);
        }, cancellationTokenSource.Token);
示例#19
0
        public Task <bool> DeleteMediaFromTrayAsync(long mediaId, CancellationTokenSource cancellationTokenSource) =>
        Task.Run(async() => {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            bool completion = false;

            try {
                DeleteMediaRequest deleteMediaRequest = new DeleteMediaRequest {
                    AccessToken = GlobalSettings.Instance.UserProfile.AccesToken,
                    Url         = string.Format(GlobalSettings.Instance.Endpoints.ProfileMediaEndPoints.DeleteMedia, mediaId)
                };

                DeleteMediaResponse deleteMediaResponse = await _requestProvider.DeleteAsync <DeleteMediaRequest, DeleteMediaResponse>(deleteMediaRequest);

                if (deleteMediaResponse != null)
                {
                    completion = true;
                }
                else
                {
                    throw new InvalidOperationException(CANT_DELETE_MEDIA_COMMON_ERROR);
                }
            }
            catch (ServiceAuthenticationException exc) {
                _identityUtilService.RefreshToken();

                throw exc;
            }
            catch (Exception ex) {
                completion = false;

                Crashes.TrackError(ex);

                Debug.WriteLine($"ERROR:{ex.Message}");
                throw;
            }

            return(completion);
        }, cancellationTokenSource.Token);
示例#20
0
        public async Task DeleteCatalogAsync(CatalogItem catalogItem)
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}/items/delete/{catalogItem.Id}");

            await _requestProvider.DeleteAsync(uri);
        }
示例#21
0
 public async Task DeleteCommentAsync(int commentId)
 {
     await _requestProvider.DeleteAsync(_settingsService.CommentsEndpoint + "/" + commentId,
                                        _settingsService.AuthAccessToken);
 }
示例#22
0
 public async Task DeleteFirebaseToken(string userToken)
 {
     var uri = UriHelper.CombineUri(_settingsService.EndPoint(), ApiUrlBase);
     await _requestProvider.DeleteAsync(uri, userToken);
 }
示例#23
0
 public async Task Delete(string plantId)
 {
     AccessToken authToken = getAuthToken();
     string      uri       = Constants.PtBasedUrl + "user/plant/" + plantId;
     await _requestProvider.DeleteAsync(uri, authToken.Token);
 }
示例#24
0
 public Task <bool> DeleteAsync(Request request)
 {
     return(provider.DeleteAsync(request));
 }