async void CreateLPRecord(LPRecord lp) { Models.LPDBRecord exists = await App.Database.GetLPByID(lp.id); if (exists == null) { CredentialsService credentials = new CredentialsService(); Models.LPDBRecord lprecord = new Models.LPDBRecord(); lprecord.LPID = lp.id; lprecord.LPTitle = lp.title; lprecord.LPDescription = lp.description; lprecord.LPMap = ""; await App.Database.SaveLPAsync(lprecord); } //else //{ // if (String.IsNullOrEmpty(exists.LPMap)) // { // CredentialsService credentials = new CredentialsService(); // TCMobile.Map map = await Courses.GetLearningPath(credentials.HomeDomain, credentials.UserID, lp.id); // if (map != null) // { // string tempMap = JsonConvert.SerializeObject(map); // exists.LPMap = tempMap; // // await App.Database.SaveLPAsync(exists); // } // } //} Cards card = new Cards(); card.buildLPCard(lp.id, lp.title, lp.description, LP, DetailsClicked); }
async void loadCourses(string lpid) { openPopup(); LP.Children.Clear(); CredentialsService credentials = new CredentialsService(); var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { lp = await Courses.GetLearningPath(credentials.HomeDomain, credentials.UserID, lpid); if (lp != null) { bool x = await buildLPDetails(lp.StudentActivityMap, lpid); } } else { Courses l = new Courses(); Models.LPDBRecord lp = await l.GetActivityMap(lpid); if (lp != null && lp.LPMap != null && lp.LPMap != "") { JsonSerializerSettings ser = new JsonSerializerSettings(); ser.DefaultValueHandling = DefaultValueHandling.Populate; StudentActivityMap lpMap = JsonConvert.DeserializeObject <StudentActivityMap>(lp.LPMap, ser); bool x = await buildLPDetails(lpMap, lpid); } } closePopup(); }