Exemple #1
0
 public void Apply(BudgetCreated evnt)
 {
     _id = evnt.BudgetId;
     _name = evnt.Name;
     _owner = evnt.Owner;
     _currencyISOCode = evnt.CurrencyISOCode;
 }
Exemple #2
0
 public BudgetDistributionKeyCreated(Guid id, DateTime timestamp, BudgetId budgetId, string name)
 {
     Id        = id;
     Timestamp = timestamp;
     BudgetId  = budgetId;
     Name      = name;
 }
Exemple #3
0
 public void Apply(BudgetCreated evnt)
 {
     _id              = evnt.BudgetId;
     _name            = evnt.Name;
     _owner           = evnt.Owner;
     _currencyISOCode = evnt.CurrencyISOCode;
 }
Exemple #4
0
 public BudgetDistributionKeyCreated(Guid id, DateTime timestamp, BudgetId budgetId, string name)
 {
     Id = id;
     Timestamp = timestamp;
     BudgetId = budgetId;
     Name = name;
 }
Exemple #5
0
 public BudgetAccessAllowed(Guid id, DateTime timestamp, BudgetId budgetId, UserId allowedUserId)
 {
     Id            = id;
     Timestamp     = timestamp;
     BudgetId      = budgetId;
     AllowedUserId = allowedUserId;
 }
Exemple #6
0
 public BudgetCreated(Guid id, DateTime timestamp, BudgetId budgetId, string name, UserId owner, string currencyISOCode)
 {
     Id = id;
     Timestamp = timestamp;
     BudgetId = budgetId;
     Name = name;
     Owner = owner;
     CurrencyISOCode = currencyISOCode;
 }
Exemple #7
0
 public BudgetCreated(Guid id, DateTime timestamp, BudgetId budgetId, string name, UserId owner, string currencyISOCode)
 {
     Id              = id;
     Timestamp       = timestamp;
     BudgetId        = budgetId;
     Name            = name;
     Owner           = owner;
     CurrencyISOCode = currencyISOCode;
 }
Exemple #8
0
 public LineExpenseChanged(Guid id, DateTime timestamp, LineId lineId, BudgetId budgetId, UserId updatedBy, Expense expense)
 {
     Id = id;
     Timestamp = timestamp;
     LineId = lineId;
     BudgetId = budgetId;
     UpdatedBy = updatedBy;
     Expense = expense;
 }
Exemple #9
0
        public LineCreated(Guid id, DateTime timestamp, LineId lineId, BudgetId budgetId, UserId createdBy, Expense expense)
        {
            Id = id;
            Timestamp = timestamp;

            LineId = lineId;
            BudgetId = budgetId;
            Expense = expense;
            CreatedBy = createdBy;
        }
        public IEnumerable<Category> GetBudgetsCategories(BudgetId budgetId)
        {
            if (HasLoaded == false)
                throw new Exception("Not loaded");

            List<Category> categories;
            if (_categories.TryGetValue(budgetId.ToString(), out categories) == false)
                _categories[budgetId.ToString()] = categories = new List<Category>();
            return categories.OrderBy(d => d.Name);
        }
 public virtual ActionResult Details(string id)
 {
     var budgetId = new BudgetId(id);
     var budget = ProjectionManager.GetBudgetsList().GetBudgetById(budgetId);
     var categories = ProjectionManager.GetCategories().GetBudgetsCategories(budgetId);
    
     var model = new BudgetDetailsViewModel
     {
         Budget = budget,
         Categories = categories,
         DistributionKeys = budget.GetDistributionKeys(),
     };
     return View(model);
 }
Exemple #12
0
        public CreateLine ToCreateLine(DateTime timestamp, BudgetId budgetId, string userId, IEnumerable<MyBudget.Projections.Category> categories)
        {
            var category = Categoria.Trim().Replace((char)160, ' ');
            var categoryId = categories.FirstOrDefault(d => string.Compare(d.Name, category, true) == 0).Id;
            var expense = new Expense(new Amount(Currencies.Euro(), Spesa), Data, categoryId, Descrizione, DistributionKey);

            return new CreateLine
            {
                Id = Guid.NewGuid(),
                Timestamp = timestamp,
                BudgetId = budgetId.ToString(),
                LineId = LineId.Create(budgetId).ToString(),
                UserId = userId,
                Expense = expense,
                 
            };
        }
 public Budget GetBudgetById(BudgetId budgetId)
 {
     return _budgets[budgetId.ToString()];
 }
Exemple #14
0
 public void Create(BudgetId id, string name, UserId owner, string currencyISOCode)
 {
     RaiseEvent(new BudgetCreated(Guid.NewGuid(), DateTime.Now, id, name, owner, currencyISOCode));
 }
Exemple #15
0
 public BudgetAccessAllowed(Guid id, DateTime timestamp, BudgetId budgetId, UserId allowedUserId)
 {
     Id = id;
     Timestamp = timestamp;
     BudgetId = budgetId;
     AllowedUserId = allowedUserId;
 }
Exemple #16
0
        public static CreateLine ToCreateLine(this Movement mov, BudgetId budgetId, string userId, IEnumerable<MyBudget.Projections.Category> categories)
        {
            var category = mov.Category.Trim().Replace((char)160, ' ');
            var categoryId = categories.FirstOrDefault(d => string.Compare(d.Name, category, true) == 0).Id;

            var expense = new Expense(new Amount(Currencies.Euro(), Convert.ToDecimal(mov.Import)), mov.DateTime, categoryId, mov.ShortDescription);


            return new CreateLine
            {
                Id = Guid.NewGuid(),
                Timestamp = DateTime.Now,
                BudgetId = budgetId.ToString(),
                LineId = LineId.Create(budgetId).ToString(),
                UserId = userId,
                Expense = expense,
            };
        }
Exemple #17
0
 public static LineId Create(BudgetId budgetId)
 {
     var id = "Lines-" + Guid.NewGuid().ToString().Replace('-', '_');
     return new LineId(id);
 }
Exemple #18
0
 public void Create(BudgetId id, string name, UserId owner, string currencyISOCode)
 {
     RaiseEvent(new BudgetCreated(Guid.NewGuid(), DateTime.Now, id, name, owner, currencyISOCode));
 }
Exemple #19
0
        public void Create(LineId id, BudgetId budgetId, Expense expense, UserId createdBy)
        {
            if (string.IsNullOrEmpty(Id) == false)
                throw new Exception("line already exists");

            RaiseEvent(new LineCreated(Guid.NewGuid(), DateTime.Now, id, budgetId, createdBy, expense));
        }
Exemple #20
0
 public LineMarkedObsolete(Guid id, DateTime timestamp, LineId lineId, BudgetId budget, UserId userId, LineId obsoletedFor)
 {
     Id = id;
     Timestamp = timestamp;
     LineId = lineId;
     BudgetId = budget;
     UserId = userId;
     ObsoletedFor = obsoletedFor;
 }