Example #1
0
 public static List<BibleContent> getBible()
 {
     string sqlStr = "SELECT  B_CONTENT AS content, B.WEEK_DAY, IMAGE_PATH as path  FROM BIBLE_CONTENT B WHERE B.B_DATE IN (@DAY1,@DAY2,@DAY3,@DAY4,@DAY5,@DAY6)";
     List<string> thisWeek = getThisWeek();
     SqlParameter day1 = new SqlParameter("@DAY1", thisWeek[0]);
     SqlParameter day2 = new SqlParameter("@DAY2", thisWeek[1]);
     SqlParameter day3 = new SqlParameter("@DAY3", thisWeek[2]);
     SqlParameter day4 = new SqlParameter("@DAY4", thisWeek[3]);
     SqlParameter day5 = new SqlParameter("@DAY5", thisWeek[4]);
     SqlParameter day6 = new SqlParameter("@DAY6", thisWeek[5]);
     SqlParameter[] paras = { day1, day2, day3, day4, day5,day6 };
     DataTableCollection tables =  SqlHelper.GetTableText(sqlStr, paras);
     DataTable table = tables[0];
     List<BibleContent> results = new List<BibleContent>();
     for(int i = 0;i<table.Rows.Count;i++)
     {
         BibleContent content = new BibleContent();
         DataRow row = table.Rows[i];
         content.content = row[CONTENT] as string;
         content.dateWeek = Convert.ToInt32(row[DAY]);
         content.imagePath = Convert.ToString(row[IMAGE_PATH]);
         results.Add(content);
     }
     return results;
 }
Example #2
0
 public static BibleContent getDayBible(string date)
 {
     string sql = "SELECT  B_CONTENT AS content, B.WEEK_DAY, IMAGE_PATH as path  FROM BIBLE_CONTENT B WHERE B.B_DATE=@Date";
     SqlParameter para = new SqlParameter("@Date", date);
     SqlParameter[] paras = { para };
     DataTableCollection tables = SqlHelper.GetTableText(sql, paras);
     DataTable table = tables[0];
     BibleContent content = new BibleContent();
     for (int i = 0; i < table.Rows.Count; i++)
     {
         DataRow row = table.Rows[i];
         content.content = row[CommonInfo.CONTENT] as string;
         content.dateWeek = Convert.ToInt32(row[CommonInfo.DAY]);
         content.imagePath = Convert.ToString(row[CommonInfo.D_IMAGE_PATH]);
     }
     return content;
 }
Example #3
0
        public static BibleContent getBibleByDay(int day)
        {
            string sqlStr = "SELECT TOP 1 B_CONTENT AS content, B.WEEK_DAY, IMAGE_PATH as path  FROM BIBLE_CONTENT B WHERE B.WEEK_DAY = @Day ORDERBY B_DATE DESC";
            SqlParameter Day = new SqlParameter("@Day", day);
            SqlParameter[] paras = { Day};
            DataTableCollection tables = SqlHelper.GetTableText(sqlStr, paras);
            DataTable table = tables[0];
            BibleContent content = new BibleContent();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                
                DataRow row = table.Rows[i];
                content.content = row[CONTENT] as string;
                content.dateWeek = Convert.ToInt32(row[DAY]);
                content.imagePath = Convert.ToString(row[IMAGE_PATH]);

            }//这边复制粘贴了, 有空改一改
            return content;
        }