Esempio n. 1
0
        public virtual StatefulEntity GetRoot()
        {
            StatefulEntity r = this;

            while (null != r.Parent)
            {
                r = r.Parent;
            }
            return(r);
        }
 public TransactionPayment(StatefulEntity transaction, Payment payment, float percentage)
 {
     this.transaction = transaction;
     this.payment     = payment;
     if (percentage < 0 || 100 < percentage)
     {
         throw new iSabayaException("Percentage is not between 0 and 100");
     }
     this.amount = payment.Amount * (percentage / 100);
 }
 /// <summary>
 /// The appliedAmount must be between 0 and the payment amount.
 /// </summary>
 /// <param name="transaction"></param>
 /// <param name="payment"></param>
 /// <param name="appliedAmount"></param>
 public TransactionPayment(StatefulEntity transaction, Payment payment, Money appliedAmount)
 {
     this.transaction = transaction;
     this.payment     = payment;
     if (0m >= appliedAmount.Amount || payment.Amount < appliedAmount)
     {
         throw new iSabayaException("Applied amount is less than 0 or greater than the amount of payment.");
     }
     this.amount = appliedAmount;
 }
Esempio n. 4
0
 public TransactionState(StatefulEntity owner, State state, String reference, String remark,
                         DateTime enteredTS, User user)
 {
     this.owner         = owner;
     this.state         = state;
     this.reference     = reference;
     this.remark        = remark;
     this.systemMessage = "";
     this.EnteredTS     = enteredTS;
     this.updatedTS     = DateTime.Now;
     this.updatedBy     = user;
 }
Esempio n. 5
0
 public TransactionState(StatefulEntity owner, State state, String reference, String remark,
                         String systemMessage, User user)
 {
     this.owner     = owner;
     this.state     = state;
     this.reference = reference;
     this.remark    = remark;
     if (null != systemMessage)
     {
         this.systemMessage = systemMessage;
     }
     this.EnteredTS = this.updatedTS = DateTime.Now;
     this.updatedBy = user;
 }
        public override RuleResult Create(Context context, ParameterList parameters, out StatefulEntity entity)
        {
            RuleResult result;

            if (null == base.CreationRule)
            {
                throw new iSabayaException("BankTransactionType.ValidateRule is null.");
            }

            result = base.CreationRule.Execute(this, parameterList);
            entity = (StatefulEntity)parameterList[2].Value;
            if (RuleResult.Success != result)
            {
                return(result);
            }

            if (null != base.ValidationRule)
            {
                result = base.ValidationRule.Execute(this, parameterList);
            }

            return(result);
        }
 /// <summary>
 /// The applicable amount is the entire amount of payment.
 /// </summary>
 /// <param name="transaction"></param>
 /// <param name="payment"></param>
 public TransactionPayment(StatefulEntity transaction, Payment payment)
 {
     this.transaction = transaction;
     this.payment     = payment;
     this.amount      = payment.Amount;
 }
Esempio n. 8
0
 public virtual RuleResult Create(Context context, ParameterList parameters,
                                  out StatefulEntity entity)
 {
     throw new NotImplementedException();
 }