/// <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(); } } }
public virtual void RemoveOtherFee(OtherFee oFee) { oFee.Delete(); OtherFees.Remove(oFee.Id); }
public virtual void AddOtherFee(OtherFee oFee) { if (Id <= 0) throw new ApasInvaidOperationException( "Invalid Operation: Unable to add OtherFee to PaymentAdvice " + "before PaymentAdvice is persisted."); oFee.IdPaymentAdvice = Id; OtherFees.Add(oFee.Id, oFee ); }
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(); }
public OtherFeeView ConvertOtherFee(OtherFee input) { OtherFeeView output = new OtherFeeView(); output.Amount = input.Amount; output.ColorCode = input.ColorCode; output.FeeDeviations = new ArrayList(); foreach (FeeDeviationPayableFee objFD in input.FeeDeviations.Values) { FeeDeviationPayableFeeView newFD = ConvertFeeDeviationPayableFee(objFD, 0); //zero is dummy, otherfees can only have "fixed" fee deviations output.FeeDeviations.Add(newFD); } output.Id = input.Id; output.IdPaymentAdvice = input.IdPaymentAdvice; output.IsExcluded = (input.IsExcluded==1); output.IsPaid = (input.IsPaid==1); output.IsRecurring = (input.IsRecurring==1); output.OtherFeeType = input.OtherFeeType.Name.Trim(); output.PayableFee = input.PayableFee; output.PaymentAdviceText = input.PaymentAdviceText; output.PrivateRemark = (input.PrivateRemark == null) ? "" : input.PrivateRemark; output.PublicRemark = (input.PublicRemark == null) ? "" : input.PublicRemark ; return output; }