Exemple #1
0
        /// <summary>
        /// Query all chapters in a single Bible book from a storehouse
        /// </summary>
        /// <param name="meps">MEPS id to query</param>
        /// <param name="storehouse">Storehouse to query</param>
        /// <returns>All chapters in a single Bible book</returns>
        public static List <WOLArticle> QueryArticlesByBibleBook(NavStruct meps, string storehouse)
        {
            string book = meps.Book.ToString() + ".";

            var db = new SQLiteConnection(storehouse);
            List <WOLArticle> query = db.Table <WOLArticle>().Where(a => a.PublicationCode.Equals(PublicationType.Bible) && a.ArticleNumber.StartsWith(book)).ToList();

            return(query);
        }
Exemple #2
0
        /// <summary>
        /// Query all insight articles in a specific group
        /// </summary>
        /// <param name="insightGroup">Group to query</param>
        /// <param name="storehouse">Storehouse to query</param>
        /// <returns>All insight articles in the group</returns>
        public static List <WOLArticle> QueryInsightsByGroup(string insightGroup, string storehouse)
        {
            var db    = new SQLiteConnection(storehouse);
            var query = (from a in db.Table <WOLArticle>()
                         where (a.PublicationCode.Equals(PublicationType.Insight) && a.ArticleGroup.Equals(insightGroup))
                         select a).ToList();
            var q = query.OrderBy(a => NavStruct.Parse(a.ArticleNumber).Verse);

            return(q.ToList());
        }
Exemple #3
0
        /// <summary>
        /// Query a single article from a storehouse
        /// </summary>
        /// <param name="code">Publication code to query</param>
        /// <param name="meps">MEPS id to query</param>
        /// <param name="storehouse">Storehouse to query</param>
        /// <returns>A single article</returns>
        public static WOLArticle QueryArticle(string code, NavStruct meps, string storehouse)
        {
            string number = meps.ToString();

            var db    = new SQLiteConnection(storehouse);
            var query = (from a in db.Table <WOLArticle>()
                         where (a.PublicationCode.Equals(code) && a.ArticleNumber.Equals(number))
                         select a).ToList();

            return(query.FirstOrDefault());
        }
Exemple #4
0
        /// <summary>
        /// Query all articles by chapter number in a storehouse that match articles from another storehouse
        /// </summary>
        /// <param name="code">Publication code to query</param>
        /// <param name="articles">Articles to query</param>
        /// <param name="storehouse">Storehouse to query</param>
        /// <returns>Matching articles by chapter number</returns>
        public static List <WOLArticle> QueryMatchByChapters(string code, List <WOLArticle> articles, string storehouse)
        {
            var db = new SQLiteConnection(storehouse);

            string[] chapters = articles.Select(a => NavStruct.Parse(a.ArticleNumber).Chapter.ToString()).ToArray();
            string[] meps     = db.Query <WOLArticle>("select ArticleNumber from WOLArticle where PublicationCode = ?", code)
                                .Where(a => chapters.Contains(NavStruct.Parse(a.ArticleNumber).Chapter.ToString()))
                                .Select(a => a.ArticleNumber).ToArray();

            var query = db.Table <WOLArticle>().Where(a => a.PublicationCode.Equals(code) && meps.Contains(a.ArticleNumber)).ToList();

            return(query);
        }
Exemple #5
0
        /// <summary>
        /// Query a single insight article by MEPS id
        /// </summary>
        /// <param name="mepsId">MEPS id to query</param>
        /// <param name="storehouse">Storehouse to query</param>
        /// <returns></returns>
        public static WOLArticle QueryInsight(string mepsId, string storehouse)
        {
            var        db    = new SQLiteConnection(storehouse);
            WOLArticle query = db.Table <WOLArticle>().Single(a => a.PublicationCode.Equals(PublicationType.Insight) && (NavStruct.Parse(a.ArticleNumber).Chapter.ToString()).Equals(mepsId));

            return(query);
        }