565c5f495067c3033571a6757b5f62a93f8ceba6.svn-base 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 
  2. (function () {
  3. Partials.ConsumeMonthlyViewModel = function (data) {
  4. this.SiteId = ko.observable();
  5. this.BuildingId = ko.observable();
  6. this.Year = ko.observable();
  7. this.Month = ko.observable();
  8. this.Cooler = ko.observable();
  9. this.Boiler = ko.observable();
  10. this.Goal = ko.observable();
  11. this.Product = ko.observable();
  12. if (data)
  13. this.fromJS(data);
  14. };
  15. $.extend(Partials.ConsumeMonthlyViewModel.prototype, {
  16. toJS: function () {
  17. return {
  18. SiteId: this.SiteId(),
  19. BuildingId: this.BuildingId(),
  20. Year: this.Year(),
  21. Month: this.Month(),
  22. Day: this.Day(),
  23. Cooler: this.Cooler(),
  24. Boiler: this.Boiler(),
  25. Goal: this.Goal(),
  26. product: this.Product(),
  27. };
  28. },
  29. fromJS: function (data) {
  30. if (data) {
  31. this.SiteId(data.SiteId);
  32. this.BuildingId(data.BuildingId);
  33. this.Year(data.Year);
  34. this.Month(data.Month);
  35. this.Cooler(data.Cooler);
  36. this.Boiler(data.Boiler);
  37. this.Goal(data.Goal);
  38. this.Product(data.Product);
  39. }
  40. }
  41. });
  42. })();