910bb32753e6d3ce4c7b19ba101853d81ca0f195.svn-base 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. (function() {
  2. BemsWebApplication.BemsFormulaParameterViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.FacilityTypeId = ko.observable();
  5. this.FacilityCode = ko.observable();
  6. this.FormulaId = ko.observable();
  7. this.ParameterId = ko.observable();
  8. this.ParameterFacilityCode = ko.observable();
  9. this.ParameterPropertyId = ko.observable();
  10. if(data)
  11. this.fromJS(data);
  12. };
  13. $.extend(BemsWebApplication.BemsFormulaParameterViewModel.prototype, {
  14. toJS: function() {
  15. return {
  16. SiteId: this.SiteId(),
  17. FacilityTypeId: this.FacilityTypeId(),
  18. FacilityCode: this.FacilityCode(),
  19. FormulaId: this.FormulaId(),
  20. ParameterId: this.ParameterId(),
  21. ParameterFacilityCode: this.ParameterFacilityCode(),
  22. ParameterPropertyId: this.ParameterPropertyId(),
  23. };
  24. },
  25. fromJS: function(data) {
  26. if(data) {
  27. this.SiteId(data.SiteId);
  28. this.FacilityTypeId(data.FacilityTypeId);
  29. this.FacilityCode(data.FacilityCode);
  30. this.FormulaId(data.FormulaId);
  31. this.ParameterId(data.ParameterId);
  32. this.ParameterFacilityCode(data.ParameterFacilityCode);
  33. this.ParameterPropertyId(data.ParameterPropertyId);
  34. }
  35. }
  36. });
  37. })();