bc86401d06ba46d9b44c15c24c678060e024f956.svn-base 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. (function () {
  2. BemsWebApplication.FmsContractViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.ContractId = ko.observable();
  5. this.Name = ko.observable();
  6. this.PartnerTypeId = ko.observable();
  7. this.PartnerId = ko.observable();
  8. this.ContractDate = ko.observable();
  9. this.StartDate = ko.observable();
  10. this.EndDate = ko.observable();
  11. this.OwnerShipName = ko.observable();
  12. this.OwnerShipPhoneNo = ko.observable();
  13. this.CommitmentMan = ko.observable();
  14. this.Comment = ko.observable();
  15. this.ContractClassId = ko.observable();
  16. this.ContractTypeId = ko.observable();
  17. this.ContractMethodId = ko.observable();
  18. this.PaymentTypeId = ko.observable();
  19. if (data)
  20. this.fromJS(data);
  21. };
  22. $.extend(BemsWebApplication.FmsContractViewModel.prototype, {
  23. toJS: function () {
  24. return {
  25. SiteId: this.SiteId(),
  26. ContractId: this.ContractId(),
  27. Name: this.Name(),
  28. PartnerTypeId: this.PartnerTypeId(),
  29. PartnerId: this.PartnerId(),
  30. ContractDate: this.ContractDate(),
  31. StartDate: this.StartDate(),
  32. EndDate: this.EndDate(),
  33. OwnerShipName: this.OwnerShipName(),
  34. OwnerShipPhoneNo: this.OwnerShipPhoneNo(),
  35. CommitmentMan: this.CommitmentMan(),
  36. Comment: this.Comment(),
  37. ContractClassId: this.ContractClassId(),
  38. ContractTypeId: this.ContractTypeId(),
  39. ContractMethodId: this.ContractMethodId(),
  40. PaymentTypeId: this.PaymentTypeId(),
  41. };
  42. },
  43. fromJS: function (data) {
  44. if (data) {
  45. this.SiteId(data.SiteId);
  46. this.ContractId(data.ContractId);
  47. this.Name(data.Name);
  48. this.PartnerTypeId(data.PartnerTypeId);
  49. this.PartnerId(data.PartnerId);
  50. this.ContractDate(data.ContractDate);
  51. this.StartDate(data.StartDate);
  52. this.EndDate(data.EndDate);
  53. this.OwnerShipName(data.OwnerShipName);
  54. this.OwnerShipPhoneNo(data.OwnerShipPhoneNo);
  55. this.CommitmentMan(data.CommitmentMan);
  56. this.Comment(data.Comment);
  57. this.ContractClassId(data.ContractClassId);
  58. this.ContractTypeId(data.ContractTypeId);
  59. this.ContractMethodId(data.ContractMethodId);
  60. this.PaymentTypeId(data.PaymentTypeId);
  61. }
  62. }
  63. });
  64. })();