private async Task <Response> Running() { Response result = new Response(); if (string.IsNullOrEmpty(ProjectLocation.Id)) { ProjectLocation.ProjectId = Project.Id; result = await ProjectLocationDataStore.AddItemAsync(ProjectLocation); //ProjectLocation = JsonConvert.DeserializeObject<ProjectLocation>(result.Data.ToString()); //return await Task.FromResult(true); } else { result = await ProjectLocationDataStore.AddItemAsync(ProjectLocation); //ProjectLocation = JsonConvert.DeserializeObject<ProjectLocation>(result.Data.ToString()); ////await ProjectLocationDataStore.AddItemAsync(ProjectLocation); //return await Task.FromResult(true); } return(await Task.FromResult(result)); }
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(() => ProjectLocationDataStore.DeleteItemAsync(ProjectLocation) ); if (response.Status == ApiResult.Success) { IsBusyProgress = false; await Shell.Current.Navigation.PopAsync(); } // Shell.Current.Navigation.RemovePage(new BuildingLocationDetail()); // await Shell.Current.Navigation.PopAsync(); // await Shell.Current.Navigation.PushAsync(new ProjectDetail() { BindingContext = new ProjectDetailViewModel() { Project = project } }); } }
private async Task <bool> Running() { ProjectLocation = await ProjectLocationDataStore.GetItemAsync(ProjectLocation.Id); // ProjectCommonLocationImagesItems = new ObservableCollection<ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id)); if (App.LogUser.RoleName == "Admin") { IsEditDeleteAccess = true; } else if (ProjectLocation.UserId == App.LogUser.Id.ToString()) { IsEditDeleteAccess = true; } if (App.IsInvasive) { IsInvasiveControlDisable = true; IsEditDeleteAccess = false; } VisualFormProjectLocationItems = new ObservableCollection <ProjectLocation_Visual>(await VisualFormProjectLocationDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id)); return(await Task.FromResult(true)); }
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)); }