private async Task Delete(object obj) { var editorPage = obj as ImageEditorPageWithoutDetail; var result = await Shell.Current.DisplayAlert( "Alert", "Are you sure you want to remove?", "Yes", "No"); if (result) { if (imageData.FormType == "VP") { if (App.IsInvasive == false) { await VisualProjectLocationPhotoDataStore.DeleteItemAsync(VisualProjectLocationPhotoItems[i], imageData.IsEditVisual); } else { await InvasiveVisualProjectLocationPhotoDataStore.DeleteItemAsync(VisualProjectLocationPhotoItems[i], imageData.IsEditVisual); } if (App.IsInvasive == false) { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } else { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } i--; int Count = VisualProjectLocationPhotoItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { //i = 0; await Prv(obj); } else { await Next(obj); } //int Count = new ObservableCollection<VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); } else if (imageData.FormType == "VB") { if (App.IsInvasive == false) { await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(VisualBuildingLocationPhotoItems[i]); } else { await InvasiveVisualBuildingLocationPhotoDataStore.DeleteItemAsync(VisualBuildingLocationPhotoItems[i]); } if (App.IsInvasive == false) { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } else { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } i--; //int Count = new ObservableCollection<VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); int Count = VisualBuildingLocationPhotoItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } } else if (imageData.FormType == "VA") { if (App.IsInvasive == false) { await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(VisualApartmentLocationPhotoItems[i]); } else { await InvasiveVisualApartmentLocationPhotoDataStore.DeleteItemAsync(VisualApartmentLocationPhotoItems[i]); } if (App.IsInvasive == false) { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } else { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } i--; int Count = VisualApartmentLocationPhotoItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } //int Count = new ObservableCollection<VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); } if (imageData.FormType == "P") { await ProjectCommonLocationImagesDataStore.DeleteItemAsync(ProjectCommonLocationImagesItems[i]); ProjectCommonLocationImagesItems = new ObservableCollection <ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(imageData.ProjectCommonLocationImages.ProjectLocationId)); i--; int Count = ProjectCommonLocationImagesItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } //int Count = new ObservableCollection<ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(imageData.ProjectCommonLocationImages.ProjectLocationId)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); } else if (imageData.FormType == "B") { await BuildingCommonLocationImagesDataStore.DeleteItemAsync(BuildingCommonLocationImagesItems[i]); BuildingCommonLocationImagesItems = new ObservableCollection <BuildingCommonLocationImages>(await BuildingCommonLocationImagesDataStore.GetItemsAsyncByBuildingId(imageData.BuildingCommonLocationImages.BuildingLocationId)); i--; // int Count = new ObservableCollection<BuildingCommonLocationImages>(await BuildingCommonLocationImagesDataStore.GetItemsAsyncByBuildingId(imageData.BuildingCommonLocationImages.BuildingId)).Count; // if (Count != 0) // await Next(obj); // else // await App.Current.MainPage.Navigation.PopAsync(); int Count = BuildingCommonLocationImagesItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } } else if (imageData.FormType == "A") { await BuildingApartmentImagesDataStore.DeleteItemAsync(BuildingApartmentImagesItems[i]); BuildingApartmentImagesItems = new ObservableCollection <BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(imageData.BuildingApartmentImages.BuildingApartmentId)); i--; //int Count = new ObservableCollection<BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(imageData.BuildingApartmentImages.ApartmentID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); int Count = BuildingApartmentImagesItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } } } }
public async Task AddNewPhoto(ProjectCommonLocationImages obj) { await ProjectCommonLocationImagesDataStore.AddItemAsync(obj); ProjectCommonLocationImagesItems = new ObservableCollection <ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id)); // UnitPhotoCount = VisualApartmentLocationPhotoItems.Count.ToString(); }
public async Task Load() { if (imageData.FormType == "VP") { if (App.IsInvasive == false) { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } else { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } i = VisualProjectLocationPhotoItems.IndexOf(VisualProjectLocationPhotoItems.Where(c => c.Id == imageData.VisualProjectLocationPhoto.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = VisualProjectLocationPhotoItems[i].ImageUrl; } else if (imageData.FormType == "VB") { if (App.IsInvasive == false) { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } else { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } i = VisualBuildingLocationPhotoItems.IndexOf(VisualBuildingLocationPhotoItems.Where(c => c.Id == imageData.VisualBuildingLocationPhoto.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = VisualBuildingLocationPhotoItems[i].ImageUrl; } else if (imageData.FormType == "VA") { if (App.IsInvasive == false) { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } else { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } i = VisualApartmentLocationPhotoItems.IndexOf(VisualApartmentLocationPhotoItems.Where(c => c.Id == imageData.VisualApartmentLocationPhoto.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = VisualApartmentLocationPhotoItems[i].ImageUrl; } else if (imageData.FormType == "P") { ProjectCommonLocationImagesItems = new ObservableCollection <ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(imageData.ProjectCommonLocationImages.ProjectLocationId)); i = ProjectCommonLocationImagesItems.IndexOf(ProjectCommonLocationImagesItems.Where(c => c.Id == imageData.ProjectCommonLocationImages.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = ProjectCommonLocationImagesItems[i].ImageUrl; } else if (imageData.FormType == "B") { BuildingCommonLocationImagesItems = new ObservableCollection <BuildingCommonLocationImages>(await BuildingCommonLocationImagesDataStore.GetItemsAsyncByBuildingId(imageData.BuildingCommonLocationImages.BuildingLocationId)); i = BuildingCommonLocationImagesItems.IndexOf(BuildingCommonLocationImagesItems.Where(c => c.Id == imageData.BuildingCommonLocationImages.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = BuildingCommonLocationImagesItems[i].ImageUrl; } else if (imageData.FormType == "A") { BuildingApartmentImagesItems = new ObservableCollection <BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(imageData.BuildingApartmentImages.BuildingApartmentId)); i = BuildingApartmentImagesItems.IndexOf(BuildingApartmentImagesItems.Where(c => c.Id == imageData.BuildingApartmentImages.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = BuildingApartmentImagesItems[i].ImageUrl; } }
public async Task <bool> UploadGallary(List <string> images) { IsBusyProgress = true; bool result = HttpUtil.UploadFromGallary(ProjectLocation.Name, "/api/ProjectLocationImage/AddEdit?ParentId=" + ProjectLocation.Id + "&UserId=" + App.LogUser.Id.ToString(), images); if (result == true) { IsBusyProgress = false; } ProjectCommonLocationImagesItems = new ObservableCollection <ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id)); return(await Task.FromResult(true)); }