Esempio n. 1
0
        /// <summary>
        /// Constructor to create "new" FeeDeviationPayableFee
        /// </summary>
        /// <param name="IdPayableFee">Foreign key to PayableFee. Must assign.</param>
        /// <param name="IdFeeDeviation">Foreign key to FeeDeviation. Must assign</param>
        public FeeDeviationPayableFee(IPayableFee parent, int IdFeeDeviation)
        {
            if (parent == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                    "Parent PayableFee cannot be null.");

            if (IdFeeDeviation <= 0)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                    "Invalid FeeDeviation Id.");

            this.IdFeeDeviation = IdFeeDeviation;
            Type = "";
            IsRecurring = 0;

            parent.AddFeeDeviation(this);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor to create FeeDeviationPayableFee from a given template
        /// </summary>
        /// <param name="prevFD">Previous FeeDeviationPayableFee template to copy necessary feilds from.</param>
        public FeeDeviationPayableFee(IPayableFee parent, FeeDeviationPayableFee prevFD)
        {
            if (prevFD == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                    "Given template cannot be null.");

            if (prevFD.Validate().Count > 0)
                throw new ApasInvaidOperationException(
                     "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                     "Given template is not valid.");

            if (parent == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                    "Parent PayableFee cannot be null.");

            IdPayableFee = prevFD.IdPayableFee;
            IdFeeDeviation = prevFD.IdFeeDeviation;
            Type = prevFD.Type;
            IsRecurring = prevFD.IsRecurring;
            Value = prevFD.Value;

            parent.AddFeeDeviation(this);
        }