Ejemplo n.º 1
0
        private Location DeleteLocationNg(LocationInfo locationInfo)
        {
            if (!locationInfo.UniqueId.HasValue)
            {
                throw new ExpectedException($"No uniqueID found for location '{locationInfo.Identifier}'");
            }

            var location = Client.Provisioning.Get(new GetLocation {
                LocationUniqueId = locationInfo.UniqueId.Value
            });

            try
            {
                try
                {
                    _processor.Delete(new DeleteMigrationLocationByIdentifier {
                        LocationIdentifier = locationInfo.Identifier
                    });
                }
                catch (WebServiceException exception)
                {
                    if (exception.StatusCode != 400 && exception.StatusCode != 404)
                    {
                        throw;
                    }

                    Log.Warn($"Trying alternative API to delete '{locationInfo.Identifier}' ...");

                    var siteVisitLocation = GetSiteVisitLocation(locationInfo);

                    // Try the other API (not quite as robust)
                    _processor.Delete(new DeleteLocationByIdRequest {
                        LocationId = siteVisitLocation.Id
                    });
                }
            }
            catch (WebServiceException exception)
            {
                if (exception.ErrorCode == "InvalidOperationException")
                {
                    Log.Warn($"Location '{locationInfo.Identifier}' cannot be deleted. Reason: {exception.ErrorMessage}");

                    ++LockedLocationCount;

                    return(null);
                }

                throw;
            }

            return(location);
        }
 public virtual JsonResult Delete(int id)
 {
     try
     {
         var request = new DeleteRequest {
             Id = id
         };
         _repository.Delete <DeleteRequest, DeleteResponse>(request);
         return(Json(new { Result = "OK" }));
     }
     catch (InvalidOperationException ex)
     {
         return(Json(new
         {
             Result = "ERROR",
             Message = String.Format("{0}<br/>Details:{1}", ex.Message, ex.Data["DetailHtml"])
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             Result = "ERROR",
             Message = ex.Message
         }));
     }
 }
Ejemplo n.º 3
0
        private Location DeleteLocationNg(LocationInfo locationInfo)
        {
            if (!locationInfo.UniqueId.HasValue)
            {
                throw new ExpectedException($"No uniqueID found for location '{locationInfo.Identifier}'");
            }

            var location = Client.Provisioning.Get(new GetLocation {
                LocationUniqueId = locationInfo.UniqueId.Value
            });

            try
            {
                _processor.Delete(new DeleteMigrationLocationByIdentifier {
                    LocationIdentifier = locationInfo.Identifier
                });
            }
            catch (WebServiceException exception)
            {
                if (exception.ErrorCode == "InvalidOperationException")
                {
                    Log.Warn($"Location '{locationInfo.Identifier}' cannot be deleted. Reason: {exception.ErrorMessage}");

                    ++LockedLocationCount;

                    return(null);
                }

                throw;
            }

            return(location);
        }
Ejemplo n.º 4
0
        public IHttpActionResult Delete(int id)
        {
            Customer cust = sclient.GetById(id);

            sclient.Delete(cust);
            sclient.Commit();
            return(Ok("Index"));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Delete(Guid id)
        {
            try
            {
                if (await _serviceClient.Delete(id))
                {
                    return(NoContent());
                }

                return(BadRequest(new FailResponse($"Erro ao excluir.")));
            }
            catch (Exception e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new FailResponse(e.Message, e)));
            }
        }
Ejemplo n.º 6
0
        private Location DeleteLocationNg(LocationInfo locationInfo)
        {
            if (!locationInfo.UniqueId.HasValue)
            {
                throw new ExpectedException($"No uniqueID found for location '{locationInfo.Identifier}'");
            }

            var location = Client.Provisioning.Get(new GetLocation {
                LocationUniqueId = locationInfo.UniqueId.Value
            });

            _processor.Delete(new DeleteMigrationLocationByIdentifier {
                LocationIdentifier = locationInfo.Identifier
            });

            return(location);
        }
 public static void Logout(IServiceClient client)
 {
     client.Delete(new DeleteSession());
 }
Ejemplo n.º 8
0
 public TResponse Delete <TResponse>(IReturn <TResponse> requestDto)
 {
     return(InvokeWebServiceMethod(() => _client.Delete(requestDto)));
 }
Ejemplo n.º 9
0
 public HttpWebResponse Delete(IReturnVoid requestDto)
 {
     return(cachedClient.Delete(requestDto));
 }
Ejemplo n.º 10
0
 public T Delete <T>(T data) where T : class
 {
     return(client.Delete <T>(data));
 }
Ejemplo n.º 11
0
        public IResponse Delete(Uri uri)
        {
            Guard.ArgumentIsNotNull(uri, "uri");

            return(_serviceClient.Delete(uri));
        }