summaryrefslogtreecommitdiff
path: root/product/Domain/Accounting/Company.cs
blob: 665501bc5001f645994e89287eff50ee7601ea07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using Gorilla.Commons.Utility;
using MoMoney.Domain.accounting;
using MoMoney.Domain.Core;

namespace MoMoney.Domain.Accounting
{
    public interface ICompany : IEntity
    {
        string name { get; }
        void change_name_to(string company_name);
        void issue_bill_to(IAccountHolder customer, DateTime that_is_due_on, Money for_amount);
        void pay(IAccountHolder person, Money amount, Date date_of_payment);
    }

    [Serializable]
    public class Company : Entity<ICompany>, ICompany
    {
        public string name { get; private set; }

        public void change_name_to(string company_name)
        {
            name = company_name;
        }

        public void issue_bill_to(IAccountHolder customer, DateTime that_is_due_on, Money for_amount)
        {
            customer.receive(new Bill(this, for_amount, that_is_due_on));
        }

        public void pay(IAccountHolder person, Money amount, Date date_of_payment)
        {
            person.receive(new Income(date_of_payment, amount, this));
        }

        public override string ToString()
        {
            return name;
        }
    }
}