public async void AddUpdateSolution(Solution solution)
        {
            LoggingService.LogInformation("writing to db 'Solution'", "AppDatabase.AddUpdateSolution");
            var found = RetrieveSolution(solution.AggregateId);

            if (found != null && found.Count() > 0)
            {
                this.SqliteDb.Update(solution);
                //await mstSolution.UpdateAsync(solution);
            }
            else
            {
                var newId = this.SqliteDb.Insert(solution);
                //await mstSolution.InsertAsync(solution);

            }

            Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("updating ...") { Identifier = "DB", SourceId = "Solution" });

            Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("") { Identifier = "AGGREGATE", AggregateId = solution.AggregateId, Action = "UPDATED" });

        }
Exemple #2
0
        public async void PushToCloud(Solution solution)
        {
            if (!AppService.IsConnected()) return;

            try{
                if (solution.MSId != 0)
                {
                    int id = solution.Id;
                    solution.Id = solution.MSId;
                    solution.MSId = id;
                    await mstSolution.UpdateAsync(solution);
                    solution.Id = id;
                }
                else
                {
                    solution.Id = 0;
                    await mstSolution.InsertAsync(solution);
                    AppDatabase.Current.UpdateSolutionField(solution.AggregateId, "MSId", solution.Id, false);
                }

                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" });
            }
            catch {
                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" });
            }
        }