main
 1using System;
 2using Gorilla.Commons.Utility;
 3using MoMoney.Domain.accounting;
 4using MoMoney.Domain.Core;
 5
 6namespace MoMoney.Domain.Accounting
 7{
 8    public interface ICompany : Entity
 9    {
10        string name { get; }
11        void change_name_to(string company_name);
12        void issue_bill_to(IAccountHolder customer, DateTime that_is_due_on, Money for_amount);
13        void pay(IAccountHolder person, Money amount, Date date_of_payment);
14    }
15
16    [Serializable]
17    public class Company : GenericEntity<ICompany>, ICompany
18    {
19        public string name { get; private set; }
20
21        public void change_name_to(string company_name)
22        {
23            name = company_name;
24        }
25
26        public void issue_bill_to(IAccountHolder customer, DateTime that_is_due_on, Money for_amount)
27        {
28            customer.receive(new Bill(this, for_amount, that_is_due_on));
29        }
30
31        public void pay(IAccountHolder person, Money amount, Date date_of_payment)
32        {
33            person.receive(new Income(date_of_payment, amount, this));
34        }
35
36        public override string ToString()
37        {
38            return name;
39        }
40    }
41}