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; }
public virtual void RemoveClassFee(ClassFee cFee) { cFee.Delete(); ClassFees.Remove(cFee.IdRegular); }
public virtual void AddClassFee(ClassFee cFee) { if (Id <= 0) throw new ApasInvaidOperationException( "Invalid Operation: Unable to add ClassFee to PaymentAdvice " + "before PaymentAdvice is persisted."); cFee.IdPaymentAdvice = Id; ClassFees.Add(cFee.IdRegular, cFee); }
/// <summary> /// Create "new" ClassFee from a template previoius ClassFee /// </summary> /// <param name="parentPaymentAdvice">Parent PaymentAdvice: must assign to create ClassFee</param> /// <param name="prevClassFee">Template previous ClassFee to copy necessary fields from</param> public ClassFee(PaymentAdvice parentPaymentAdvice, ClassFee prevClassFee) { ApasConfigurationManager cfg = new ApasConfigurationManager(); if (parentPaymentAdvice == null) throw new ApasInvaidOperationException( "Invalid Operation: Unable to create a ClassFee without " + "a vailid parent PaymentAdvice."); if (prevClassFee == null || prevClassFee.Validate().Count>0) throw new ApasInvaidOperationException( "Invalid Operation: Unable to create a ClassFee. Given " + "ClassFee template is not valid."); IdRegular = prevClassFee.IdRegular; Id = 0; PrivateRemark = prevClassFee.PrivateRemark; PublicRemark = prevClassFee.PublicRemark; ColorCode = prevClassFee.ColorCode ; Absence = 0; Prorate = 0; Makeup = 0; Forfeit = 0; Credit = 0; CreditAdjustment = 0; NextMonthCredit = 0; PayableCredit = 0; PerLessonFee = 0; PayableFee = 0; PaymentAdviceText = null; IsExcluded = 0; FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>(); if (prevClassFee.Status.Name == "Withdrawn: Unapproved" || prevClassFee.Status.Name == "Withdrawn: Approved") { Status = ClassFeeStatus.ClassFeeStatusDictionary["New: Unapproved"]; ColorCode = cfg.getConfigValue("DefaultNewColor"); } else Status = ClassFeeStatus.ClassFeeStatusDictionary["Normal"]; parentPaymentAdvice.AddClassFee(this); Save(); foreach (FeeDeviationPayableFee fd in prevClassFee.FeeDeviations.Values) { if (fd.IsRecurring == 1) { FeeDeviationPayableFee newFD = new FeeDeviationPayableFee(this, fd); newFD.Save(); } } }