cmfloor-view-model.js 880 B

1234567891011121314151617181920212223242526272829303132
  1. (function() {
  2. BemsWebApplication.CmFloorViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.BuildingId = ko.observable();
  5. this.FloorId = ko.observable();
  6. this.Name = ko.observable();
  7. if(data)
  8. this.fromJS(data);
  9. };
  10. $.extend(BemsWebApplication.CmFloorViewModel.prototype, {
  11. toJS: function() {
  12. return {
  13. SiteId: this.SiteId(),
  14. BuildingId: this.BuildingId(),
  15. FloorId: this.FloorId(),
  16. Name: this.Name(),
  17. };
  18. },
  19. fromJS: function(data) {
  20. if(data) {
  21. this.SiteId(data.SiteId);
  22. this.BuildingId(data.BuildingId);
  23. this.FloorId(data.FloorId);
  24. this.Name(data.Name);
  25. }
  26. }
  27. });
  28. })();