835fdeee09128705da604d68815da2e3864a3de3.svn-base 2.4 KB

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