private async void SendDeleteByPathRequest()
        {
            try
            {
                using (var session = this.instanceSettings.GetSession())
                {
                    var request = ItemWebApiRequestBuilder.DeleteItemRequestWithPath(this.itemPathField.Text)
                                  .Build();

                    this.ShowLoader();

                    ScDeleteItemsResponse response = await session.DeleteItemAsync(request);

                    this.ProceedResponce(response);
                }
            }
            catch (Exception e)
            {
                AlertHelper.ShowLocalizedAlertWithOkOption("Error", e.Message);
            }
            finally
            {
                BeginInvokeOnMainThread(delegate
                {
                    this.HideLoader();
                });
            }
        }
        private async void SendDeleteByIdRequest()
        {
            try
            {
                using (var session = this.instanceSettings.GetSession())
                {
                    var request = ItemSSCRequestBuilder.DeleteItemRequestWithId(this.itemIdField.Text)
                                  .Database("master")
                                  .Build();
                    this.ShowLoader();
                    ScDeleteItemsResponse response = await session.DeleteItemAsync(request);

                    if (response.Deleted)
                    {
                        AlertHelper.ShowLocalizedAlertWithOkOption("Message", "The item deleted successfully");
                    }
                }
            }
            catch (Exception e)
            {
                AlertHelper.ShowLocalizedAlertWithOkOption("Error", e.Message);
            }
            finally
            {
                BeginInvokeOnMainThread(delegate
                {
                    this.HideLoader();
                });
            }
        }
예제 #3
0
        public void TestEmptyItemsResponseData()
        {
            var responseString             = "{\"statusCode\":200,\"result\":{\"count\":0,\"itemIds\":[]}}";
            ScDeleteItemsResponse response = DeleteItemsResponseParser.ParseResponse(responseString, CancellationToken.None);

            Assert.AreEqual(0, response.Count);
        }
        public void TestEmptyItemsResponseData()
        {
            var responseString             = "444";
            ScDeleteItemsResponse response = DeleteItemsResponseParser.ParseResponse(responseString, CancellationToken.None);

            Assert.IsFalse(response.Deleted);
        }
        public void TestParseSingleItemCorrectData()
        {
            var responseString             = "204";
            ScDeleteItemsResponse response = DeleteItemsResponseParser.ParseResponse(responseString, CancellationToken.None);

            Assert.AreEqual(204, response.StatusCode);
        }
예제 #6
0
        public void TestParseSingleItemCorrectData()
        {
            var responseString = "{\"statusCode\":200,\"result\":{\"count\":1,\"itemIds\":" +
                                 "[\"{40C28707-DCB1-4614-842A-8BE17880921E}\"]}}";
            ScDeleteItemsResponse response = DeleteItemsResponseParser.ParseResponse(responseString, CancellationToken.None);

            Assert.AreEqual(1, response.Count);
        }
 private void ProceedResponce(ScDeleteItemsResponse response)
 {
     if (response.Count > 0)
     {
         AlertHelper.ShowLocalizedAlertWithOkOption("Message", "The item deleted successfully");
     }
     else
     {
         AlertHelper.ShowLocalizedAlertWithOkOption("Message", "Item is not exist");
     }
 }
 private void ShowResult(ScDeleteItemsResponse response)
 {
     if (response.Count == 0)
     {
         DialogHelper.ShowSimpleDialog(this, "Failed", "No items deleted");
     }
     else
     {
         DialogHelper.ShowSimpleDialog(this, "Item deleted", "Item successsfully deleted");
     }
 }
예제 #9
0
        public void TestParseMultiItemCorrectData()
        {
            var responseString = "{\"statusCode\":200,\"result\":{\"count\":5,\"itemIds\":[\"" +
                                 "{B0ED4777-1F5D-478D-AF47-145CCA9E4311}\"," +
                                 "\"{FDB51F93-47ED-4186-AED8-FCAB82DA5BE7}\"," +
                                 "\"{F27C2E36-7907-41F3-ADB3-0118220E4DF8}\"," +
                                 "\"{9691126E-6BB9-47C5-9AA9-6EEAC9D4E70B}\"," +
                                 "\"{97154E04-622E-4561-A20C-B6463AEB2AEE}\"]}}";
            ScDeleteItemsResponse response = DeleteItemsResponseParser.ParseResponse(responseString, CancellationToken.None);

            Assert.AreEqual(5, response.Count);
            Assert.AreEqual("{B0ED4777-1F5D-478D-AF47-145CCA9E4311}", response[0]);
            Assert.AreEqual("{FDB51F93-47ED-4186-AED8-FCAB82DA5BE7}", response[1]);
            Assert.AreEqual("{F27C2E36-7907-41F3-ADB3-0118220E4DF8}", response[2]);
            Assert.AreEqual("{9691126E-6BB9-47C5-9AA9-6EEAC9D4E70B}", response[3]);
            Assert.AreEqual("{97154E04-622E-4561-A20C-B6463AEB2AEE}", response[4]);
        }
 private void ProceedResponce(ScDeleteItemsResponse response)
 {
   if (response.Count > 0)
   {
     AlertHelper.ShowLocalizedAlertWithOkOption("Message", "The item deleted successfully");
   }
   else
   {
     AlertHelper.ShowLocalizedAlertWithOkOption("Message", "Item is not exist");
   }
 }
 private void ShowResult(ScDeleteItemsResponse response)
 {
   if (response.Count == 0)
   {
     DialogHelper.ShowSimpleDialog(this, "Failed", "No items deleted");
   }
   else
   {
     DialogHelper.ShowSimpleDialog(this, "Item deleted", "Item successsfully deleted");
   }
 }