public EnrolleePlan(PrimaryEnrollee primary, InsurancePlan plan) { // identifiers this.Plan = plan; this.PrimaryEnrollee = primary.Id; this.Type = plan.Type; this.Dependents = new List <int>(); this.Charges = new List <Bill>(); // start at the top of the plan this.PYMBRemainder = plan.PYMB; this.APDRemainder = plan.APD; this.OPMFRemainder = plan.OPMFamily; }
/// <summary> /// Change the insurance plan attached to this EnrolleePlan to /// something different /// </summary> /// <param name="plan"></param> public void ChangeTo(InsurancePlan plan) { var now = DateTime.Now; // get current PCY DateTime thisPCY; if (now.Month > 6) { thisPCY = new DateTime(now.Year, PCY.Month, PCY.Day); } else { thisPCY = new DateTime(now.Year - 1, PCY.Month, PCY.Day); } // changes can only be done once per PCY if (now.Month > 6 && LastChange?.Year == thisPCY.Year || now.Month < 6 && LastChange?.Year == thisPCY.Year + 1) { throw new ArgumentException("You can only change plans once per PCY"); } this.OPMFRemainder = plan.OPMFamily; this.OPMIRemainder = plan.OPMIndividual; // throw an error if null insurance plan if (plan == null) { throw new NullReferenceException("The insurance plan selected can not be null"); } // an enrollee can oly change their plan once per calender year this.Type = plan.Type; this.PYMBRemainder = plan.PYMB; this.APDRemainder = plan.APD; this.OPMFRemainder = plan.OPMFamily; // not the first month of the PCY, so there is a charge if (DateTime.Now.Month != PCY.Month) { // charge the primary change fee once and the dependent fee for // each dependent this.AddCharge(plan.PrimaryChangeFee); foreach (int dependent in Dependents) { this.AddCharge(plan.DependentChangeFee); } } this.LastChange = now; }
/// <summary> /// Database constructor /// </summary> /// <param name="apdRemainder"></param> /// <param name="lastCharge"></param> /// <param name="totalCost"></param> /// <param name="opmRemainder"></param> /// <param name="pymbRemainder"></param> public EnrolleePlan(int pid, InsurancePlan plan, DateTime lastCharge, int planNum, double totalCost, double opmRemainder, double pymbRemainder, double apdRemainder) { this.Plan = plan; this.Type = plan.Type; this.PrimaryEnrollee = pid; this.PlanNum = planNum; this.APDRemainder = apdRemainder; this.LastChange = lastCharge; this.PYMBRemainder = pymbRemainder; this.APDRemainder = apdRemainder; this.TotalCost = totalCost; this.OPMFRemainder = opmRemainder; this.Charges = new List <Bill>(); this.Dependents = new List <int>(); }