a4d8d6adce8cb857bd7575e609510a5624c28a9c.svn-base 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. (function() {
  2. BemsWebApplication.BemsMonitoringPointBaseDataViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.FacilityTypeId = ko.observable();
  5. this.PropertyId = ko.observable();
  6. this.ValueType = ko.observable();
  7. this.IsAccumulated = ko.observable();
  8. this.ServiceType = ko.observable();
  9. this.FuelType = ko.observable();
  10. this.Name = ko.observable();
  11. this.Description = ko.observable();
  12. if(data)
  13. this.fromJS(data);
  14. };
  15. $.extend(BemsWebApplication.BemsMonitoringPointBaseDataViewModel.prototype, {
  16. toJS: function() {
  17. return {
  18. SiteId: this.SiteId(),
  19. FacilityTypeId: this.FacilityTypeId(),
  20. PropertyId: this.PropertyId(),
  21. ValueType: this.ValueType(),
  22. IsAccumulated: this.IsAccumulated(),
  23. ServiceType: this.ServiceType(),
  24. FuelType: this.FuelType(),
  25. Name: this.Name(),
  26. Description: this.Description(),
  27. };
  28. },
  29. fromJS: function(data) {
  30. if(data) {
  31. this.SiteId(data.SiteId);
  32. this.FacilityTypeId(data.FacilityTypeId);
  33. this.PropertyId(data.PropertyId);
  34. this.ValueType(data.ValueType);
  35. this.IsAccumulated(data.IsAccumulated);
  36. this.ServiceType(data.ServiceType);
  37. this.FuelType(data.FuelType);
  38. this.Name(data.Name);
  39. this.Description(data.Description);
  40. }
  41. }
  42. });
  43. })();