From cd0e6256c611220df02a010aeda158c4b974de38 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 22 Oct 2016 18:42:27 +0200 Subject: [PATCH 1/9] send all type of files to Yavsc --- BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml index 1e31870f..ea30fc44 100644 --- a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml +++ b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml @@ -21,7 +21,7 @@ - + From a963cf211e70894202102bdb5fcf947b7e4f3393 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 22 Oct 2016 18:43:08 +0200 Subject: [PATCH 2/9] Fixes the miss-fit concerning app name --- BookAStar/BookAStar.Droid/Services/YavscChooserTargetService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BookAStar/BookAStar.Droid/Services/YavscChooserTargetService.cs b/BookAStar/BookAStar.Droid/Services/YavscChooserTargetService.cs index 36c14393..85fe7e1c 100644 --- a/BookAStar/BookAStar.Droid/Services/YavscChooserTargetService.cs +++ b/BookAStar/BookAStar.Droid/Services/YavscChooserTargetService.cs @@ -32,7 +32,7 @@ namespace BookAStar.Droid Resource.Drawable.icon); ChooserTarget t = new ChooserTarget( new Java.Lang.String( - "BookingStar"), i, + Constants.ApplicationName), i, .5f, new ComponentName(this, "BookAStar.SendFilesActivity"), null); var res = new List(); From 3016e8257e5bb2ae320092833ed08a61c24b8a5b Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 22 Oct 2016 18:43:21 +0200 Subject: [PATCH 3/9] fixes a null ref --- BookAStar/BookAStar/Behaviors/MaxLengthValidator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BookAStar/BookAStar/Behaviors/MaxLengthValidator.cs b/BookAStar/BookAStar/Behaviors/MaxLengthValidator.cs index 07f51476..5c460345 100644 --- a/BookAStar/BookAStar/Behaviors/MaxLengthValidator.cs +++ b/BookAStar/BookAStar/Behaviors/MaxLengthValidator.cs @@ -26,8 +26,8 @@ namespace BookAStar.Behaviors private void bindable_TextChanged(object sender, TextChangedEventArgs e) { - IsValid = e.NewTextValue.Length <= 0 || e.NewTextValue.Length <= MaxLength; - if (!IsValid && e.NewTextValue.Length > MaxLength) + IsValid = e.NewTextValue == null? false : ( e.NewTextValue.Length > 0 && e.NewTextValue.Length <= MaxLength ) ; + if (!IsValid) if (e.NewTextValue!=null) if (e.NewTextValue.Length > MaxLength) ((Editor)sender).Text = e.NewTextValue.Substring(0, MaxLength); } From 88eff8a574400448f5a803e2b3d639b03024d2d3 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 22 Oct 2016 18:45:22 +0200 Subject: [PATCH 4/9] =?UTF-8?q?Populate=20item=20=C3=A0=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BookAStar/BookAStar/Data/RemoteEntity.cs | 38 ++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/BookAStar/BookAStar/Data/RemoteEntity.cs b/BookAStar/BookAStar/Data/RemoteEntity.cs index f07844cb..3a8119ed 100644 --- a/BookAStar/BookAStar/Data/RemoteEntity.cs +++ b/BookAStar/BookAStar/Data/RemoteEntity.cs @@ -9,6 +9,7 @@ using System.Net; namespace BookAStar.Data { using Helpers; + using System.Diagnostics; using System.Text; public class RemoteEntity : LocalEntity, ICommand where K : IEquatable @@ -79,7 +80,7 @@ namespace BookAStar.Data private void AfterExecuting() { IsExecuting = false; - if (CanExecuteChanged!=null) + if (CanExecuteChanged != null) CanExecuteChanged.Invoke(this, new EventArgs()); } @@ -134,19 +135,24 @@ namespace BookAStar.Data { if (!response.IsSuccessStatusCode) { - var errcontent = await response.Content.ReadAsStringAsync(); // TODO throw custom exception, and catch to inform user - throw new Exception($"Create failed posting {stringContent} @ {controllerUri.AbsoluteUri}"); + var errcontent = await response.Content.ReadAsStringAsync(); + Debug.WriteLine($"Create failed posting {stringContent} @ {controllerUri.AbsoluteUri}"); + } + else + { + var recontent = await response.Content.ReadAsStringAsync(); + JsonSerializerSettings sett = new JsonSerializerSettings(); + JsonConvert.PopulateObject(recontent, item); } - var recontent = await response.Content.ReadAsStringAsync(); - JsonConvert.PopulateObject(recontent, item); } + } CurrentItem = item; AfterExecuting(); } - public async void Update (V item) + public async void Update(V item) { BeforeExecute(); @@ -154,13 +160,27 @@ namespace BookAStar.Data using (HttpClient client = UserHelpers.CreateClient()) { HttpContent content = new StringContent( - JsonConvert.SerializeObject(item) + JsonConvert.SerializeObject(item), Encoding.UTF8, "application/json" ); using (var response = await client.PutAsync(uri, content)) { if (!response.IsSuccessStatusCode) - // TODO throw custom exception, and catch to inform user - throw new Exception($"Update failed puting {item} @ {uri.AbsolutePath}"); + {// TODO throw custom exception, and catch to inform user + if (response.StatusCode == HttpStatusCode.BadRequest) + { + var recontent = await response.Content.ReadAsStringAsync(); + } + + else Debug.WriteLine($"Update failed ({item} @ {uri.AbsolutePath} )"); + + } + else + { + // TODO implement an handler of string content (json) + // in most of cases, nothing to do + var recontent = await response.Content.ReadAsStringAsync(); + JsonConvert.PopulateObject(recontent, item); + } } } From e930a0d1884146157d52c7263551ffd2d4d831eb Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 22 Oct 2016 18:45:59 +0200 Subject: [PATCH 5/9] these lines have an id @server side --- BookAStar/BookAStar/Model/Workflow/BillingLine.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/BookAStar/BookAStar/Model/Workflow/BillingLine.cs b/BookAStar/BookAStar/Model/Workflow/BillingLine.cs index ee47feed..21335a65 100644 --- a/BookAStar/BookAStar/Model/Workflow/BillingLine.cs +++ b/BookAStar/BookAStar/Model/Workflow/BillingLine.cs @@ -6,6 +6,7 @@ namespace BookAStar.Model.Workflow { public class BillingLine : IBillingLine { + public long Id { get; set; } public string Description { get; set; } public TimeSpan Duration { get; set; } public int Count { get; set; } = 1; From 16dac3f1fd7940d016d736e36b81d6580d0ac452 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 22 Oct 2016 18:49:22 +0200 Subject: [PATCH 6/9] DIB --- BookAStar/BookAStar/Pages/BookQueryPage.xaml | 5 +- .../BookAStar/Pages/BookQueryPage.xaml.cs | 39 ++++++++----- .../BookAStar/Pages/EditBillingLinePage.xaml | 6 +- .../Pages/EditBillingLinePage.xaml.cs | 6 ++ .../BookAStar/Pages/EditEstimatePage.xaml | 2 +- .../BookAStar/Pages/EditEstimatePage.xaml.cs | 36 +++++++++--- .../ViewModels/BillingLineViewModel.cs | 55 +++++++++++-------- 7 files changed, 100 insertions(+), 49 deletions(-) diff --git a/BookAStar/BookAStar/Pages/BookQueryPage.xaml b/BookAStar/BookAStar/Pages/BookQueryPage.xaml index d8c19a23..11b3d615 100644 --- a/BookAStar/BookAStar/Pages/BookQueryPage.xaml +++ b/BookAStar/BookAStar/Pages/BookQueryPage.xaml @@ -26,9 +26,8 @@