Esempio n. 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);
        }
Esempio n. 2
0
        /// <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();

                }
            }
        }
Esempio n. 3
0
        //need not load this directly. always load through PaymentAdvice
        ///// <summary>
        ///// constructor to load from database
        ///// </summary>
        ///// <param name="key">primary key value of ClassFee</param>
        //public ClassFee(long key)
        //{
        //    Load(key, false);
        //}
        /// <summary>
        /// constructor to create "new" ClassFee
        /// </summary>
        /// <param name="parentPaymentAdvice"></param>
        /// <param name="pIdRegular"></param>
        public ClassFee(PaymentAdvice parentPaymentAdvice, int pIdRegular)
        {
            if (parentPaymentAdvice == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a classfee without " +
                    "a vailid parent PaymentAdvice.");

            if (pIdRegular < 0)
                throw new ApasInvaidOperationException(
                   "Invalid Operation: Unable to create a classfee without " +
                   "a vailid regular class.");

            IdRegular = pIdRegular;

            Id = 0;
            Absence = 0;
            Prorate = 0;
            Makeup = 0;
            Forfeit = 0;
            Credit = 0;
            CreditAdjustment = 0;
            NextMonthCredit = 0;
            PayableCredit = 0;
            PerLessonFee = 0;
            PayableFee = 0;
            PrivateRemark = null;
            PublicRemark = null;
            PaymentAdviceText = null;
            IsExcluded = 0;

            ApasConfigurationManager cfg=new ApasConfigurationManager();
            ColorCode = cfg.getConfigValue("DefaultNewColor");
            Status = ClassFeeStatus.ClassFeeStatusDictionary["New: Unapproved"];
            FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>();

            parentPaymentAdvice.AddClassFee(this);
        }
Esempio n. 4
0
        public virtual void ComputeDynamicFields(PaymentAdvice parent)
        {
            ApasConfigurationManager cfg = new ApasConfigurationManager();

            decimal deviationTotal = 0;

            PayableFee=Amount;

            foreach (FeeDeviationPayableFee objFD in FeeDeviations.Values)
            {
                //objFD returns exact amount. round it before adding to total
                deviationTotal += MyUtils.FormatCurrencyWithRounding(objFD.ComputeNetDeviation(0));//dummy zero, type is "fixed"
            }

            PayableFee += deviationTotal;

            BCStudent student = new BCStudent();
            student.Id = parent.IdStudent ;
            student.loadData();

            PaymentAdviceText = cfg.getConfigValue("PaymentAdviceTemplateOFee");

            //get Config paymentadvice Text template and fill PaymentAdviceText
            PaymentAdviceText =
                PaymentAdviceText
                    .Replace("[Name]", student.FullName)
                    .Replace("[Amount]", String.Format("{0:C}", Amount))
                    .Replace("[Payable Fee]", String.Format("{0:C}", PayableFee))
                    .Replace("[Fee Deviation Total]", String.Format("{0:C}", deviationTotal))
                    .Replace("[Private Remarks]", PrivateRemark)
                    .Replace("[Public Remarks]", PublicRemark)
                    .Replace("[Month]", parent.GetParentPAList().Month.ToString("MMMM"))
                    .Replace("[Year]", parent.GetParentPAList().Month.ToString("yyyy"))
                    .Replace("[Type]", OtherFeeType.Name);
        }
