Exemple #1
0
 public static List <M_Cipai> GetAllCipai()
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         return(context.M_Cipai.ToList());
     }
 }
Exemple #2
0
 public static List <M_Author> GetAllAuthor()
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         return(context.M_Author.ToList());
     }
 }
Exemple #3
0
 public static void AddPoems(List <M_Poem> entities)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_Poem.InsertAllOnSubmit(entities);
         context.SubmitChanges();
     }
 }
Exemple #4
0
 public static void AddPoem2(M_Poem2 poem)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_Poem2.InsertOnSubmit(poem);
         context.SubmitChanges();
     }
 }
Exemple #5
0
 public static void AddBookIndex(IEnumerable <M_BookIndex> entities)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_BookIndex.InsertAllOnSubmit(entities);
         context.SubmitChanges();
     }
 }
Exemple #6
0
 public static long GetMaxId()
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         var maxId = (from x in context.M_Poem2
                      select x.ID).Max();
         return(maxId + 1);
     }
 }
Exemple #7
0
 public static void AddPoem2(List <M_Poem2> poems, List <M_PoemImage> images)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_Poem2.InsertAllOnSubmit(poems);
         if (images.Count > 0)
         {
             context.M_PoemImage.InsertAllOnSubmit(images);
         }
         context.SubmitChanges();
     }
 }
Exemple #8
0
 public static List <M_Poem> QueryPoem(string key)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         var result = from poem in context.M_Poem
                      where
                      (poem.Author.IndexOf(key) >= 0 ||
                       poem.Cipai.IndexOf(key) >= 0 ||
                       poem.MainBody.IndexOf(key) >= 0)
                      select poem;
         return(result.ToList());
     }
 }