d5fd8715999bc4e4ecb8f22a90253dc6f0d207be.svn-base 1.2 KB

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