예제 #1
0
        private async Task Delete()
        {
            var result = await Shell.Current.DisplayAlert(
                "Alert",
                "Are you sure you want to remove?",
                "Yes", "No");

            if (result)
            {
                IsBusyProgress = true;
                var response = await Task.Run(() =>
                                              BuildingApartmentDataStore.DeleteItemAsync(BuildingApartment)
                                              );

                if (response.Status == ApiResult.Success)
                {
                    IsBusyProgress = false;
                    await Shell.Current.Navigation.PopAsync();
                }
                // await BuildingApartmentDataStore.DeleteItemAsync(BuildingApartment);
                // Shell.Current.Navigation.RemovePage(new BuildingLocationDetail());
                // await Shell.Current.Navigation.PopAsync();
                // await Shell.Current.Navigation.PushAsync(new ProjectDetail() { BindingContext = new ProjectDetailViewModel() { Project = project } });
            }
        }
예제 #2
0
        private async Task <bool> Running()
        {
            ProjectBuilding = await ProjectBuildingDataStore.GetItemAsync(ProjectBuilding.Id);

            if (App.LogUser.RoleName == "Admin")
            {
                IsEditDeleteAccess = true;
            }
            else if (ProjectBuilding.UserId == App.LogUser.Id.ToString())
            {
                IsEditDeleteAccess = true;
            }
            if (App.IsInvasive)
            {
                IsInvasiveControlDisable = true;
                IsEditDeleteAccess       = false;
            }
            BuildingLocations  = new ObservableCollection <BuildingLocation>(await BuildingLocationDataStore.GetItemsAsyncByBuildingId(ProjectBuilding.Id));
            BuildingApartments = new ObservableCollection <BuildingApartment>(await BuildingApartmentDataStore.GetItemsAsyncByBuildingId(ProjectBuilding.Id));
            //var items = await BuildingApartmentDataStore.GetItemsAsyncByBuildingId(ProjectBuilding.Id);
            //if(items.Count()!=0)
            //{
            //    BuildingApartments = new ObservableCollection<BuildingApartment>(items);
            //}
            return(await Task.FromResult(true));
        }
예제 #3
0
        private async Task <Response> Running()
        {
            Response result;

            if (string.IsNullOrEmpty(BuildingApartment.Id))
            {
                BuildingApartment.BuildingId = ProjectBuilding.Id;
                result = await BuildingApartmentDataStore.AddItemAsync(BuildingApartment);
            }
            else
            {
                result = await BuildingApartmentDataStore.AddItemAsync(BuildingApartment);
            }
            return(await Task.FromResult(result));
        }
예제 #4
0
        private async Task <bool> Running()
        {
            BuildingApartment = await BuildingApartmentDataStore.GetItemAsync(BuildingApartment.Id);

            //   BuildingApartmentImages = new ObservableCollection<BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(BuildingApartment.Id));
            VisualFormApartmentLocationItems = new ObservableCollection <Apartment_Visual>(await VisualFormApartmentDataStore.GetItemsAsyncByApartmentId(BuildingApartment.Id));
            if (App.LogUser.RoleName == "Admin")
            {
                IsEditDeleteAccess = true;
            }
            else if (BuildingApartment.UserId == App.LogUser.Id.ToString())
            {
                IsEditDeleteAccess = true;
            }
            if (App.IsInvasive)
            {
                IsInvasiveControlDisable = true;
                IsEditDeleteAccess       = false;
            }
            return(await Task.FromResult(true));
        }