NewsService.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using Muchinfo.MTPClient.Data.Model.News;
  2. using Muchinfo.MTPClient.IService;
  3. using System.Collections.Generic;
  4. using System.Collections.ObjectModel;
  5. namespace Muchinfo.MTPClient.Service
  6. {
  7. public class NewsService : INewsService
  8. {
  9. /// <summary>
  10. /// 获取新闻分类信息
  11. /// </summary>
  12. /// <returns>List{NewsCategory}.</returns>
  13. /// <exception cref="System.NotImplementedException"></exception>
  14. public List<NewsCategory> GetNewsCategories()
  15. {
  16. return null;
  17. //try
  18. //{
  19. // var url = LinkerHelper.GetNewsUrl();
  20. // if (string.IsNullOrWhiteSpace(url)) return null;
  21. // var categroyAddress = ConfigurationManager.AppSettings["News_CategoryAddress"];
  22. // categroyAddress = categroyAddress.TrimStart('/');
  23. // url = url.TrimEnd('/');
  24. // url = url + @"/" + categroyAddress;
  25. // var result = HttpUtility.HttpGet(url);
  26. // var adapter = new NewsEntityAdapter();
  27. // return adapter.ToNewsCategories(result);
  28. //}
  29. //catch (Exception e)
  30. //{
  31. // return null;
  32. // //throw new MuchinfoException(ExceptionManager.UnknownServiceErrorCode, e);
  33. //}
  34. }
  35. /// <summary>
  36. /// 获取新闻标题(滚动信息)
  37. /// </summary>
  38. /// <param name="classCode"></param>
  39. /// <returns></returns>
  40. public ObservableCollection<NewsTitle> GetNewsTitle(string classCode)
  41. {
  42. return null;
  43. //ObservableCollection<NewsTitle> newsTitleList = new ObservableCollection<NewsTitle>();
  44. //var url = LinkerHelper.GetNewsUrl();
  45. //if (string.IsNullOrWhiteSpace(url)) return null;
  46. //var categroyAddress = ConfigurationManager.AppSettings["News_NewsTitle"];
  47. //categroyAddress = categroyAddress.TrimStart('/');
  48. //url = url.TrimEnd('/');
  49. //url = url + @"/" + categroyAddress + "?classcode=" + classCode + "&topnum=20";
  50. //var result = HttpUtility.HttpGet(url);
  51. //var adapter = new NewsEntityAdapter();
  52. //var list = adapter.ToNewsTitleCategories(result);
  53. //return newsTitleList = list.ToObservableCollection();
  54. }
  55. }
  56. }