fmsbudgetcodeclass-view-model.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. 
  2. (function () {
  3. BemsWebApplication.FmsBudgetCodeClassViewModel = function (data) {
  4. this.SiteId = ko.observable();
  5. this.BudgetClassId = ko.observable();
  6. this.RootBudgetClassId = ko.observable();
  7. this.ParentBudgetClassId = ko.observable();
  8. this.RootBudgetName = ko.observable();
  9. this.ParentBudgetName = ko.observable();
  10. this.Depth = ko.observable();
  11. this.Name = ko.observable();
  12. this.Abbreviation = ko.observable();
  13. this.IsUse = ko.observable();
  14. this.BudgetSeq = ko.observable();
  15. this.YearlyBudget = ko.observable();
  16. this.MonthlyBudget = ko.observable();
  17. if (data)
  18. this.fromJS(data);
  19. };
  20. $.extend(BemsWebApplication.FmsBudgetCodeClassViewModel.prototype, {
  21. toJS: function () {
  22. return {
  23. SiteId: this.SiteId(),
  24. BudgetClassId: this.BudgetClassId(),
  25. RootBudgetClassId: this.RootBudgetClassId(),
  26. ParentBudgetClassId: this.ParentBudgetClassId(),
  27. RootBudgetName: this.RootBudgetName(),
  28. ParentBudgetName: this.ParentBudgetName(),
  29. Depth: this.Depth(),
  30. Name: this.Name(),
  31. Abbreviation: this.Abbreviation(),
  32. IsUse: this.IsUse(),
  33. BudgetSeq: this.BudgetSeq(),
  34. YearlyBudget: this.YearlyBudget(),
  35. MonthlyBudget: this.MonthlyBudget(),
  36. };
  37. },
  38. fromJS: function (data) {
  39. if (data) {
  40. this.SiteId(data.SiteId);
  41. this.BudgetClassId(data.BudgetClassId);
  42. this.RootBudgetClassId(data.RootBudgetClassId);
  43. this.ParentBudgetClassId(data.ParentBudgetClassId);
  44. this.RootBudgetName(data.RootBudgetName);
  45. this.ParentBudgetName(data.ParentBudgetName);
  46. this.Depth(data.Depth);
  47. this.Name(data.Name);
  48. this.Abbreviation(data.Abbreviation);
  49. this.IsUse(data.IsUse);
  50. this.BudgetSeq(data.BudgetSeq);
  51. this.YearlyBudget(data.YearlyBudget);
  52. this.MonthlyBudget(data.MonthlyBudget);
  53. }
  54. }
  55. });
  56. })();