Inheritance: User
コード例 #1
0
        public virtual Child CreateChild(string name, string userName, string password)
        {
            var child = new Child(name, userName, password, this.Id);

            this.Children.Add(child);
            return child;
        }
コード例 #2
0
ファイル: Parent.cs プロジェクト: seif/SharpArch.TardisBank
 public virtual void MakePaymentTo(Child child, decimal amount, string description)
 {
     if (!this.HasChild(child))
     {
         throw new TardisBankException("{0} is not a child of {1}", child.Name, this.Name);
     }
     child.ReceivePayment(amount, description);
 }
コード例 #3
0
        public bool AreNullOrNotRelated(Parent parent, Child child)
        {
            if (parent == null || child == null) return true;

            if (!parent.HasChild(child))
            {
                throw new TardisBankException("'{0}' is not a child of '{1}'", child.UserName, parent.UserName);
            }

            return false;
        }
コード例 #4
0
 public virtual void MakePaymentTo(Child child, decimal amount)
 {
     this.MakePaymentTo(child, amount, string.Format("Payment from {0}", this.Name));
 }
コード例 #5
0
 public virtual bool HasChild(Child child)
 {
     return this.Children.Any(x => x == child);
 }
コード例 #6
0
 public bool IsNotChildOfCurrentUser(Child child)
 {
     var parent = this.CurrentUser as Parent;
     return (child == null) || (parent == null) || (!parent.HasChild(child));
 }