f4f32e13f3b920f4c235170a6e6098f4d82d5565.svn-base 1.1 KB

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