332f15b57b7d4bd115a4bfb3dced111379778046.svn-base 1.0 KB

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