示例#1
0
        public ClassFeeView ConvertClassFee(ClassFee input)
        {
            ClassFeeView output = new ClassFeeView();

            output.Absence = input.Absence;
            output.ColorCode = input.ColorCode;
            output.Credit = input.Credit;
            output.CreditAdjustment = input.CreditAdjustment;

            output.FeeDeviations = new ArrayList();
            foreach (FeeDeviationPayableFee objFD in input.FeeDeviations.Values)
            {
                FeeDeviationPayableFeeView newFD =
                    ConvertFeeDeviationPayableFee(objFD, input.FeeBeforeDeviations);
                output.FeeDeviations.Add(newFD);
            }

            output.Forfeit = input.Forfeit;
            output.Id = input.Id;
            output.IdPaymentAdvice = input.IdPaymentAdvice;
            output.IsExcluded = (input.IsExcluded==1);
            output.Makeup = input.Makeup;
            output.NextMonthCredit = input.NextMonthCredit;
            output.PayableCredit = input.PayableCredit;
            output.PayableFee = input.PayableFee;
            output.PaymentAdviceText = input.PaymentAdviceText;
            output.PerLessonFee = input.PerLessonFee;
            output.Prorate = input.Prorate;
            output.Status = input.Status.Name;

            output.PrivateRemark = (input.PrivateRemark == null) ? "" : input.PrivateRemark;
            output.PublicRemark = (input.PublicRemark == null) ? "" : input.PublicRemark;

            output.RegularClass =
                ConvertRegular(input.GetAssociatedClass());

            return output;
        }
示例#2
0
        //DEPRECATED
        /*
        public void UpdateFeeDeviations(PaymentAdviceView obj)
        {
            if (_CurrentPaymentAdvice == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Select a payment advice before updating fee deviations");

            ClassFee tempCF;
            FeeDeviationPayableFee tempFD;
            OtherFee tempOF;

            foreach (ClassFeeView objCFV in obj.ClassFees)
            {
                if (_CurrentPaymentAdvice.ClassFees.TryGetValue(
                    objCFV.RegularClass.Id, out tempCF))
                {
                    foreach (FeeDeviationPayableFeeView objFDV in objCFV.FeeDeviations)
                    {
                        if (tempCF.FeeDeviations.TryGetValue
                            (objFDV.FeeDeviation.Id, out tempFD))
                        {
                            tempFD.IsRecurring = objFDV.IsRecurring ? 1 : 0;
                            tempFD.Value = objFDV.Value;
                            tempFD.Save();
                        }
                    }

                }
            }

            foreach (OtherFeeView objOFV in obj.OtherFees)
            {
                if (_CurrentPaymentAdvice.OtherFees.TryGetValue(
                    objOFV.Id, out tempOF))
                {
                    foreach (FeeDeviationPayableFeeView objFDV in objOFV.FeeDeviations)
                    {
                        if (tempOF.FeeDeviations.TryGetValue
                            (objFDV.FeeDeviation.Id, out tempFD))
                        {
                            tempFD.IsRecurring = objFDV.IsRecurring ? 1 : 0;
                            tempFD.Value = objFDV.Value;
                            tempFD.Save();
                        }
                    }

                }
            }

            //log
            CurrentPaymentAdvice.LastAction = "Edit Fee Deviations";
            CurrentPaymentAdvice.LastModifiedBy =
                ApasAccessControlManager.GetCurrentInstance().LogonUser.Id;
            CurrentPaymentAdvice.LastModifiedTime = DateTime.Now;
            CurrentPaymentAdvice.Save();

        }*/
        public void UpdateClassFee(ClassFeeView obj)
        {
            //SECURITY CHECK HERE

            if (_CurrentPaymentAdvice == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Select a payment advice before updating its properties");

            ClassFee tempCF;

            if (_CurrentPaymentAdvice.ClassFees.TryGetValue(
                obj.RegularClass.Id, out tempCF))
            {
                //read the values first
                tempCF.ColorCode = obj.ColorCode;
                tempCF.CreditAdjustment = obj.CreditAdjustment;
                tempCF.IsExcluded = obj.IsExcluded ? 1 : 0;
                tempCF.NextMonthCredit = obj.NextMonthCredit;
                tempCF.PrivateRemark = obj.PrivateRemark;
                tempCF.PublicRemark = obj.PublicRemark;

                //Validations
                List<string> eList;
                eList = _CurrentPaymentAdvice.Validate();
                if (eList.Count > 0)
                    throw new ApasValidationException(
                        "Validation Error: Unable to save payment advice because " +
                        "it is not valid. ", eList);

                eList = tempCF.Validate();
                if (eList.Count > 0)
                    throw new ApasValidationException(
                        "Validation Error: Unable to save payment advice because " +
                        "one of its class fees is not valid. ", eList);

                //syncing, locking to be done *ATTENTION*
                tempCF.ComputeDynamicFields(_CurrentPaymentAdvice);

                //save
                tempCF.Save();

                //log
                _CurrentPaymentAdvice.LastAction = "Edit ClassFee";
                _CurrentPaymentAdvice.LastModifiedBy =
                    ApasAccessControlManager.GetCurrentInstance().LogonUser.Id;
                _CurrentPaymentAdvice.LastModifiedTime = DateTime.Now;

                _CurrentPaymentAdvice.Save();
            }
        }
    public ClassFeeView UpdateClassFee(ClassFeeView obj, string lockKey)
    {
        //ClassFeeView obj =(ClassFeeView) AjaxPro.JavaScriptDeserializer.DeserializeFromJson(jsonString, typeof(ClassFeeView));

            PaymentAdviceManager pMgr = new PaymentAdviceManager(obj.IdPaymentAdvice, lockKey);
            pMgr.UpdateClassFee(obj);
            return pMgr.GetClassFee(obj.RegularClass.Id);
    }