86baa06d736f6588cb3cff2711bdb93e644ea860.svn-base 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. (function() {
  2. BemsWebApplication.FmsMaterialPurchaseOrderMaterialViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.BusinessFieldId = ko.observable();
  5. this.PurchaseOrderId = ko.observable();
  6. this.MaterialId = ko.observable();
  7. this.MaterialCount = ko.observable();
  8. this.UnitCost = ko.observable();
  9. this.StoredCount = ko.observable();
  10. if(data)
  11. this.fromJS(data);
  12. };
  13. $.extend(BemsWebApplication.FmsMaterialPurchaseOrderMaterialViewModel.prototype, {
  14. toJS: function() {
  15. return {
  16. SiteId: this.SiteId(),
  17. BusinessFieldId: this.BusinessFieldId(),
  18. PurchaseOrderId: this.PurchaseOrderId(),
  19. MaterialId: this.MaterialId(),
  20. MaterialCount: this.MaterialCount(),
  21. UnitCost: this.UnitCost(),
  22. StoredCount: this.StoredCount(),
  23. };
  24. },
  25. fromJS: function(data) {
  26. if(data) {
  27. this.SiteId(data.SiteId);
  28. this.BusinessFieldId(data.BusinessFieldId);
  29. this.PurchaseOrderId(data.PurchaseOrderId);
  30. this.MaterialId(data.MaterialId);
  31. this.MaterialCount(data.MaterialCount);
  32. this.UnitCost(data.UnitCost);
  33. this.StoredCount(data.StoredCount);
  34. }
  35. }
  36. });
  37. })();