private async Task DeleteVisualFormCommandExecute(ProjectLocation_Visual obj)
        {
            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(() =>
                                              VisualFormProjectLocationDataStore.DeleteItemAsync(obj)
                                              );

                if (response.Status == ApiResult.Success)
                {
                    IsBusyProgress = false;
                    await LoadData();
                }

                // Shell.Current.Navigation.RemovePage(new BuildingLocationDetail());

                // await Shell.Current.Navigation.PushAsync(new ProjectDetail() { BindingContext = new ProjectDetailViewModel() { Project = project } });
            }
        }
Esempio n. 2
0
        public async Task <Response> AddItemAsync(ProjectLocation_Visual item, IEnumerable <string> ImageList = null)
        {
            Response result = new Response();

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Name", item.Name);
            parameters.Add("ProjectLocationId", item.ProjectLocationId);
            parameters.Add("AdditionalConsideration", item.AdditionalConsideration);

            parameters.Add("ExteriorElements", item.ExteriorElements);
            parameters.Add("WaterProofingElements", item.WaterProofingElements);
            parameters.Add("ConditionAssessment", item.ConditionAssessment);
            parameters.Add("VisualReview", item.VisualReview);

            parameters.Add("AnyVisualSign", item.AnyVisualSign);
            parameters.Add("FurtherInasive", item.FurtherInasive);
            parameters.Add("LifeExpectancyEEE", item.LifeExpectancyEEE);
            parameters.Add("LifeExpectancyLBC", item.LifeExpectancyLBC);

            parameters.Add("LifeExpectancyAWE", item.LifeExpectancyAWE);
            parameters.Add("UserID", App.LogUser.Id.ToString());
            parameters.Add("ImageDescription", item.ImageDescription);



            result = await HttpUtil.VisualDataAdd(item.Name, "api/VisualProjectLocation/Add", parameters, ImageList);


            return(await Task.FromResult(result));
        }
        private async Task GoToVisualForm(ProjectLocation_Visual parm)
        {
            VisualProjectLocationFormViewModel vm = new VisualProjectLocationFormViewModel();

            vm.ExteriorElements           = new ObservableCollection <string>(parm.ExteriorElements.Split(',').ToList());
            vm.WaterProofingElements      = new ObservableCollection <string>(parm.WaterProofingElements.Split(',').ToList());
            vm.CountExteriorElements      = vm.ExteriorElements.Count.ToString();
            vm.CountWaterProofingElements = vm.WaterProofingElements.Count.ToString();
            vm.RadioList_VisualReviewItems.Where(c => c.Name == parm.VisualReview).Single().IsChecked          = true;
            vm.RadioList_AnyVisualSignItems.Where(c => c.Name == parm.AnyVisualSign).Single().IsChecked        = true;
            vm.RadioList_FurtherInasiveItems.Where(c => c.Name == parm.FurtherInasive).Single().IsChecked      = true;
            vm.RadioList_ConditionAssessment.Where(c => c.Name == parm.ConditionAssessment).Single().IsChecked = true;
            vm.RadioList_LifeExpectancyEEE.Where(c => c.Name == parm.LifeExpectancyEEE).Single().IsChecked     = true;
            vm.RadioList_LifeExpectancyLBC.Where(c => c.Name == parm.LifeExpectancyLBC).Single().IsChecked     = true;
            vm.RadioList_LifeExpectancyAWE.Where(c => c.Name == parm.LifeExpectancyAWE).Single().IsChecked     = true;
            //  vm.ExteriorElements = new CheakBoxListReturntModel() {selectedList= parm.ExteriorElements.Split(',').ToList(),Count= parm.ExteriorElements.Split(',').ToList().Count };
            // vm.CountExteriorElements = vm.ExteriorElements.selectedList.Count.ToString();
            //foreach (var item in parm.ExteriorElements.Split(',').ToList())
            //{
            //    vm.ExteriorElements=new CheakBoxListReturntModel() {selectedList }
            //}
            //vm.CountExteriorElements = vm.ExteriorElements.selectedList.Count.ToString();
            App.VisualEditTracking            = new List <MultiImage>();
            App.VisualEditTrackingForInvasive = new List <MultiImage>();
            //  vm.VisualProjectLocationPhotoItems.Clear();
            VisualProjectLocationPhotoDataStore.Clear();
            InvasiveVisualProjectLocationPhotoDataStore.Clear();


            //vm.WaterProofingElements.selectedList = parm.ExteriorElements.Split(',').ToList();
            vm.VisualForm = parm;
            vm.VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(parm.Id, true));

            vm.ProjectLocation = ProjectLocation;
            if (App.IsInvasive == false)
            {
                if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(VisualProjectLocationForm))
                {
                    await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm()
                    {
                        BindingContext = vm
                    });
                }
            }
            else
            {
                vm.InvasiveVisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(parm.Id, true));

                if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(Views._8_VisualReportForm.TabbedPageInvasive))
                {
                    await Shell.Current.Navigation.PushAsync(new Views._8_VisualReportForm.TabbedPageInvasive(vm));
                }
                //await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm() { BindingContext = vm });
            }
            //await Shell.Current.Navigation.PushAsync(new EditProjectLocationImage()
            //{ BindingContext = new EditProjectLocationImageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } });
        }
        //public ObservableCollection<VisualFormProjectLocation> VisualFormProjectLocationItems { get; set; }
        private async Task NewViusalReportCommandExecue()
        {
            ProjectLocation_Visual visualForm = new ProjectLocation_Visual();

            visualForm = new ProjectLocation_Visual();
            //visualForm.Id = Guid.NewGuid().ToString();
            visualForm.ProjectLocationId = ProjectLocation.Id;
            // vm.VisualProjectLocationPhotoItems.Clear();

            VisualProjectLocationPhotoDataStore.Clear();

            App.VisualEditTracking            = new List <MultiImage>();
            App.VisualEditTrackingForInvasive = new List <MultiImage>();
            VisualProjectLocationPhotoDataStore.Clear();
            InvasiveVisualProjectLocationPhotoDataStore.Clear();
            //await VisualFormProjectLocationDataStore.AddItemAsync(vloc);
            //  VisualFormProjectLocationItems = new ObservableCollection<ProjectLocation_Visual>(await VisualFormProjectLocationDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id));

            if (App.IsInvasive == false)
            {
                await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm()
                {
                    BindingContext = new VisualProjectLocationFormViewModel()
                    {
                        ProjectLocation = ProjectLocation, VisualForm = visualForm
                    }
                });
            }
            else

            {
                //await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm() { BindingContext = new VisualProjectLocationFormViewModel() { ProjectLocation = ProjectLocation, VisualForm = visualForm } });
                if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(Views._8_VisualReportForm.TabbedPageInvasive))
                {
                    await Shell.Current.Navigation.PushAsync(new Views._8_VisualReportForm.TabbedPageInvasive(new VisualProjectLocationFormViewModel()
                    {
                        ProjectLocation = ProjectLocation, VisualForm = visualForm
                    }));
                }
                //await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm() { BindingContext = vm });
            }

            //{ BindingContext = new EditProjectLocationImageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } });
        }
