public void MembershipPolicyUpdate_Test()
        {
            MembershipPolicy membershipPolicy = linkWebDB.MembershipPolicies.FirstOrDefault();

            membershipPolicy.UpdateMembershipPolicy(
                "First Default Membership Policy", "Testing2", 5M, 150M, 25M, 1, 0, 3, 10000M, 12, 50M);

            Assert.AreEqual("First Default Membership Policy", linkWebDB.MembershipPolicies.FirstOrDefault().Name);
            Assert.AreEqual("Testing2", linkWebDB.MembershipPolicies.FirstOrDefault().Description);
        }
        public void MembershipPolicy_Test()
        {
            MembershipPolicy newMembershipPolicy = MembershipPoliciesExtension.CreateNewMembershipPolicy(
                "Default Membership Policy", "Testing", 5M, 150M, 25M, 1, 0, 3, 10000M, 12, 50M);

            linkWebDB.MembershipPolicies.Add(newMembershipPolicy);
            linkWebDB.SaveChanges();

            Assert.AreEqual(newMembershipPolicy.GUID, linkWebDB.MembershipPolicies.FirstOrDefault().GUID);
        }
Exemple #3
0
 public static void UpdateMembershipPolicy(this MembershipPolicy policyToUpdate,
                                           string name, string description,
                                           decimal monthlyFee, decimal membershipFee, decimal waybillCharge,
                                           int maxPickupWayBillPerMonth, int maxDeliveryWayBillPerMonth, int maxBillEntries,
                                           decimal insurance, int membershipMaturityInMonths, decimal penaltyCharge)
 {
     policyToUpdate.Name                       = name;
     policyToUpdate.Description                = description;
     policyToUpdate.MonthlyFee                 = monthlyFee;
     policyToUpdate.MembershipFee              = membershipFee;
     policyToUpdate.WayBillCharge              = waybillCharge;
     policyToUpdate.MaxPickupWayBillPerMonth   = maxPickupWayBillPerMonth;
     policyToUpdate.MaxDeliveryWayBillPerMonth = maxDeliveryWayBillPerMonth;
     policyToUpdate.MaxBillEntries             = maxBillEntries;
     policyToUpdate.Insurance                  = insurance;
     policyToUpdate.MembershipMaturityInMonths = membershipMaturityInMonths;
     policyToUpdate.PenaltyCharge              = penaltyCharge;
 }
        public static PolicySubscription ApplyMembershipPolicyOnCustomerAddress(this CustomerAccountAddress currentAddress,
                                                                                MembershipPolicy currentPolicy,
                                                                                DateTime subscriptionDate, DateTime nextRenewalDate, DateTime nextMonthlyFeePaymentDate)
        {
            PolicySubscription newPolicySubscription = new PolicySubscription();

            newPolicySubscription.GUID       = Guid.NewGuid().ToString();
            newPolicySubscription.PolicyGUID = currentPolicy.GUID;
            newPolicySubscription.CustomerAccountAddressGUID = currentAddress.GUID;
            newPolicySubscription.SubscriptionDate           = subscriptionDate;
            newPolicySubscription.NextRenewalDate            = nextRenewalDate;
            newPolicySubscription.NextMonthlyFeePaymentDate  = nextMonthlyFeePaymentDate;

            newPolicySubscription.MembershipPolicy       = currentPolicy;
            newPolicySubscription.CustomerAccountAddress = currentAddress;

            return(newPolicySubscription);
        }
Exemple #5
0
        public static MembershipPolicy CreateNewMembershipPolicy(string name, string description,
                                                                 decimal monthlyFee, decimal membershipFee, decimal waybillCharge,
                                                                 int maxPickupWayBillPerMonth, int maxDeliveryWayBillPerMonth, int maxBillEntries,
                                                                 decimal insurance, int membershipMaturityInMonths, decimal penaltyCharge)
        {
            MembershipPolicy newMembershipPolicy = new MembershipPolicy();

            newMembershipPolicy.GUID                       = Guid.NewGuid().ToString();
            newMembershipPolicy.Name                       = name;
            newMembershipPolicy.Description                = description;
            newMembershipPolicy.MonthlyFee                 = monthlyFee;
            newMembershipPolicy.MembershipFee              = membershipFee;
            newMembershipPolicy.WayBillCharge              = waybillCharge;
            newMembershipPolicy.MaxPickupWayBillPerMonth   = maxPickupWayBillPerMonth;
            newMembershipPolicy.MaxDeliveryWayBillPerMonth = maxDeliveryWayBillPerMonth;
            newMembershipPolicy.MaxBillEntries             = maxBillEntries;
            newMembershipPolicy.Insurance                  = insurance;
            newMembershipPolicy.MembershipMaturityInMonths = membershipMaturityInMonths;
            newMembershipPolicy.PenaltyCharge              = penaltyCharge;

            return(newMembershipPolicy);
        }
        public static void UpdateMemberhipPolicyOnCustomerAddress(this CustomerAccountAddress currentAddress,
                                                                  PolicySubscription subscribedPolicy, MembershipPolicy policyToAssign,
                                                                  DateTime nextRenewalDate, DateTime nextMonthlyFeePaymentDate)
        {
            subscribedPolicy.PolicyGUID = policyToAssign.GUID;
            subscribedPolicy.CustomerAccountAddressGUID = currentAddress.GUID;
            subscribedPolicy.NextRenewalDate            = nextRenewalDate;
            subscribedPolicy.NextMonthlyFeePaymentDate  = nextMonthlyFeePaymentDate;

            subscribedPolicy.MembershipPolicy       = policyToAssign;
            subscribedPolicy.CustomerAccountAddress = currentAddress;
        }