Ejemplo n.º 1
0
        private async void ProposeSubmissionExecute(object obj)
        {
            Submission submission = new Submission();
            var        newGuid    = Guid.NewGuid();
            string     id         = Convert.ToBase64String(newGuid.ToByteArray());

            submission.SubmissionID = id.Remove(id.Length - 2, 2);
            submission.Recycler     = RecyclerViewModel.Recycler.Username;
            submission.Collector    = SelectedCollector.Username;
            submission.Status       = SubmissionViewModel.StatusProposed;
            submission.Material     = Material.MaterialID;
            submission.ProposedDate = ProposedDate;
            await SubmissionDA.AddSubmission(submission);

            await Application.Current.MainPage.DisplayAlert("Submit Material to Recycle", "You have successfully made an appointment with " + submission.Collector + " on " + submission.ProposedDate.ToString("d"), "OK");

            await Application.Current.MainPage.Navigation.PopAsync();
        }
Ejemplo n.º 2
0
        private async void CreateSubmissionExecute(object obj)
        {
            CreateStatus = string.Empty;
            Recycler     = await RecyclerDA.GetRecyclerByUsername(RecyclerUsername);

            Material = await MaterialDA.GetMaterialByName(MaterialName);

            Collector = CollectorViewModel.Collector;
            if (Recycler == null)
            {
                CreateStatus = "Recycler not found!";
            }
            else
            {
                if (Material == null)
                {
                    CreateStatus = "Recycled Material Type not found!";
                }
                else
                {
                    if (Collector.MaterialCollection.Contains(Material.MaterialID))
                    {
                        Submission.Recycler     = Recycler.Username;
                        Submission.ProposedDate = DateTime.Today;
                        Submission.Collector    = Collector.Username;
                        var    newGuid = Guid.NewGuid();
                        string id      = Convert.ToBase64String(newGuid.ToByteArray());
                        Submission.SubmissionID = id.Remove(id.Length - 2, 2);
                        Submission.Status       = StatusProposed;
                        Submission.Material     = Material.MaterialID;
                        await SubmissionDA.AddSubmission(Submission);

                        UpdateSubmissionForAll();
                        await Application.Current.MainPage.DisplayAlert("Record Material Submission", "You have successfully recorded the submission.", "OK");

                        await Application.Current.MainPage.Navigation.PopAsync();
                    }
                    else
                    {
                        CreateStatus = "You do not collect this type of material!";
                    }
                }
            }
        }