/// <summary>
 /// Deprecated Method for adding a new object to the wsQPlans EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTowsQPlans(wsQPlan wsQPlan)
 {
     base.AddObject("wsQPlans", wsQPlan);
 }
        public void SaveEnrolledPlan(List<Pet> lstPets, short paymentFrequency)
        {
            wsQPlan dbQPlan = null;
            int QPlanId = 0;
            foreach (Pet p in lstPets)
            {
                bool bAdd = false;
                if (p.QPlanId == 0)
                {
                    dbQPlan = new wsQPlan();
                    bAdd = true;
                    dbQPlan.CreateDate = DateTime.Now;
                }
                else
                {
                    QPlanId = p.QPlanId;
                    dbQPlan = GetQPlanById(QPlanId);
                }
                if (dbQPlan != null)
                {
                    dbQPlan.Deductible = p.DeductibleAmount;
                    dbQPlan.LeadId = p.LeadId;
                    dbQPlan.PlanId = p.PlanId;
                    dbQPlan.PlanTypeId = int.Parse(p.PlanType);
                    dbQPlan.PlanName = p.PlanName;
                    dbQPlan.PolicyNumber = p.PolicyNumber;
                    dbQPlan.QuoteId = p.QuoteId;
                    dbQPlan.Reimbursement = p.Reimbursement;
                    dbQPlan.Limit = p.LimitAmount;
                    dbQPlan.RiderBreeders = p.Breeder;
                    dbQPlan.RiderHereditary100 = false;
                    dbQPlan.RiderHereditary25 = false;
                    switch(p.Hereditary.ToLower())
                    {
                        case "hereditary100":
                        dbQPlan.RiderHereditary100 = true;
                        break;
                        case "hereditary25":
                        dbQPlan.RiderHereditary25 = true;
                        break;
                        default:
                        dbQPlan.RiderHereditary100 = false;
                        dbQPlan.RiderHereditary25 = false;
                        break;
                    }
                    dbQPlan.RiderPrescriptionFood = p.PrescriptionFood;
                    dbQPlan.RiderRoutine125 = false;
                    dbQPlan.RiderRoutine250 = false;
                    dbQPlan.RiderRoutine400 = false;
                    switch (p.Routine.ToLower())
                    {
                        case "routine125":
                            dbQPlan.RiderRoutine125 = true;
                            break;
                        case "routine250":
                            dbQPlan.RiderRoutine250 = true;
                            break;
                        case "routine400":
                            dbQPlan.RiderRoutine400 = true;
                            break;
                        default:
                            dbQPlan.RiderRoutine125 = false;
                            dbQPlan.RiderRoutine250 = false;
                            dbQPlan.RiderRoutine400 = false;
                            break;
                    }

                    dbQPlan.AnnualPayment = p.AnnualPaymentTotal;
                    dbQPlan.FirstMonthPayment = p.FirstMonthPaymentTotal;
                    dbQPlan.FirstMonthTax = p.FirstMonthTax;
                    dbQPlan.RecurringMonthPayment = p.RecurringMonthPaymentTotal;
                    dbQPlan.RecurringMonthTax = p.RecurringMonthTax;
                    dbQPlan.PolicyId= p.PolicyId;
                    if (!bAdd)
                        dbQPlan.ModifyDate = DateTime.Now;
                    else
                        context.wsQPlans.AddObject(dbQPlan);
                    context.SaveChanges();
                    if (QPlanId == 0)
                        QPlanId = dbQPlan.QPlanID;
                }
                break;//only need to save the first only since everything in the group is the same
            }
            //need to set QPlanId
            foreach (Pet p in lstPets)
            {
                p.QPlanId = QPlanId;
            }
        }
 /// <summary>
 /// Create a new wsQPlan object.
 /// </summary>
 /// <param name="qPlanID">Initial value of the QPlanID property.</param>
 /// <param name="riderBreeders">Initial value of the RiderBreeders property.</param>
 /// <param name="riderHereditary100">Initial value of the RiderHereditary100 property.</param>
 /// <param name="riderHereditary25">Initial value of the RiderHereditary25 property.</param>
 /// <param name="riderPrescriptionFood">Initial value of the RiderPrescriptionFood property.</param>
 /// <param name="riderRoutine125">Initial value of the RiderRoutine125 property.</param>
 /// <param name="riderRoutine250">Initial value of the RiderRoutine250 property.</param>
 /// <param name="riderRoutine400">Initial value of the RiderRoutine400 property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 public static wsQPlan CreatewsQPlan(global::System.Int32 qPlanID, global::System.Boolean riderBreeders, global::System.Boolean riderHereditary100, global::System.Boolean riderHereditary25, global::System.Boolean riderPrescriptionFood, global::System.Boolean riderRoutine125, global::System.Boolean riderRoutine250, global::System.Boolean riderRoutine400, global::System.DateTime createDate)
 {
     wsQPlan wsQPlan = new wsQPlan();
     wsQPlan.QPlanID = qPlanID;
     wsQPlan.RiderBreeders = riderBreeders;
     wsQPlan.RiderHereditary100 = riderHereditary100;
     wsQPlan.RiderHereditary25 = riderHereditary25;
     wsQPlan.RiderPrescriptionFood = riderPrescriptionFood;
     wsQPlan.RiderRoutine125 = riderRoutine125;
     wsQPlan.RiderRoutine250 = riderRoutine250;
     wsQPlan.RiderRoutine400 = riderRoutine400;
     wsQPlan.CreateDate = createDate;
     return wsQPlan;
 }