public Commission_DTO Calculate(Registration reg, List <Registration> allRegs)
        {
            Commission_DTO retVal = null;
            // Find percent Discount
            decimal discount = reg.Discount * 100;

            //  multiply discount by reductionRate
            decimal CommissionReduction = discount * _ReductionRate;

            // subtract CommissionReduction from the commission rate
            var FinalRate = Properties.Settings.Default.BaseCommission - CommissionReduction;

            decimal reductionrate        = _ReductionRate * 100;
            decimal commreductionpercent = FinalRate * 100;

            if (FinalRate > 0)
            {
                retVal = new Commission_DTO()
                {
                    CommissionAmount = reg.Course.BasePrice * FinalRate,
                    CommissionType   = "Reduced",
                    Message          = $"({reductionrate:n2} @ {discount:n2}%) = {commreductionpercent:n2}%"
                };
            }
            else
            {
                retVal = new Commission_DTO()
                {
                    CommissionAmount = 0,
                    CommissionType   = "Reduced Comm",
                    Message          = "Discount > max"
                };
            }
            return(retVal);
        }
Beispiel #2
0
        public Commission_DTO Calculate(Registration reg, List <Registration> allRegs)
        {
            Commission_DTO retVal = null;
            // Find percent Discount
            decimal discount = reg.Discount * 100;

            if (discount <= 10)
            {
                retVal = new Commission_DTO()
                {
                    CommissionAmount = reg.Course.BasePrice * Properties.Settings.Default.BaseCommission,
                    CommissionType   = "Discount < 10%",
                    Message          = string.Empty
                };
            }
            else
            {
                retVal = new Commission_DTO()
                {
                    CommissionAmount = 0,
                    CommissionType   = "Discount > 10%",
                    Message          = string.Empty
                };
            }
            return(retVal);
        }
Beispiel #3
0
        public Commission_DTO Calculate(Registration reg, List <Registration> allRegs)
        {
            Commission_DTO returnVal = null;

            if (allRegs.Count >= reg.Course.Capacity)
            {
                //  Find the registration that caused this course to be at cap
                var lastReg = allRegs
                              .OrderByDescending(r => r.CreationDate).Last();

                if (lastReg == reg)
                {
                    returnVal = new Commission_DTO()
                    {
                        CommissionAmount = reg.Course.BasePrice * Properties.Settings.Default.BaseCommission,
                        CommissionType   = "At Capacity",
                        Message          = string.Empty
                    };
                }
            }
            return(returnVal);
        }
Beispiel #4
0
        public Commission_DTO Calculate(Registration reg, List <Registration> allRegs)
        {
            Commission_DTO retVal = null;
            //  has this course reached priority status?
            var PriorityDate = reg.Course.StartDate.AddDays(-10);

            if (reg.CreationDate > PriorityDate)
            {
                var RegistrationsBeforePriorityDate = allRegs.Where(r => r.Course == reg.Course && reg.CreationDate <= PriorityDate).Count();
                int Threshold = (int)(reg.Course.Capacity * .25m);

                if (RegistrationsBeforePriorityDate > Threshold)
                {
                    retVal = new Commission_DTO()
                    {
                        CommissionAmount = reg.Course.BasePrice * .03m,
                        CommissionType   = "Priorty Commission (3%)",
                        Message          = string.Empty
                    };
                }
            }
            return(retVal);
        }