bemsformulabase-view-model.js 802 B

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