5350ef78a1ca9cd521106b8cc5c9307aa4751867.svn-base 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 
  2. (function () {
  3. BemsWebApplication.BemsMonitoringWeatherForecastedViewModel = function (data) {
  4. this.SiteId = ko.observable();
  5. this.CreatedDateTime = ko.observable();
  6. this.Category = ko.observable();
  7. this.BaseDateTime = ko.observable();
  8. this.ForecastedDateTime = ko.observable();
  9. this.ForecastedValue = ko.observable();
  10. this.nx = ko.observable();
  11. this.ny = ko.observable();
  12. if (data)
  13. this.fromJS(data);
  14. };
  15. $.extend(BemsWebApplication.BemsMonitoringWeatherForecastedViewModel.prototype, {
  16. toJS: function () {
  17. return {
  18. SiteId: this.SiteId(),
  19. CreatedDateTime: this.CreatedDateTime(),
  20. Category: this.Category(),
  21. BaseDateTime: this.BaseDateTime(),
  22. ForecastedDateTime: this.ForecastedDateTime(),
  23. ForecastedValue: this.ForecastedValue(),
  24. nx: this.nx(),
  25. ny: this.ny()
  26. };
  27. },
  28. fromJS: function (data) {
  29. if (data) {
  30. this.SiteId(data.SiteId);
  31. this.CreatedDateTime(data.CreatedDateTime);
  32. this.Category(data.Category);
  33. this.BaseDateTime(data.BaseDateTime);
  34. this.ForecastedDateTime(data.ForecastedDateTime);
  35. this.ForecastedValue(data.ForecastedValue);
  36. this.nx(data.nx);
  37. this.ny(data.ny);
  38. }
  39. }
  40. });
  41. })();