Esempio n. 5
0
        //public ArrayList SearchPaymentAdviceByDay
        //(long idPAList, string strDay, int branchId){
        //    try{
        //        return SearchPaymentAdviceByDayImpl(idPAList, strDay, branchId);
        //    }catch(Exception e){
        //        string source = "APAS";
        //        string log = "Application";
        //        string strEvent = "Exception";
        //        string machine = ".";
        //        if(!EventLog.SourceExists(source,machine)){
        //            EventLog.CreateEventSource(source, log, machine);
        //        }
        //        EventLog eLog = new EventLog(log, machine, source);
        //        eLog.WriteEntry(e.StackTrace);
        //        throw e;
        //    }
        //}
        public ArrayList SearchPaymentAdviceByDay(long idPAList, string strDay, int branchId)
        {
            //1. Create criteria to query PAs in the chosen day
            //2. Aggregate PAs under their principal RegularView
            //2.1. If principal class is not in the chosen day, don't display
            //2.2. If non-principal classes are in the chosen day, add a dummy reference

            ISession ses = NHibernateManager.GetCurrentSession();
            EntityConverter ecov = new EntityConverter();

            Dictionary<int, ApasRegularView> result = new Dictionary<int, ApasRegularView>();
            ApasRegularView pReg;
            ApasRegular tempReg;
            int pRegId;

            PALockManager lMgr = new PALockManager(
               ApasAccessControlManager.GetCurrentInstance().LogonUser.Id,
               PALockKey);

            List<SearchPredicate> criteria = new List<SearchPredicate>();
            StringSearchPredicate sp = new StringSearchPredicate();
            sp.FieldName = "strDayRegular";
            sp.TableName = "Regular";
            sp.Value = strDay;
            sp.PredicateTemplate = " {0} = {1} ";

            criteria.Add(sp);

            IntegerSearchPredicate ip = new IntegerSearchPredicate();
            ip.FieldName = "intIdBranch";
            ip.TableName = "Branch";
            ip.Value = branchId;
            ip.PredicateTemplate = " {0} = {1} ";

            criteria.Add(ip);

            IList<PaymentAdvice> pList = executeQuery(idPAList, criteria);

            //if no result, return
            if (pList.Count == 0)
                return new ArrayList();

            //aggregate PAs under respective ApasRegularViews
            foreach (PaymentAdvice objPA in pList)
            {

                //check if chosen day of week is principal day for the objPA.
                //Principal day = leftmost day of week start from monday
                int[] aryDow = new int[objPA.ClassFees.Count];
                ApasRegular[] aryReg = new ApasRegular[aryDow.Length];

                int i = 0;
                foreach (ClassFee objCF in objPA.ClassFees.Values)
                {
                    tempReg = objCF.GetAssociatedClass();

                    aryDow[i] = convertDow(tempReg.Day);
                    aryReg[i] = tempReg;
                    i++;
                }

                Array.Sort(aryDow, aryReg);

                pRegId = aryReg[0].Id; //principal class Id

                //add all the classes in the chosen day to result dictionary
                foreach (ApasRegular objAR in aryReg)
                {
                    if (objAR.Day.ToLower() == strDay.ToLower() &&
                        !result.ContainsKey(objAR.Id))
                        result.Add(objAR.Id, ecov.ConvertRegular(objAR));
                }

                //check if principal class is in chosen day
                if (result.TryGetValue(pRegId, out pReg))
                {
                    //lock
                    lMgr.Hold(objPA.Id);

                    ses.Evict(objPA);

                    //requery the objPA
                    PaymentAdvice principalPA = new PaymentAdvice(objPA.Id, false, PALockKey);

                    //add to class
                    pReg.PaymentAdvices.Add(ecov.ConvertPaymentAdvice(principalPA));

                }

                foreach (ClassFee objCF in objPA.ClassFees.Values)
                {
                    //add dummy references
                    if (objCF.IdRegular != pRegId &&
                        result.ContainsKey(objCF.IdRegular))
                    {
                        result[objCF.IdRegular].PaymentAdviceReferences.Add
                        (ecov.ConvertPaymentAdviceReference(objPA, ecov.ConvertRegular(aryReg[0])));
                    }
                }

            }

            //put the result into an arraylist
            ArrayList resultArray = new ArrayList();
            foreach (ApasRegularView objARV in result.Values)
            {
                resultArray.Add(objARV);
            }

            return resultArray;
        }
