/// <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);
        }
        /// <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);
        }
Example #3
0
        //DESIGN RECONSIDERATION
        public void AddFeeDeviation(IPayableFee curPF , int fdId)
        {
            FeeDeviationPayableFee newFD =
                new FeeDeviationPayableFee(curPF, fdId);

            newFD.IsRecurring = 1;
            newFD.Value = 0;
            newFD.Save();

            curPF.ComputeDynamicFields(CurrentPaymentAdvice);
            curPF.Save();

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

            CurrentPaymentAdvice.Save();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //SECURITY CHECK HERE

        if (!Page.IsPostBack)
        {

            hdnPaymentAdviceId.Value =Request.QueryString["paId"];
            hdnPaLockKey.Value = Request.QueryString["paLockKey"];
            if (!string.IsNullOrEmpty(Request.QueryString["regId"]))
            {
                hdnRegularId.Value = Request.QueryString["regId"];
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["ofId"]))
            {
                hdnOtherFeeId.Value = Request.QueryString["ofId"];
            }

            txtSearch.Attributes.Add("onkeypress", "allowAlphaNumeric()");

        }

        pMgr = new PaymentAdviceManager(hdnPaLockKey.Value);
        pMgr.SelectPaymentAdvice(Convert.ToInt64(hdnPaymentAdviceId.Value));
        if (!string.IsNullOrEmpty(hdnRegularId.Value))
        {
            curPF = pMgr.CurrentPaymentAdvice.ClassFees[Convert.ToInt32(hdnRegularId.Value)];
        }
        else
        {
            curPF = pMgr.CurrentPaymentAdvice.OtherFees[Convert.ToInt64(hdnOtherFeeId.Value)];
        }

        if(!Page.IsPostBack)
        {
            InitPage();
        }
    }