3738b11e763cd466fa6e0647e2928b0305d3f235.svn-base 757 B

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