예제 #1
0
 public void AddBudgets(User u, IAccountingService accounting)
 {
     PointsLedger = accounting.GetPointsLedger(u);
     BudgetLedger = accounting.GetBudgetLedger(u);
     Budget       = (null != BudgetLedger &&
                     null != BudgetLedger.Account)
         ? BudgetEditModel.FromDomain(BudgetLedger.Account.Budget)
         : new BudgetEditModel();
 }
예제 #2
0
 public static AccountEditModel FromDomain(Account a)
 {
     return(new AccountEditModel {
         Name = a.Name,
         Purpose = a.Purpose,
         Type = a.Type,
         Budget = BudgetEditModel.FromDomain(a.Budget),
     });
 }
예제 #3
0
        protected virtual void Init(Program p, IAccountingService accounting)
        {
            base.Init(p);
            Content  = ContentEditModel.FromDomain(p.Content);
            Issuance = IssuanceEditModel.FromDomain(p.Issuance);
            if (Issuance.Type == IssuanceType.ProgramBudget &&
                !String.IsNullOrEmpty(p.Issuance.Account))
            {
                var a = accounting.GetProgramAwardSource(p, null);
                if (null != a)
                {
                    Issuance.Ledger = accounting.GetLedger(a);
                    Issuance.Budget = BudgetEditModel.FromDomain(a.Budget);
                }
            }

            Title = p.Title;
        }