Esempio n. 6
0
        /* OBSOLETE METHOD, new method below */
        /*
        public ArrayList SearchPaymentAdviceByDay
            (long idPAList, string strDay)
        {

            ISession ses = NHibernateManager.GetCurrentSession();
            ITransaction trans;
            EntityConverter ecov=new EntityConverter();

            //string idsToLock="";

            Dictionary<int, ApasRegularView> result = new Dictionary<int, ApasRegularView>();
            ApasRegularView pReg;
            ApasRegular tempReg;
            int pRegId;

            PALockManager lMgr = new PALockManager(
               ApasAccessControlManager.GetCurrentInstance().LogonUser.Id,
               PALockKey);

            //release all previous locks
            lMgr.Release("", new List<SqlParameter>());

            //query
            trans = ses.BeginTransaction();
            IList<PaymentAdvice> pList =
                ses.GetNamedQuery
                ("Apas.Business.ApasSearchManager.SearchPaymentAdviceByDay")
                .SetAnsiString("day", strDay)
                .SetInt64("idPAList", idPAList)
                .List<PaymentAdvice>();
            trans.Commit();

            //if no result, return
            if (pList.Count == 0)
                return new ArrayList();

            //dun lock now because not all the PAs queried are principal records
            ////Lock
            //foreach (PaymentAdvice objPA in pList)
            //{
            //    idsToLock += objPA.Id + ",";
            //}
            //idsToLock = idsToLock.Substring(0, idsToLock.Length - 1);
            //idsToLock = "(" + idsToLock + ")";

            //lMgr.Hold(" WHERE intIdPA in " + idsToLock, new List<SqlParameter>());

            //trans = ses.BeginTransaction();
            ////re-query for updated "hold" status
            //pList =
            //    ses.GetNamedQuery
            //    ("Apas.Business.ApasSearchManager.SearchPaymentAdviceByDay")
            //    .SetAnsiString("day", strDay)
            //    .SetInt64("idPAList", idPAList)
            //    .List<PaymentAdvice>();
            //trans.Commit();

            //do eager fetching, erm.. not necessary
            //foreach (PaymentAdvice objPA in pList)
            //{

            //    //do eager fetching on collections
            //    NHibernateUtil.Initialize(objPA.ClassFees);
            //    NHibernateUtil.Initialize(objPA.OtherFees);
            //}

            //aggregate PAs under respective ApasRegularViews
            foreach (PaymentAdvice objPA in pList)
            {

                //check if chosen day of week is principal day for the objPA.
                //Principal day = leftmost day of week start from monday
                int dow = convertDow(strDay);
                int[] aryDow = new int[objPA.ClassFees.Count];
                ApasRegular[] aryReg = new ApasRegular[aryDow.Length];

                int i = 0;
                foreach (ClassFee objCF in objPA.ClassFees.Values)
                {
                    tempReg = objCF.GetAssociatedClass();

                    aryDow[i] = convertDow(tempReg.Day);
                    aryReg[i] = tempReg;
                    i++;
                }

                Array.Sort(aryDow, aryReg);

                pRegId = aryReg[0].Id ; //principal class Id

                //add all the classes in the chosen day to result dictionary
                foreach (ApasRegular objAR in aryReg)
                {
                    if (objAR.Day.ToLower() == strDay.ToLower() &&
                        !result.ContainsKey(objAR.Id))
                        result.Add(objAR.Id, ecov.ConvertRegular(objAR));
                }

                //check if this PA is in principal class
                if (result.TryGetValue(pRegId, out pReg))
                {
                    //lock
                    lMgr.Hold(objPA.Id);

                    ses.Evict(objPA);

                    //requery the objPA
                    PaymentAdvice principalPA= new PaymentAdvice(objPA.Id, false, PALockKey);

                    //add to class
                    pReg.PaymentAdvices.Add(ecov.ConvertPaymentAdvice(principalPA));

                }

                foreach (ClassFee objCF in objPA.ClassFees.Values)
                {
                    //add dummy references
                    if (objCF.IdRegular != pRegId &&
                        result.ContainsKey(objCF.IdRegular))
                    {
                        result[objCF.IdRegular].PaymentAdviceReferences.Add
                        (ecov.ConvertPaymentAdviceReference(objPA, ecov.ConvertRegular(aryReg[0])));
                    }
                }

            }

            //put the result into an arraylist
            ArrayList resultArray = new ArrayList();
            foreach (ApasRegularView objARV in result.Values)
            {
                resultArray.Add(objARV);
            }

            return resultArray;
        }
        */
        public ArrayList SearchPaymentAdviceByCriteria(long idPAList, List<SearchPredicate> criteria)
        {
            //1. execute the criteria to get PAList
            //2. Aggregate PAList under respective principal RegularClassView
            ISession ses = NHibernateManager.GetCurrentSession();
            EntityConverter ecov = new EntityConverter();

            Dictionary<int, ApasRegularView> result = new Dictionary<int, ApasRegularView>();
            ApasRegularView pReg;
            ApasRegular tempReg;
            int pRegId;

            PALockManager lMgr = new PALockManager(
               ApasAccessControlManager.GetCurrentInstance().LogonUser.Id,
               PALockKey);

            IList<PaymentAdvice> pList = executeQuery(idPAList, criteria);

            //if no result, return
            if (pList.Count == 0)
                return new ArrayList();

            //aggregate PAs under respective ApasRegularViews
            foreach (PaymentAdvice objPA in pList)
            {

                //Principal day = leftmost day of week start from monday
                int[] aryDow = new int[objPA.ClassFees.Count];
                ApasRegular[] aryReg = new ApasRegular[aryDow.Length];

                int i = 0;
                foreach (ClassFee objCF in objPA.ClassFees.Values)
                {
                    tempReg = objCF.GetAssociatedClass();

                    aryDow[i] = convertDow(tempReg.Day);
                    aryReg[i] = tempReg;
                    i++;
                }

                Array.Sort(aryDow, aryReg);

                pRegId = aryReg[0].Id; //principal class Id

                //add principal class to result
                if (!result.ContainsKey(pRegId))
                    result.Add(pRegId, ecov.ConvertRegular(aryReg[0]));

                //add PA under its principal class
                if (result.TryGetValue(pRegId, out pReg))
                {
                    //lock
                    lMgr.Hold(objPA.Id);

                    ses.Evict(objPA);

                    //requery the objPA
                    PaymentAdvice principalPA = new PaymentAdvice(objPA.Id, false, PALockKey);

                    //add to class
                    pReg.PaymentAdvices.Add(ecov.ConvertPaymentAdvice(principalPA));

                }

            }

            //put the result into an arraylist
            ArrayList resultArray = new ArrayList();
            foreach (ApasRegularView objARV in result.Values)
            {
                resultArray.Add(objARV);
            }

            return resultArray;
        }
