private async void OpenCollectorMaterialExecute(Material material)
        {
            Collector collector = CollectorVM.Collector;

            if (collector.MaterialCollection == null)
            {
                collector.MaterialCollection = new List <string>();
            }
            collector.MaterialCollection.Add(material.MaterialID);
            await CollectorAuth.UpdateCollector(collector);


            if (material.CollectorList == null)
            {
                material.CollectorList = new List <string>();
            }
            material.CollectorList.Add(collector.Username);
            await MaterialAuth.UpdateMaterial(material);

            CollectorMaterialList.Remove(material);

            await Application.Current.MainPage.DisplayAlert("Materials", "Material " + material.MaterialName + " is successfully added into collection.", "OK");

            //await Application.Current.MainPage.Navigation.PopAsync();
        }
Пример #2
0
        //method to update submission of material
        private async void OpenUpdateSubmissionExecute(object obj)
        {
            UpdateStatus = string.Empty;
            Material material = new Material();

            if (MaterialName.ToLower() == Material.MaterialName.ToLower())
            {
                material = await MaterialAuth.GetMaterialByName(MaterialName);
            }
            if (material != null)
            {
                if (CollectorVM.Collector.MaterialCollection.Contains(material.MaterialID))
                {
                    Material = material;
                    UpdateAllSub();
                    await Application.Current.MainPage.DisplayAlert("Record Submitted Material", "Submission Approved!.", "OK");

                    await Application.Current.MainPage.Navigation.PopAsync();
                }
                else
                {
                    UpdateStatus = "This material does not belong in your collection";
                }
            }
            else
            {
                UpdateStatus = "Material for recycling not found!";
            }
        }
Пример #3
0
        private async void UploadMaterialExecute(object obj)
        {
            Material.MaterialID    = Guid.NewGuid().ToString();
            Material.CollectorList = new List <string>();
            await MaterialAuth.AddMaterial(Material);

            await Application.Current.MainPage.Navigation.PopAsync();
        }
Пример #4
0
        private async void InitializeFromSubmission()
        {
            Recycler = await RecyclerAuth.GetRecyclerByUsername(Submission.Recycler);

            if (Recycler != null)
            {
                RecyclerUsername = Recycler.Username;
            }
            Collector = await CollectorAuth.GetCollectorByUsername(Submission.Collector);

            Material = await MaterialAuth.GetMaterialById(Submission.Material);

            if (Material != null)
            {
                MaterialName = Material.MaterialName;
            }
        }
Пример #5
0
        private async void DeleteMaterialExecute(object obj)
        {
            await MaterialAuth.DeleteMaterial(Material);

            await Application.Current.MainPage.Navigation.PopAsync();
        }
 protected async override void OnAppearing()
 {
     base.OnAppearing();
     materialListView.ItemsSource = await MaterialAuth.GetAllMaterials();
 }
 private async void GetAllMaterials()
 {
     CollectorMaterialList = await MaterialAuth.GetMaterialsById(CollectorVM.Collector.MaterialCollection);
 }
 private async void GetAllMaterials()
 {
     MaterialList = await MaterialAuth.GetAllMaterials();
 }