Beispiel #1
0
        public async void PushToCloud(Project project)
        {
            if (!AppService.IsConnected()) return;

            try
            {
                if (project.MSId != 0)
                {
                    int id = project.Id;
                    project.Id = project.MSId;
                    project.MSId = id;
                    await mstProject.UpdateAsync(project);
                    project.Id = id;
                }
                else
                {
                    project.Id = 0;
                    await mstProject.InsertAsync(project);
                    AppDatabase.Current.UpdateProjectField(project.AggregateId, "MSId", project.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" });
            }
        }
Beispiel #2
0
        public void AddUpdateProject(Project project)
        {
            LoggingService.LogInformation("writing to db 'Project'", "AppDatabase.AddUpdateProject");
            var found = RetrieveProject(project.AggregateId);

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

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

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

        }