예제 #1
0
        private async void SaveUserandLinktoErac(Erac erac, EracUser user)
        {
            await App.Database.SaveEracUserAsync(user);

            erac.EracUsers.Add(user);
            await App.Database.PopulateEracEracQues(erac);
        }
예제 #2
0
        public async Task <int> DeleteResultAsync(Erac erac)
        {
            var eracUsers = GetEracEracUserList(erac.ID).Result;

            foreach (var eracUser in eracUsers)
            {
                await _database.DeleteAsync(eracUser);
            }
            return(await _database.DeleteAsync(erac));
        }
예제 #3
0
 //Creates a new result in result table or update
 public Task <int> SaveEracAsync(Erac erac)
 {
     if (erac.ID != 0)
     {
         return(_database.UpdateAsync(erac));
     }
     else
     {
         return(_database.InsertAsync(erac));
     }
 }
예제 #4
0
        private async void OnAddClicked(object sender, EventArgs e)
        {
            if (Name.Text == null || NRIC.Text == null || Rank.Text == null)
            {
                await DisplayAlert("Missing Information", "Some Fields are not filled in", "Ok");

                return;
            }
            else
            {
                Erac     erac = (Erac)BindingContext;
                EracUser user = new EracUser();
                user.Name = Name.Text.ToUpper();
                user.Nric = NRIC.Text.ToUpper();
                user.Rank = Rank.Text.ToUpper();
                SaveUserandLinktoErac(erac, user);
                await Navigation.PopModalAsync();
            }
        }
예제 #5
0
        async void OnNewRACClicked(object sender, EventArgs e)
        {
            bool answer = await DisplayAlert("New RAC", "Create a new RAC?", "Yes", "No");

            string resultname = await DisplayPromptAsync("Activity", "", placeholder : "Name of Activity");

            if (answer == true && resultname != null)
            {
                Erac erac = new Erac();
                erac.Name        = resultname;
                erac.DateCreated = DateTime.Now;
                erac.EracUsers   = new List <EracUser>();
                await App.Database.SaveEracAsync(erac);

                await Navigation.PushAsync(new PartyFormPage
                {
                    BindingContext = erac as Erac
                });
            }
            else
            {
                return;
            }
        }
예제 #6
0
 public Task PopulateEracEracQues(Erac erac)
 {
     return(_database.UpdateWithChildrenAsync(erac));
 }