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