2d0823f82d43fd03c704a8f623a85904c9d9c776.svn-base 1.2 KB

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