bca0cebe7827bead5c9ac742efd9ef6cb606f2c4.svn-base 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (function () {
  2. BemsWebApplication.CmPatrolPosViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.BuildingId = ko.observable();
  5. this.FloorId = ko.observable();
  6. this.PosId = ko.observable();
  7. this.Name = ko.observable();
  8. this.PosDesc = ko.observable();
  9. this.TagId = ko.observable();
  10. if (data)
  11. this.fromJS(data);
  12. };
  13. $.extend(BemsWebApplication.CmPatrolPosViewModel.prototype, {
  14. toJS: function () {
  15. return {
  16. SiteId: this.SiteId(),
  17. BuildingId: this.BuildingId(),
  18. FloorId: this.FloorId(),
  19. PosId: this.PosId(),
  20. Name: this.Name(),
  21. PosDesc: this.PosDesc(),
  22. TagId: this.TagId(),
  23. };
  24. },
  25. fromJS: function (data) {
  26. if (data) {
  27. this.SiteId(data.SiteId);
  28. this.BuildingId(data.BuildingId);
  29. this.FloorId(data.FloorId);
  30. this.PosId(data.PosId);
  31. this.Name(data.Name);
  32. this.PosDesc(data.PosDesc);
  33. this.TagId(data.TagId);
  34. }
  35. }
  36. });
  37. })();