Esempio n. 7
0
        private void setCurrentPaymentAdvice(PaymentAdvice newPA)
        {
            if (CurrentPaymentAdvice != null)
                NHibernateManager.GetCurrentSession().Evict(CurrentPaymentAdvice);

            _CurrentPaymentAdvice = newPA;
        }
Esempio n. 8
0
 public bool SelectPaymentAdvice(long id)
 {
     try
     {
         PaymentAdvice obj = new PaymentAdvice(id, false, PALockKey);
         setCurrentPaymentAdvice(obj);
         return true;
     }
     catch (ApasObjectNotFoundException ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
         if (rethrow) throw;
         return false;
     }
 }
Esempio n. 9
0
        //This method tightly couples with CORE classes. maybe, reconsider later
        //Nhibernate does not suppport bidirectional association with
        //list collections. No choice but have to ask the parent for studId
        public virtual void SyncDerivedFields(PaymentAdvice parent)
        {
            wsvAttendanceLn.AttendanceLn DBAttln =
                new wsvAttendanceLn.AttendanceLn();

            wsvAttendanceLn.CAttendanceLn[] aryAttln =
                DBAttln.GetAttendanceByStudentClass(parent.IdStudent, IdRegular);

            Absence = 0;
            Prorate = 0;
            if (aryAttln != null)
            {
                foreach (wsvAttendanceLn.CAttendanceLn attln in aryAttln)
                {
                    if (attln.isPresent == 0)
                        Absence++;
                    else if (attln.isPresent == 2)
                        Prorate++;
                }
            }

            //check log for number of forfeits. Very unnatural....
            AdoNetManager db = new AdoNetManager("ForfeitLog");

            String strSQL =
            " SELECT ISNULL(SUM(intCreditForfeitLog),0) FROM ForfeitLog " +
            " WHERE intIdUserForfeitLog=@idStud " +
            " AND intIdClassScheduleForfeitLog=@idClass ";

            db.ClearParameters();
            db.Parameters.Add("@idClass", SqlDbType.Int).Value = IdRegular;
            db.Parameters.Add("@idStud", SqlDbType.Int).Value = parent.IdStudent;

            Forfeit =Convert.ToInt32(db.executeScalar(strSQL));

            wsvMakeupAttendance.MakeupAttendance dbMakeup
                = new wsvMakeupAttendance.MakeupAttendance();
            wsvMakeupAttendance.CMakeupAttendance[] aryMakeup
                = dbMakeup.getMakeupAttendanceByStudent(parent.IdStudent);

            if (aryMakeup == null)
                Makeup = 0;
            else
            {
                foreach (wsvMakeupAttendance.CMakeupAttendance objMakeup in aryMakeup)
                {
                    if (objMakeup.IdAttendanceRegular == IdRegular)
                        Makeup++;
                }
            }

            ApasRegular regClass = GetAssociatedClass();
            PerLessonFee = Convert.ToDecimal(regClass.Fee);

            //get credit from student classshedule
            wsvStudentClassSchedule.StudentClassSchedule dbSC =
                new wsvStudentClassSchedule.StudentClassSchedule();

            wsvStudentClassSchedule.CStudentClassSchedule objSC =
                dbSC.getStudentClassSchedule(parent.IdStudent, IdRegular);

            //offset credit with number of attendances unmarked in this month
            DateTime month = parent.GetParentPAList().Month.AddMonths(-1);

            wsvAttendance.Attendance dbAtt = new wsvAttendance.Attendance();
            wsvAttendance.CAttendance[] aryAtt =
                dbAtt.getAttendancesBetween(regClass.Id,
                new DateTime(month.Year, month.Month, 1),
                new DateTime(month.Year, month.Month, DateTime.DaysInMonth(month.Year, month.Month))
            );
            int dayCount = GetDayCountOf(regClass.Day, regClass.ClassStartDate, month);
            int attCount = (aryAtt == null) ? 0 : aryAtt.Length;
            int unmarkedCount = (dayCount-attCount) < 0 ? 0 : dayCount-attCount;

            Credit = objSC.Credit-unmarkedCount;
        }
