private void doWords(string xmlContent) { XDocument doc = XDocument.Parse(xmlContent); var ents = from ent in doc.Descendants("wrd") select new Words { WordId = int.Parse(ent.Attribute("id").Value), NestId = int.Parse(ent.Element("wnid").Value), CommentsCount = int.Parse(ent.Element("wcms").Value), AddedBy = ent.Element("wnm").Value, AddedByEmail = ent.Element("wem").Value, AddedByUrl = ent.Element("wurl").Value, Description = ent.Element("wdsc").Value, Ethimology = ent.Element("wet").Value, Example = ent.Element("wex").Value, WordContent = ent.Element("wwrd").Value, AddedAtDate = DateTime.ParseExact(ent.Element("wdt").Value + " 00:00:00", AppSettings.DateTimeFormat, null), }; using (NeologDataContext db = new NeologDataContext(AppSettings.DBConnectionString)) { foreach (Words t in ents) { App.DbViewModel.AddWord(t); } } this.SynchronizationComplete(); }
private void doNests(string xmlContent) { XDocument doc = XDocument.Parse(xmlContent); var ents = from ent in doc.Descendants("nest") select new Nests { NestId = int.Parse(ent.Attribute("id").Value), OrderPos = int.Parse(ent.Attribute("ord").Value), Title = ent.Element("nn").Value, }; using (NeologDataContext db = new NeologDataContext(AppSettings.DBConnectionString)) { foreach (Nests t in ents) { App.DbViewModel.AddNest(t); } } this.SynchronizationComplete(); }
private void doTexts(string xmlContent) { XDocument doc = XDocument.Parse(xmlContent); var ents = from ent in doc.Descendants("cnabout") select new Texts { TextId = int.Parse(ent.Attribute("id").Value), Title = "...", // seriously?!?! Content = ent.Value }; using (NeologDataContext db = new NeologDataContext(AppSettings.DBConnectionString)) { foreach (Texts t in ents) { App.DbViewModel.AddText(t); } } this.syncNests(); }
private void doWordComments(string xmlContent) { XDocument doc = XDocument.Parse(xmlContent); var ents = from ent in doc.Descendants("wc") select new WordComments { WordCommentId = int.Parse(ent.Attribute("id").Value), WordId = int.Parse(ent.Attribute("wid").Value), Author = ent.Element("wcau").Value, Comment = ent.Element("wccomm").Value, CommentDate = DateTime.ParseExact(ent.Element("wcdt").Value + " 00:00:00", AppSettings.DateTimeFormat, null), }; using (NeologDataContext db = new NeologDataContext(AppSettings.DBConnectionString)) { foreach (WordComments t in ents) { App.DbViewModel.AddWordComment(t); } } this.SynchronizationComplete(); }
public NeologViewModel(string nlDBConnectionString) { nlDB = new NeologDataContext(nlDBConnectionString); }