bemsenergydaily-view-model.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (function () {
  2. BemsWebApplication.BemsEnergyDailyViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.BuildingId = ko.observable();
  5. this.ServiceTypeId = ko.observable();
  6. this.FuelTypeId = ko.observable();
  7. this.CreatedDate = ko.observable();
  8. this.Prediction = ko.observable();
  9. this.Measurement = ko.observable();
  10. this.Goal = ko.observable();
  11. this.Prediction_Regression = ko.observable();
  12. this.MeanT = ko.observable();
  13. this.HDD = ko.observable();
  14. this.CDD = ko.observable();
  15. if (data)
  16. this.fromJS(data);
  17. };
  18. $.extend(BemsWebApplication.BemsEnergyDailyViewModel.prototype, {
  19. toJS: function () {
  20. return {
  21. SiteId: this.SiteId(),
  22. BuildingId: this.BuildingId(),
  23. ServiceTypeId: this.ServiceTypeId(),
  24. FuelTypeId: this.FuelTypeId(),
  25. CreatedDate: this.CreatedDate(),
  26. Prediction: this.Prediction(),
  27. Measurement: this.Measurement(),
  28. Goal: this.Goal(),
  29. Prediction_Regression: this.Prediction_Regression(),
  30. MeanT: this.MeanT(),
  31. HDD: this.HDD(),
  32. CDD: this.CDD(),
  33. };
  34. },
  35. fromJS: function (data) {
  36. if (data) {
  37. this.SiteId(data.SiteId);
  38. this.BuildingId(data.BuildingId);
  39. this.ServiceTypeId(data.ServiceTypeId);
  40. this.FuelTypeId(data.FuelTypeId);
  41. this.CreatedDate(data.CreatedDate);
  42. this.Prediction(data.Prediction);
  43. this.Measurement(data.Measurement);
  44. this.Goal(data.Goal);
  45. this.Prediction_Regression(data.Prediction_Regression);
  46. this.MeanT(data.MeanT);
  47. this.HDD(data.HDD);
  48. this.CDD(data.CDD);
  49. }
  50. }
  51. });
  52. })();