7d84cf3f0471c70bf87df39427106abaabefda73.svn-base 1.4 KB

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