private PothiShabad GetPothiShabadFromVerseSearch(VerseSearch vs) { PothiShabad pothiShabad = new PothiShabad(); pothiShabad.ShabadId = vs.ShabadId.Value; pothiShabad.VerseId = vs.VerseID; pothiShabad.PothiId = _pothi.PothiId.Value; pothiShabad.SortOrder = vs.SortOrder; pothiShabad.Notes = vs.Notes; return(pothiShabad); }
internal async static Task <bool> SavePothFromPothiShabadExt(PothiShabadExt cur) { _con = DependencyService.Get <ISqliteDb>().GetSQLiteConnection(); Pothi pothi = new Pothi(); pothi.Name = cur.pothi.Name; pothi.CreatedOn = DateTime.Now; int cnt = await _con.InsertAsync(pothi); if (cnt > 0) { int pothiId = await Queries.GetLastId(); foreach (PothiShabad shabad in cur.shabadList) { PothiShabad pothiShabad = shabad; pothiShabad.PothiId = pothiId; await _con.InsertAsync(pothiShabad); } } return(true); }
private async void Save_Clicked(object sender, EventArgs e) { Pothi pothi = ddlPothi.SelectedItem as Pothi; SortOrder = await Queries.GetMaxSortId(pothi.PothiId.Value) ?? 0; int?pothiId = pothi.PothiId; if (pothiId.HasValue) { if (RequestType == RequestSource.Single) { Verse verse = pckLine.SelectedItem as Verse; PothiShabad pothiShabad = new PothiShabad(); pothiShabad.PothiId = pothiId.Value; pothiShabad.ShabadId = ShabadId; pothiShabad.VerseId = verse.ID; pothiShabad.SortOrder = SortOrder + 1; PothiShabad.Add(pothiShabad); } else { PothiShabad.ToList().ForEach(a => a.PothiId = pothiId.Value); int sortOrder = SortOrder.Value + 1; foreach (PothiShabad pothiShabads in PothiShabad) { pothiShabads.PothiId = pothiId.Value; pothiShabads.SortOrder = sortOrder; sortOrder += 1; } } SavePothiShabad(PothiShabad); await Navigation.PopPopupAsync(); } }