Exemplo n.º 1
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));
        }
Exemplo n.º 2
0
        private async Task <Response> Running()
        {
            Response result = new Response();

            if (string.IsNullOrEmpty(ProjectBuilding.Id))
            {
                ProjectBuilding.ProjectId = Project.Id;
                result = await ProjectBuildingDataStore.AddItemAsync(ProjectBuilding);


                //ProjectLocation = JsonConvert.DeserializeObject<ProjectLocation>(result.Data.ToString());

                //return await Task.FromResult(true);
            }
            else
            {
                result = await ProjectBuildingDataStore.AddItemAsync(ProjectBuilding);

                //ProjectLocation = JsonConvert.DeserializeObject<ProjectLocation>(result.Data.ToString());

                ////await ProjectLocationDataStore.AddItemAsync(ProjectLocation);
                //return await Task.FromResult(true);
            }
            return(await Task.FromResult(result));
        }
Exemplo n.º 3
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(() =>
                                              ProjectBuildingDataStore.DeleteItemAsync(ProjectBuilding)
                                              );

                if (response.Status == ApiResult.Success)
                {
                    IsBusyProgress = false;
                    await Shell.Current.Navigation.PopAsync();
                }

                //     await ProjectBuildingDataStore.DeleteItemAsync(ProjectBuilding.Id);
                // Shell.Current.Navigation.RemovePage(new BuildingLocationDetail());
                //    await Shell.Current.Navigation.PopAsync();
                // await Shell.Current.Navigation.PushAsync(new ProjectDetail() { BindingContext = new ProjectDetailViewModel() { Project = project } });
            }
        }
Exemplo n.º 4
0
        async Task <bool> Running()
        {
            if (App.IsInvasive)
            {
                IsInvasiveControlDisable = true;
            }
            Project = await ProjectDataStore.GetItemAsync(Project.Id);

            //if(Project.IsInvasive==true)
            //{
            //    IsCreateOrRefreshInvasive = true;
            //}
            //else
            //{
            //    IsCreateOrRefreshInvasive = false;
            //}
            if (App.LogUser.RoleName == "Admin")
            {
                if (Project.ProjectType != "Invasive")
                {
                    if (Project.IsInvaisveExist == true)
                    {
                        CanInvasiveCreate = true;
                        BtnInvasiveText   = "Invasive";
                    }
                }
                else
                {
                    if (Project.IsAccess == true)
                    {
                        CanInvasiveCreate = true;
                        BtnInvasiveText   = "Refresh";
                    }
                    else
                    {
                        CanInvasiveCreate = false;
                    }
                }
                //if(Project.ProjectType== "Invasive")
                //{
                //    CanInvasiveCreate = true;
                //}
                //else if(Project.IsInvaisveExist==true)
                //{
                //    CanInvasiveCreate = true;
                //}
                //else
                //{
                //    CanInvasiveCreate = false;
                //}
                //else
                //{
                //    if (Project.IsInvaisveExist == true)
                //    {
                //        CanInvasiveCreate = false;
                //    }
                //    else
                //    {
                //        CanInvasiveCreate = true;
                //    }
                //}
                IsEditDeleteAccess = true;
            }
            else if (Project.UserId == App.LogUser.Id.ToString())
            {
                if (Project.ProjectType != "Invasive")
                {
                    if (Project.IsInvaisveExist == true)
                    {
                        CanInvasiveCreate = true;
                        BtnInvasiveText   = "Invasive";
                    }
                }
                else
                {
                    if (Project.IsAccess == true)
                    {
                        CanInvasiveCreate = true;
                        BtnInvasiveText   = "Refresh";
                    }
                    else
                    {
                        CanInvasiveCreate = false;
                    }
                }
                //if (Project.ProjectType == "Invasive" )
                //{
                //    CanInvasiveCreate = true;
                //}
                //else if (Project.IsInvaisveExist == true)
                //{
                //    CanInvasiveCreate = true;
                //}
                //else
                //{
                //    if (Project.IsInvaisveExist == false)
                //    {
                //        CanInvasiveCreate = true;
                //    }
                //    else
                //    {
                //        CanInvasiveCreate = false;
                //    }
                //}
                IsEditDeleteAccess = true;
            }
            else
            {
                if (Project.ProjectType != "Invasive" && Project.IsAccess)
                {
                    if (Project.IsInvaisveExist == true)
                    {
                        CanInvasiveCreate = true;
                        BtnInvasiveText   = "Invasive";
                    }
                }
                if (Project.ProjectType == "Invasive" && Project.IsAccess)
                {
                    CanInvasiveCreate = true;
                    BtnInvasiveText   = "Refresh";
                }
            }


            ProjectLocationItems = new ObservableCollection <ProjectLocation>(await ProjectLocationDataStore.GetItemsAsyncByProjectID(Project.Id));
            ProjectBuildingItems = new ObservableCollection <ProjectBuilding>(await ProjectBuildingDataStore.GetItemsAsyncByProjectID(Project.Id));

            return(await Task.FromResult(true));
        }