81028ec73e1b5dbd36e924df5c91775bb6645cc1.svn-base 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. (function() {
  2. BemsWebApplication.BemsSitePriceHistoryViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.FuelTypeId = ko.observable();
  5. this.PriceTypeId = ko.observable();
  6. this.PriceCode = ko.observable();
  7. this.PriceValue = ko.observable();
  8. this.PayDate = ko.observable();
  9. this.StartDate = ko.observable();
  10. this.EndDate = ko.observable();
  11. this.PayCharge = ko.observable();
  12. if(data)
  13. this.fromJS(data);
  14. };
  15. $.extend(BemsWebApplication.BemsSitePriceHistoryViewModel.prototype, {
  16. toJS: function() {
  17. return {
  18. SiteId: this.SiteId(),
  19. FuelTypeId: this.FuelTypeId(),
  20. PriceTypeId: this.PriceTypeId(),
  21. PriceCode: this.PriceCode(),
  22. PriceValue: this.PriceValue(),
  23. PayDate: this.PayDate(),
  24. StartDate: this.StartDate(),
  25. EndDate: this.EndDate(),
  26. PayCharge: this.PayCharge(),
  27. };
  28. },
  29. fromJS: function(data) {
  30. if (data) {
  31. this.SiteId(data.SiteId);
  32. this.FuelTypeId(data.FuelTypeId);
  33. this.PriceTypeId(data.PriceTypeId);
  34. this.PriceCode(data.PriceCode);
  35. this.PriceValue(data.PriceValue);
  36. this.PayDate(data.PayDate);
  37. this.StartDate(data.StartDate);
  38. this.EndDate(data.EndDate);
  39. this.PayCharge(data.PayCharge);
  40. }
  41. }
  42. });
  43. })();