a49b6e07f32edbd9fa330b5c923f0860f22c3fd3.svn-base 1.1 KB

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