public IHttpActionResult GetTestInfoWWW(int? page, int? category) {//各學術/英文 能力測驗 list #region using (db0 = getDB0()) { var items = db0.TestInfo .Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name) .OrderByDescending(x => x.sort) .Select(x => new m_TestInfo { test_info_id = x.test_info_id, title = x.title, list_intro = x.list_intro, category = x.category }); if (category != null) { items = items.Where(x => x.category == category); } var nowpage = page == null ? 1 : (int)page; int startRecord = PageCount.PageInfo(nowpage, 10, items.Count()); var resultItems = items.Skip(startRecord).Take(10); var GridInfo = new { rows = resultItems.ToList(), total = PageCount.TotalPage, page = PageCount.Page, records = PageCount.RecordCount, startcount = PageCount.StartCount, endcount = PageCount.EndCount }; foreach (var item in GridInfo.rows) { item.imgsrc = GetImg(item.test_info_id, "Photo1", "TestInfo", "Photo");//顯示列表圖 } return Ok(GridInfo); } #endregion }
public IHttpActionResult GetAlbumsWWW(int? page, int? category, int? year) {//相片回顧 list #region using (db0 = getDB0()) { var items = db0.Albums .Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name) .OrderByDescending(x => x.sort) .Select(x => new m_Albums { albums_id = x.albums_id, title = x.title, category = x.category, year = x.year }); if (category != null) { items = items.Where(x => x.category == category); } if (year != null) { items = items.Where(x => x.year == year); } var nowpage = page == null ? 1 : (int)page; int startRecord = PageCount.PageInfo(nowpage, 9, items.Count()); var resultItems = items.Skip(startRecord).Take(9); var GridInfo = new { rows = resultItems.ToList(), total = PageCount.TotalPage, page = PageCount.Page, records = PageCount.RecordCount, startcount = PageCount.StartCount, endcount = PageCount.EndCount }; foreach (var item in GridInfo.rows) { item.imgsrc = GetImg(item.albums_id, "Photo1", "Albums", "Photo");//顯示列表圖 } return Ok(GridInfo); } #endregion }
public IHttpActionResult GetAbroadSchoolWWW(int? page, int? country, int? operation, string title, int? category) {//海外遊學list #region using (db0 = getDB0()) { var items = db0.AbroadSchool .Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name) .OrderByDescending(x => x.sort) .Select(x => new m_AbroadSchool { abroad_school_id = x.abroad_school_id, school_title = x.school_title, list_intro = x.list_intro, country_category = x.country_category, operation_category = x.operation_category, category=x.category }); if (category != null) { items = items.Where(x => x.category == category); } if (country != null) { items = items.Where(x => x.country_category == country); } if (operation != null) { items = items.Where(x => x.operation_category == operation); } if (title != null) { items = items.Where(x => x.school_title.Contains(title)); } var nowpage = page == null ? 1 : (int)page; int startRecord = PageCount.PageInfo(nowpage, 10, items.Count()); var resultItems = items.Skip(startRecord).Take(10); var GridInfo = new { rows = resultItems.ToList(), total = PageCount.TotalPage, page = PageCount.Page, records = PageCount.RecordCount, startcount = PageCount.StartCount, endcount = PageCount.EndCount }; foreach (var item in GridInfo.rows) { item.imgsrc = GetImg(item.abroad_school_id, "Photo1", "AbroadSchool", "Photo");//顯示列表圖 } return Ok(GridInfo); } #endregion }
public IHttpActionResult GetStudyAbroadWWW(int? page, int? category, int? country) {//海外遊學list #region using (db0 = getDB0()) { var items = db0.StudyAbroad .Where(x => x.i_Hide == false && x.vacation_category != VacationType.Intensive & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name) .OrderByDescending(x => x.sort) .Select(x => new m_StudyAbroad { study_abroad_id = x.study_abroad_id, start_date = x.start_date, end_date = x.end_date, planning_name = x.planning_name, intro = x.intro, is_hot = x.is_hot, is_past = x.is_past, country_category = x.country_category, vacation_category = x.vacation_category }); if (category != null) { if (category == 0) { //hot 行程 items = items.Where(x => x.is_hot & !x.is_past); } else if (category == 1) {//過往行程 items = items.Where(x => x.is_past); } else {//其他行程 items = items.Where(x => x.vacation_category == category & !x.is_past); } } if (country != null) { items = items.Where(x => x.country_category == country); } var nowpage = page == null ? 1 : (int)page; int startRecord = PageCount.PageInfo(nowpage, 10, items.Count()); var resultItems = items.Skip(startRecord).Take(10); var GridInfo = new { rows = resultItems.ToList(), total = PageCount.TotalPage, page = PageCount.Page, records = PageCount.RecordCount, startcount = PageCount.StartCount, endcount = PageCount.EndCount }; foreach (var item in GridInfo.rows) { item.imgsrc = GetImg(item.study_abroad_id, "Photo1", "StudyAbroad", "Photo");//顯示列表圖 } return Ok(GridInfo); } #endregion }
public IHttpActionResult GetShareP4VideoWWW(int? page) {//客戶形象影片list #region using (db0 = getDB0()) { var items = db0.Video .Where(x => x.i_Hide == false & x.category == VideoType.Share_p4 & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name) .OrderByDescending(x => x.sort) .Select(x => new m_Video { video_id = x.video_id, video_title = x.video_title, video_url = x.video_url }); var nowpage = page == null ? 1 : (int)page; int startRecord = PageCount.PageInfo(nowpage, 9, items.Count()); var resultItems = items.Skip(startRecord).Take(9); var GridInfo = new { rows = resultItems.ToList(), total = PageCount.TotalPage, page = PageCount.Page, records = PageCount.RecordCount, startcount = PageCount.StartCount, endcount = PageCount.EndCount }; foreach (var item in GridInfo.rows) { item.imgsrc = GetImg(item.video_id, "Photo1", "Video", "Photo");//顯示列表圖 } return Ok(GridInfo); } #endregion }