bemsenergygoaldaily-view-model.js 905 B

123456789101112131415161718192021222324252627282930
  1. (function () {
  2. BemsWebApplication.BemsEnergyGoalDailyViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.BuildingId = ko.observable();
  5. this.CreatedDate = ko.observable();
  6. this.Goal = ko.observable();
  7. if (data)
  8. this.fromJS(data);
  9. };
  10. $.extend(BemsWebApplication.BemsEnergyGoalDailyViewModel.prototype, {
  11. toJS: function () {
  12. return {
  13. SiteId: this.SiteId(),
  14. BuildingId: this.BuildingId(),
  15. CreatedDate: this.CreatedDate(),
  16. Goal: this.Goal(),
  17. };
  18. },
  19. fromJS: function (data) {
  20. if (data) {
  21. this.SiteId(data.SiteId);
  22. this.BuildingId(data.BuildingId);
  23. this.CreatedDate(data.CreatedDate);
  24. this.Goal(data.Goal);
  25. }
  26. }
  27. });
  28. })();