Ejemplo n.º 1
0
 public static List <M_Cipai> GetAllCipai()
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         return(context.M_Cipai.ToList());
     }
 }
Ejemplo n.º 2
0
 public static List <M_Author> GetAllAuthor()
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         return(context.M_Author.ToList());
     }
 }
Ejemplo n.º 3
0
 public static void AddPoems(List <M_Poem> entities)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_Poem.InsertAllOnSubmit(entities);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
 public static void AddPoem2(M_Poem2 poem)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_Poem2.InsertOnSubmit(poem);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 5
0
 public static void AddBookIndex(IEnumerable <M_BookIndex> entities)
 {
     using (PoemDBDataContext context = new PoemDBDataContext(CurrentConnection))
     {
         context.M_BookIndex.InsertAllOnSubmit(entities);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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());
     }
 }