Esempio n. 10
0
        public virtual void ComputeDynamicFields(PaymentAdvice parent)
        {
            ApasConfigurationManager cfg=new ApasConfigurationManager();

            decimal deviationTotal=0;

            PayableCredit=NextMonthCredit -Credit +CreditAdjustment;

            PayableFee=PerLessonFee*PayableCredit;

            foreach(FeeDeviationPayableFee objFD in FeeDeviations.Values)
            {
                //objFD returns exact amount. round it before adding to total
                deviationTotal += MyUtils.FormatCurrencyWithRounding(objFD.ComputeNetDeviation(PayableFee));
            }

            PayableFee += deviationTotal;

            PayableFee = MyUtils.FormatCurrencyWithRounding(PayableFee);

            //get Config paymentadvice Text template and fill PaymentAdviceText
            PaymentAdviceText = cfg.getConfigValue("PaymentAdviceTemplateCFee");

            BCStudent student = new BCStudent();
            student.Id = parent.IdStudent;
            student.loadData();

            ApasRegular regClass = GetAssociatedClass();

            PaymentAdviceText =
                PaymentAdviceText
                .Replace("[Name]", student.FullName)
                .Replace("[Subject]", regClass.GetSubject().name)
                .Replace("[Level]", regClass.getLevel().Name)
                .Replace("[Time Start]", regClass.TimeStart.ToString("hh:mm tt"))
                .Replace("[Time End]", regClass.TimeEnd.ToString("hh:mm tt"))
                .Replace("[Day]", regClass.Day)
                .Replace("[Absence]", Convert.ToString(Absence))
                .Replace("[Prorate]", Convert.ToString(Prorate))
                .Replace("[Makeup]", Convert.ToString(Makeup))
                .Replace("[Forfeit]", Convert.ToString(Forfeit))
                .Replace("[Credit]", Convert.ToString(Credit))
                .Replace("[Payable Credit]", Convert.ToString(PayableCredit))
                .Replace("[Next Mth Lessons]", Convert.ToString(NextMonthCredit))
                .Replace("[Credit Adjustment]", Convert.ToString(CreditAdjustment))
                .Replace("[Per Lesson Fee]", String.Format("{0:C}", PerLessonFee))
                .Replace("[Fee Deviation Total]", String.Format("{0:C}", deviationTotal))
                .Replace("[Payable Fee]", String.Format("{0:C}", PayableFee))
                .Replace("[Private Remarks]", PrivateRemark)
                .Replace("[Public Remarks]", PublicRemark)
                .Replace("[Month]", parent.GetParentPAList().Month.ToString("MMMM"))
                .Replace("[Year]", parent.GetParentPAList().Month.ToString("yyyy"));
        }
Esempio n. 11
0
        /// <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();
                }
            }
        }
Esempio n. 12
0
        public PaymentAdviceReferenceView ConvertPaymentAdviceReference(PaymentAdvice input, ApasRegularView refReg)
        {
            PaymentAdviceReferenceView output = new PaymentAdviceReferenceView();

            output.Id = input.Id;
            output.IdPaymentAdviceList = input.IdPaymentAdviceList;
            output.Student=
                ConvertStudent(input.GetAssociatedStudent());
            output.ReferencedRegular = refReg;

            return output;
        }
Esempio n. 13
0
        public PaymentAdviceView ConvertPaymentAdvice(PaymentAdvice input)
        {
            PaymentAdviceView output = new PaymentAdviceView();

            output.ClassFees = new ArrayList();

            foreach (ClassFee objCF in input.ClassFees.Values)
            {
                ClassFeeView newCF =
                    ConvertClassFee(objCF);

                output.ClassFees.Add(newCF);
            }

            output.Id = input.Id;
            output.IdLockHolder = input.IdLockHolder;
            output.IdPaymentAdviceList  = input.IdPaymentAdviceList;
            output.IsExcluded = (input.IsExcluded==1);
            output.IsFrozen = (input.IsFrozen==1);
            output.IsLocked = input.IsLocked;

            if (input.IdLockHolder != null)
            {
                output.LockHolderName = input.GetLockHolder().UserName;
            }

            output.OtherFees = new ArrayList();

            foreach (OtherFee objOF in input.OtherFees.Values)
            {
                OtherFeeView newOF =
                    ConvertOtherFee(objOF);

                output.OtherFees.Add(newOF);
            }

            output.Student =
                ConvertStudent(input.GetAssociatedStudent());

            return output;
        }