Beispiel #1
0
        /// <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);
        }
        public void AddOtherFee(long typeId)
        {
            if (CurrentPaymentAdvice == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: No payment advice is selected.");

            //SECURITY CHECK HERE. Lock check here
            OtherFeeType objOFT = new OtherFeeType(typeId);
            OtherFee objOF = new OtherFee(CurrentPaymentAdvice, objOFT);

            objOF.Save();

            //log
            CurrentPaymentAdvice.LastAction = "Add OtherFee";
            CurrentPaymentAdvice.LastModifiedBy =
                ApasAccessControlManager.GetCurrentInstance().LogonUser.Id;
            CurrentPaymentAdvice.LastModifiedTime = DateTime.Now;

            CurrentPaymentAdvice.Save();
        }
        public void AddOtherFee(string typeName)
        {
            if (CurrentPaymentAdvice == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: No payment advice is selected.");

            //SECURITY CHECK HERE. Lock check here

            OtherFeeType objOFT;

            IList<OtherFeeType> sList =
                OtherFeeType.FindByName(typeName);

            if (sList.Count == 0)
            {
                //not exists yet. create.
                objOFT = new OtherFeeType(typeName);
                objOFT.Save();
            }
            else
            {
                objOFT = sList[0];
            }

            OtherFee objOF = new OtherFee(CurrentPaymentAdvice, objOFT);

            objOF.Save();

            //log
            CurrentPaymentAdvice.LastAction = "Add OtherFee";
            CurrentPaymentAdvice.LastModifiedBy =
                ApasAccessControlManager.GetCurrentInstance().LogonUser.Id;
            CurrentPaymentAdvice.LastModifiedTime = DateTime.Now;

            CurrentPaymentAdvice.Save();
        }