예제 #1
0
        /// <summary>
        /// BuildCustomerAccountStatement - Populates customerAccountProfile.Statements
        /// and customerAccountProfile.TotalCurrentBalance
        /// </summary>
        /// <param name="accountNumber9">9 digit account number</param>
        /// <param name="accountNumber">full account number</param>
        /// <param name="customerAccountProfile">Customer account profile object</param>
        /// <returns><void></returns>
        private void BuildCustomerAccountStatement(string accountNumber9, CustomerAccountNumber accountNumber, CustomerAccountProfile customerAccountProfile)
        {
            //Get Statements CurrentAmount, EnrolledInEasyPay, EnrolledInStopPaperBill
            Account account = new Account();

            //get a data access obj to coxprod_commerce
            //DalBillNotification dalBillNotification = new DalBillNotification();

            //// setup adapter and fill account object.
            AccountAdapter adapter = new AccountAdapter(accountNumber, _userName, _siteId, _siteCode);

            adapter.Fill(account);

            double totalCurrentBalance     = 0.00;
            double monthlyRecurringRevenue = 0.0;

            if (account.Statements != null && account.Statements.Count > 0)
            {
                customerAccountProfile.Statements = new List <Cox.BusinessObjects.CustomerAccount.Statement>();

                for (int j = 0; j < account.Statements.Count; j++)
                {
                    bool enrolledInStopPaperBill = false;
                    //bool enrolledInEmailBillReminder = false;

                    if (account.Statements[j].BillingOption == eBillingOption.StopPaper)
                    {
                        enrolledInStopPaperBill = true;
                    }
                    if (account.Statements[j].BillingOption == eBillingOption.WebStopPaper)
                    {
                        enrolledInStopPaperBill = true;
                    }
                    //enrolledInEmailBillReminder = dalBillNotification.GetEnrolledInEmailBillReminder(accountNumber9, _siteId, account.Statements[j].AccountNumber16.Substring(4, 4), account.Statements[j].StatementCode);

                    // Call GetMonthlyServiceAmount
                    DalCustomerAccount dalCustomerAccount = new DalCustomerAccount();
                    CustomerAccountProfileSchema.CustomerMonthlyServiceAmountDataTable customerMonthlyServiceAmountDT = dalCustomerAccount.GetMonthlyServiceAmount(_siteId, accountNumber9);

                    if (customerMonthlyServiceAmountDT != null && customerMonthlyServiceAmountDT.Rows.Count > 0)
                    {
                        customerAccountProfile.TotalMonthlyRecurringRevenue = customerMonthlyServiceAmountDT[0].Total_Monthly_SVC_Amount;

                        for (int i = 0; i < customerMonthlyServiceAmountDT.Count; ++i)
                        {
                            int statementCode   = 0;
                            int statementCodeDT = 0;
                            statementCode   = int.Parse(account.Statements[j].StatementCode);
                            statementCodeDT = int.Parse(customerMonthlyServiceAmountDT[i].Statement_Code);
                            if (statementCode == statementCodeDT)
                            {
                                monthlyRecurringRevenue = customerMonthlyServiceAmountDT[i].StatementCD_Monthly_SVC_Amount;
                            }
                        }
                    }

                    //[05-02-2009] Start Changes for reflecting AR amounts for Q-Matic

                    //customerAccountProfile.Statements.Add(new Cox.BusinessObjects.CustomerAccount.Statement(account.Statements[j].StatementCode, account.Statements[j].AccountNumber16, monthlyRecurringRevenue, account.Statements[j].CurrentBalance, account.Statements[j].EasyPayFlag, enrolledInStopPaperBill, enrolledInEmailBillReminder));

                    customerAccountProfile.Statements.Add(new Cox.BusinessObjects.CustomerAccount.Statement(account.Statements[j].StatementCode,
                                                                                                            account.Statements[j].AccountNumber16, monthlyRecurringRevenue, account.Statements[j].CurrentBalance,
                                                                                                            account.Statements[j].EasyPayFlag, enrolledInStopPaperBill,
                                                                                                            account.Statements[j].AR1To30Amount, account.Statements[j].AR31To60Amount, account.Statements[j].AR61To90Amount, account.Statements[j].AR91To120Amount));

                    //[05-02-2009] Start Changes for reflecting AR amounts for Q-Matic

                    totalCurrentBalance += account.Statements[j].CurrentBalance;
                }
                customerAccountProfile.TotalCurrentBalance = totalCurrentBalance;
            }

            //[23-02-2009] Start Changes for improving performance of CustomerAccount service

            AccountActivity accountActivity = new AccountActivity(_userName, _siteId);

            accountActivity.SetAllowOnlineOrderingFlag(ref account);

            if (account.AllowOnlineOrdering)
            {
                customerAccountProfile.OnlineOrderDelinquentBalance = false;
            }
            else
            {
                customerAccountProfile.OnlineOrderDelinquentBalance = true;
            }

            if (account.OnlineOrderingOptOut != 0)
            {
                customerAccountProfile.OnlineOrderBlock = true;
            }
            else
            {
                customerAccountProfile.OnlineOrderBlock = false;
            }

            //[23-02-2009] End Changes for improving performance of CustomerAccount service
        }