Ejemplo n.º 1
0
        public async Task <bool> CheckIfExists(SelectedGoal SelectedGoal)
        {
            var exists = database.Table <SelectedGoal>()
                         .Any(x => x.Id == SelectedGoal.Id);

            return(exists);
        }
Ejemplo n.º 2
0
        public async Task <int> InsertSelectedGoal(SelectedGoal selectedGoal)
        {
            var num = database.Insert(selectedGoal);

            database.Commit();
            return(num);
        }
Ejemplo n.º 3
0
        public async void insertSelectedGoal(SelectedGoal selectedGoal)
        {
            //Debug.WriteLine("###############  insert goal: "+selectedGoal.toString());

            await selectedGoalDatabase.InsertSelectedGoal(selectedGoal);

            //Debug.WriteLine("###############  after insert goal");

            //Close(this);
        }
Ejemplo n.º 4
0
 public void Init(int selectedGoalId)
 {
     try
     {
         selectedGoal = selectedGoalDatabase.GetSelectedGoal(selectedGoalId).Result;
         Goal thisGoal = goalDatabase.GetGoal(selectedGoal.GoalId).Result;
         selectedGoal.setGoal(thisGoal);//to update information of Goal object
     }
     catch (Exception e)
     {
         //possibly NullReferenceException
         Debug.WriteLine("exception: " + e.Message);
     }
 }
Ejemplo n.º 5
0
        public async void insertSampleSelectedGoalsToDbForTesting()
        {
            clearSelectedGoalDb();
            Debug.WriteLine("###############  insert sample diary");

            Goal goal = goalDatabase.GetTheFirstGoal(); //this works

            if (goal == null)
            {
                //in case of empty goalDb
                goal = new Goal(0, "Sample Title", "Desc", "Cat");
            }
            SelectedGoal newSGoal = new SelectedGoal(goal);

            SelectedGoals.Add(newSGoal);

            foreach (var selectedGoal in SelectedGoals)
            {
                await selectedGoalDatabase.InsertSelectedGoal(selectedGoal);
            }
            Close(this);
        }
Ejemplo n.º 6
0
 public bool UpdateSelectedGoal(SelectedGoal selectedGoal)
 {
     database.UpdateWithChildren(selectedGoal);
     return(true);
 }