Ejemplo n.º 1
0
		private static int AddChapter(XDocument xml, int book_id)
		{
			using(var db = new Entities())
			{
				chapter chapter = new chapter();
				chapter.book_id = book_id;
				chapter.number = Int32.Parse(xml.Descendants("chapter").First().Attribute("id").Value);
				db.chapter.Add(chapter);
				db.SaveChanges();
				return chapter.id;
			}
		}
Ejemplo n.º 2
0
		private void FillSectionTable(Entities db)
		{
			db.section.Add(new section() { id = OLD_TEST, name = "Vana Testament" });
			db.section.Add(new section() { id = NEW_TEST, name = "Uus Testament" });
			db.section.Add(new section() { id = APOCRYPHA, name = "Apokrüüfid" });
			db.SaveChanges();
		}
Ejemplo n.º 3
0
		private static void AddVerses(XDocument xml, int chapter_id)
		{
			using(var db = new Entities())
				{
				IEnumerable<XElement> verses = xml.Descendants("verse");
				foreach (XElement v in verses)
				{
					db.verse.Add(new verse()
					{
						chapter_id = chapter_id,
						number = Int32.Parse(v.Attribute("id").Value),
						heading = v.Attribute("heading").Value.Replace("<br />", "; ").Replace("„", "\"").Replace("”", "\""),
						content = StringTools.StripTagsCharArray(NormalizeWhiteSpace(v.Value.Replace("<br />", " ").Replace("„", "\"").Replace("”", "\"")))
					});
				}
				db.SaveChanges();
			}
		}
Ejemplo n.º 4
0
		private static int AddBook(int section_id, XDocument xml)
		{
			using(var db = new Entities())
			{
				book book = new book();
				book.name = xml.Descendants("book").First().Attribute("title").Value;
				book.name_short = xml.Descendants("book").First().Attribute("abbrev").Value;
				book.section_id = section_id;
				db.book.Add(book);
				db.SaveChanges();
				return book.id;
			}
		}