コード例 #1
0
ファイル: OtherFee.cs プロジェクト: khtutz/anet4jkhz
        /// <summary>
        /// Constructor to create "new" OtherFee
        /// </summary>
        /// <param name="parentPA">Parent PaymentAdvice</param>
        /// <param name="type">Type of otherfee</param>
        public OtherFee(PaymentAdvice parentPA, OtherFeeType type)
        {
            if (parentPA == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a OtherFee. "+
                    "Parent Paymentadivce cannot be null.");

            if(type==null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a OtherFee. "+
                    "OtherFeeType cannot be null");

            OtherFeeType = type;

            Amount = 0;
            PayableFee = 0;
            PrivateRemark = null;
            PublicRemark = null;
            PaymentAdviceText = null;
            IsRecurring = 0;
            IsExcluded = 0;
            IsPaid = 0;

            FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>();

            parentPA.AddOtherFee(this);
        }
コード例 #2
0
ファイル: OtherFee.cs プロジェクト: khtutz/anet4jkhz
        /// <summary>
        /// Constructor to create new OtherFee based on a given template
        /// </summary>
        /// <param name="parentPA">Parent PaymentAdvice</param>
        /// <param name="param name="template">Template</param>
        public OtherFee(PaymentAdvice parentPA, OtherFee template)
        {
            if (parentPA == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a OtherFee. " +
                    "Parent Paymentadivce cannot be null.");

            if (template == null || template.Validate().Count>0)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a OtherFee. " +
                    "Given template is not valid.");

            OtherFeeType = template.OtherFeeType;
            Amount = template.Amount;
            PayableFee = template.PayableFee;
            PrivateRemark = template.PrivateRemark;
            PublicRemark = template.PublicRemark;
            PaymentAdviceText = template.PaymentAdviceText;
            IsRecurring = template.IsRecurring;
            IsExcluded = 0;
            IsPaid = 0;

            FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>();

            parentPA.AddOtherFee(this);
            Save();

            foreach (FeeDeviationPayableFee fd in template.FeeDeviations.Values)
            {
                if (fd.IsRecurring == 1)
                {
                    FeeDeviationPayableFee newFD =
                        new FeeDeviationPayableFee(this, fd);
                    newFD.Save();

                }
            }
        }