public static decimal AddDaysToRenewalDate(this CustomerAccountAddress currentAddress, int numberOfMonths)
        {
            decimal returnValue = 0.0M;

            if (currentAddress.PolicySubscriptions.FirstOrDefault() != null && currentAddress.PolicySubscriptions.Count() >= 1)
            {
                PolicySubscription currentSubsriptionPolicy = currentAddress.PolicySubscriptions.FirstOrDefault();

                int numberOfRenewal = numberOfMonths / currentSubsriptionPolicy.MembershipPolicy.MembershipMaturityInMonths;

                if (numberOfMonths > 0)
                {
                    returnValue += numberOfRenewal * currentSubsriptionPolicy.MembershipPolicy.MembershipFee;
                }

                returnValue += currentSubsriptionPolicy.MembershipPolicy.MonthlyFee * numberOfMonths;

                return(returnValue);
            }

            else
            {
                return(returnValue);
            }
        }
        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;
        }
        public static bool IsCustomerAddressMontlyFeePaid(this CustomerAccountAddress currentAddress)
        {
            if (currentAddress.PolicySubscriptions.FirstOrDefault() != null && currentAddress.PolicySubscriptions.Count() >= 1)
            {
                PolicySubscription currentSubsriptionPolicy = currentAddress.PolicySubscriptions.FirstOrDefault();

                return(DateTime.Now.Date <= currentSubsriptionPolicy.NextMonthlyFeePaymentDate.Date);
            }

            else
            {
                return(false);
            }
        }
        public static bool IsCustomerAddressMembershipPolicyExpired(this CustomerAccountAddress currentAddress)
        {
            if (currentAddress.PolicySubscriptions.FirstOrDefault() != null && currentAddress.PolicySubscriptions.Count() >= 1)
            {
                PolicySubscription currentSubsriptionPolicy = currentAddress.PolicySubscriptions.FirstOrDefault();

                return(DateTime.Now.Date <= currentSubsriptionPolicy.NextRenewalDate.Date);
            }

            else
            {
                return(false);
            }
        }
        public static CustomerAccountAddress AddCustomerAddress(this CustomerAccount currentCustomer,
            string billingAddress, string billingAddressAccountID, string billingAddressContact, string billingAddressNotes)
        {
            CustomerAccountAddress newCustomerAddress = new CustomerAccountAddress();
            newCustomerAddress.GUID = Guid.NewGuid().ToString();
            newCustomerAddress.CustomerAccountID = currentCustomer.GUID;
            newCustomerAddress.BillingAddress = billingAddress;
            newCustomerAddress.BillingAddressAccountID = billingAddressAccountID;
            newCustomerAddress.BillingAddressContact = billingAddressContact;
            newCustomerAddress.BillingAddressNotes = billingAddressNotes;

            newCustomerAddress.CustomerAccount = currentCustomer;

            return newCustomerAddress;
        }
Пример #6
0
        public void CustomerAccountUpdate_Test()
        {
            CustomerAccount custAccount1 = linkWebDB.CustomerAccounts.FirstOrDefault();

            CustomerAccountAddress address1 = custAccount1.CustomerAccountAddresses.ElementAt(1);
            CustomerAccountAddress address2 = custAccount1.CustomerAccountAddresses.ElementAt(0);

            custAccount1.UpdateCustomerAccount("Rose Lorenze Pepito", "wla lang");
            custAccount1.UpdateCustomerAddress(address1, "Bogu - ambot lang unsai full addresss", "Jose Guingao III", "0915548857", "wala lang");
            custAccount1.UpdateCustomerAddress(address2, "Bogu2 - ambot lang unsai full addresss", "Jose Guingao III", "0915548857", "wala lang");

            linkWebDB.SaveChanges();

            Assert.AreEqual(linkWebDB.CustomerAccounts.FirstOrDefault().Name, "Rose Lorenze Pepito");
            Assert.AreEqual(linkWebDB.CustomerAccounts.FirstOrDefault().CustomerAccountAddresses.ElementAt(1).BillingAddress, "Bogu - ambot lang unsai full addresss");
            Assert.AreEqual(linkWebDB.CustomerAccounts.FirstOrDefault().CustomerAccountAddresses.ElementAt(0).BillingAddress, "Bogu2 - ambot lang unsai full addresss");
        }
Пример #7
0
        public void CustomerAccount_Test()
        {
            CustomerAccount custAccount1 = CustomerAccountsExtension.CreateCustomerAccount("Jose Guingao III", "wla lang");

            CustomerAccountAddress address1 = custAccount1.AddCustomerAddress("Camaman-an", "Jose Guingao III", "0915548857", "wala lang");
            CustomerAccountAddress address2 = custAccount1.AddCustomerAddress("Camaman-an2", "Jose Guingao III2", "09155488572", "wala lang2");

            linkWebDB.CustomerAccounts.Add(custAccount1);
            linkWebDB.CustomerAccountAddresses.Add(address1);
            linkWebDB.CustomerAccountAddresses.Add(address2);

            linkWebDB.SaveChanges();

            Assert.AreEqual(custAccount1.GUID, linkWebDB.CustomerAccounts.FirstOrDefault().GUID);
            Assert.AreEqual(address2.GUID, linkWebDB.CustomerAccounts.FirstOrDefault().CustomerAccountAddresses.ElementAt(1).GUID);
            Assert.AreEqual(address1.GUID, linkWebDB.CustomerAccounts.FirstOrDefault().CustomerAccountAddresses.ElementAt(0).GUID);
        }
        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);
        }
 public static void UpdateCustomerAddress(this CustomerAccount currentCustomer, CustomerAccountAddress addressToUpdate,
     string billingAddress, string billingAddressAccountID, string billingAddressContact, string billingAddressNotes)
 {
     addressToUpdate.CustomerAccountID = currentCustomer.GUID;
     addressToUpdate.BillingAddress = billingAddress;
     addressToUpdate.BillingAddressAccountID = billingAddressAccountID;
     addressToUpdate.BillingAddressContact = billingAddressContact;
     addressToUpdate.BillingAddressNotes = billingAddressNotes;
 }
        public static Transaction CreateTransaction(string transactioinID, CustomerAccount customer, CustomerAccountAddress customerAddress, string billingID,
                                                    EnumTransactionType transactionType, decimal policyWaybillCharge, ServiceType serviceType, decimal serviceTypeCharge,
                                                    decimal vatCharge, string batchTransactionID)
        {
            Transaction newTransaction = new Transaction();

            newTransaction.TransactionID = transactioinID;
            newTransaction.CustomerGUID  = customer.GUID;
            newTransaction.CustomerAccountAddressGUID = customerAddress.GUID;
            newTransaction.BillingAccountID           = billingID;
            newTransaction.TransactionType            = transactionType.ToString();
            newTransaction.PolicyWayBillCharge        = policyWaybillCharge;
            newTransaction.ServiceTypeGUID            = serviceType.GUID;
            newTransaction.ServiceTypeCharge          = serviceTypeCharge;
            newTransaction.TimeStamp          = DateTime.Now;
            newTransaction.VATCharge          = vatCharge;
            newTransaction.BatchTransactionID = batchTransactionID;

            newTransaction.CustomerAccount        = customer;
            newTransaction.CustomerAccountAddress = customerAddress;
            newTransaction.ServiceType            = serviceType;

            return(newTransaction);
        }
 public static bool IsMemberhipPolicyAppliedOnAddress(this CustomerAccountAddress currentAddress)
 {
     return(currentAddress.PolicySubscriptions.FirstOrDefault() != null);
 }