Listening.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using NEducation.Controllers;
  2. using Newtonsoft.Json.Linq;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Web;
  7. namespace NEducation.Code
  8. {
  9. public class Listening
  10. {
  11. public String id { get; set; }
  12. public String name { get; set; }
  13. public String descriptionGlobal { get; set; }
  14. public String descriptionLocal { get; set; }
  15. public String introductionGlobal { get; set; }
  16. public String introductionLocal { get; set; }
  17. public String picture { get; set; }
  18. public String content { get; set; }
  19. public String contentType { get; set; }
  20. public String lessonID { get; set; }
  21. // parse data from JSON data
  22. public Listening() { }
  23. public Listening(string json) : this(JObject.Parse(json))
  24. { }
  25. public Listening(JObject jObject)
  26. {
  27. if (jObject != null)
  28. {
  29. id = (string)jObject["ID"];
  30. name = (string)jObject["NAME"];
  31. descriptionGlobal = (string)jObject["DESCRIPTION_GLOBAL"];
  32. descriptionLocal = (string)jObject["DESCRIPTION_LOCAL"];
  33. introductionGlobal = (string)jObject["INTRODUCTION_GLOBAL"];
  34. introductionLocal = (string)jObject["INTRODUCTION_LOCAL"];
  35. picture = UtilsController.GetContentPath.ListenContentPath + (string)jObject["PICTURE"];
  36. contentType = (string)jObject["CONTENT_TYPE"];
  37. if (contentType == UtilsController.GetContentType.AUDIO_FILE ||
  38. contentType == UtilsController.GetContentType.PICTURE_FILE ||
  39. contentType == UtilsController.GetContentType.VIDEO_FILE)
  40. content = UtilsController.GetContentPath.ListenContentPath + (string)jObject["CONTENT"];
  41. else
  42. content = (string)jObject["CONTENT"];
  43. lessonID = (string)jObject["LESSON_ID"];
  44. System.Diagnostics.Debug.WriteLine("content " + content);
  45. }
  46. }
  47. }
  48. }