cb85c38fd1faac0ad74ec4408f7a54d873fd0e9a.svn-base 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. (function () {
  2. BemsWebApplication.BemsPeakHistoryDailyViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.CreatedDateTime = ko.observable();
  5. this.MaxPeakValue = ko.observable();
  6. this.MaxDateTime = ko.observable();
  7. this.MinPeakValue = ko.observable();
  8. this.MinDateTime = ko.observable();
  9. if (data)
  10. this.fromJS(data);
  11. };
  12. $.extend(BemsWebApplication.BemsPeakHistoryDailyViewModel.prototype, {
  13. toJS: function () {
  14. return {
  15. SiteId: this.SiteId(),
  16. CreatedDateTime: this.CreatedDateTime(),
  17. MaxPeakValue: this.MaxPeakValue(),
  18. MaxDateTime: this.MaxDateTime(),
  19. MinPeakValue: this.MinPeakValue(),
  20. MinDateTime: this.MinDateTime(),
  21. };
  22. },
  23. fromJS: function (data) {
  24. if (data) {
  25. this.SiteId(data.SiteId);
  26. this.CreatedDateTime(data.CreatedDateTime);
  27. this.MaxPeakValue(data.MaxPeakValue);
  28. this.MaxDateTime(data.MaxDateTime);
  29. this.MinPeakValue(data.MinPeakValue);
  30. this.MinDateTime(data.MinDateTime);
  31. }
  32. }
  33. });
  34. })();