Esempio n. 5
0
        public async Task <Response> DeleteItemAsync(ProjectLocation_Visual item)
        {
            item.IsDelete = true;
            item.UserId   = App.LogUser.Id.ToString();
            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(App.AzureBackendUrl);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                using (HttpResponseMessage response = await client.PostAsJsonAsync($"api/VisualProjectLocation/DeleteVisualProjectLocation", item))
                {
                    var responseBody = await response.Content.ReadAsStringAsync();

                    Response result = JsonConvert.DeserializeObject <Response>(responseBody);

                    response.EnsureSuccessStatusCode();

                    return(await Task.FromResult(result));
                }
            }
        }
Esempio n. 6
0
        public async Task <Response> UpdateItemAsync(ProjectLocation_Visual item, List <MultiImage> finelList)
        {
            Response result = new Response();

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Id", item.Id);
            parameters.Add("Name", item.Name);
            parameters.Add("ProjectLocationId", item.ProjectLocationId);
            parameters.Add("AdditionalConsideration", item.AdditionalConsideration);

            parameters.Add("ExteriorElements", item.ExteriorElements);
            parameters.Add("WaterProofingElements", item.WaterProofingElements);
            parameters.Add("ConditionAssessment", item.ConditionAssessment);
            parameters.Add("VisualReview", item.VisualReview);

            parameters.Add("AnyVisualSign", item.AnyVisualSign);
            parameters.Add("FurtherInasive", item.FurtherInasive);
            parameters.Add("LifeExpectancyEEE", item.LifeExpectancyEEE);
            parameters.Add("LifeExpectancyLBC", item.LifeExpectancyLBC);

            parameters.Add("LifeExpectancyAWE", item.LifeExpectancyAWE);
            parameters.Add("ImageDescription", item.ImageDescription);
            parameters.Add("UserID", App.LogUser.Id.ToString());


            if (App.IsInvasive == true)
            {
                parameters.Add("IsInvaiveImage", "TRUE");
                // parameters.Add("IsInvasive", "FALSE");
            }
            else
            {
                parameters.Add("IsInvaiveImage", null);
                //  parameters.Add("IsInvasive", "FALSE");
            }



            //  result = await HttpUtil.VisualDataAdd(item.Name, "api/VisualProjectLocation/Add", parameters, ImageList);

            HttpContent DictionaryItems = new FormUrlEncodedContent(parameters);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(App.AzureBackendUrl);

                using (var formData = new MultipartFormDataContent())
                {
                    //https://www.dotnetperls.com/split

                    int Index = 1000;
                    foreach (MultiImage img in finelList)
                    {
                        Index++;
                        if (img.IsServerData == false && img.Status != "FromServer")
                        {
                            string ServerFileName = "New_" + img.Id;

                            string[] array     = ServerFileName.Split('_');
                            string   operation = array[0];
                            string   searchId  = array[1];
                            formData.Add(new ByteArrayContent(File.ReadAllBytes(img.Image)), Index.ToString(), ServerFileName);
                        }
                        if (img.IsServerData == true && img.Status == "Update")
                        {
                            string ServerFileName = "Update_" + img.Id;
                            formData.Add(new ByteArrayContent(File.ReadAllBytes(img.Image)), Index.ToString(), ServerFileName);
                        }
                        if (img.IsServerData == true && img.Status == "Delete")
                        {
                            string ServerFileName     = "Delete_" + img.Id;
                            var    sevenThousandItems = new byte[7000];
                            formData.Add(new ByteArrayContent(sevenThousandItems), Index.ToString(), ServerFileName);
                        }
                        //if (img.IsServerData == true && img.Status == "Delete")
                        //{
                        //    string ServerFileName = "Delete" + img.Id + ".png";
                        //    formData.Add(new ByteArrayContent(File.ReadAllBytes(img.Image)), Index.ToString(), ServerFileName);
                    }
                    // var extension = Path.GetExtension(img);
                    formData.Add(DictionaryItems, "Model");


                    var response = client.PostAsync("api/VisualProjectLocation/Edit", formData).Result;

                    var responseBody = await response.Content.ReadAsStringAsync();

                    result = JsonConvert.DeserializeObject <Response>(responseBody);
                    return(await Task.FromResult(result));
                }
            }
        }