Esempio n. 1
0
        //Added new method on 4-Feb-2010
        /// <summary>
        /// GetCustomerAccountProfile
        /// </summary>
        /// <param name="siteId"></param>
        /// <param name="accountNumber9"></param>
        /// <returns></returns>
        private CustomerAccountProfile GetCustomerAccountProfile(int siteId, string accountNumber9)
        {
            /// set the siteid/sitecode information
            PopulateSiteInfo(siteId);
            DalAccount dalAccount = new DalAccount();

            if (!dalAccount.IsAccountNumberValid(siteId, accountNumber9))
            {
                throw new Cox.BusinessLogic.Exceptions.InvalidAccountNumberException();
            }
            CompanyDivisionFranchise cdf = new CompanyDivisionFranchise();

            try
            {
                cdf = dalAccount.GetCompanyDivisionFranchise(_siteId,
                                                             _siteCode, accountNumber9);
            }
            catch (Exception e)
            {
                throw new DataSourceUnavailableException(e);
            }

            // convert to customerAccountNumber object
            CustomerAccountNumber accountNumber = new CustomerAccountNumber(
                string.Empty, cdf.Company.ToString(), cdf.Division.ToString(),
                accountNumber9);
            DalCustomerAccount dalCustomerAccount = new DalCustomerAccount();

            // call dal

            //[28-01-2009] Start Changes to reflect services for an account
            CustomerAccountProfileSchema customerAccountSchema = dalCustomerAccount.GetAccountProfile(siteId, accountNumber9);

            CustomerAccountProfileSchema.CustomerAccountDataTable customerAccountDT = customerAccountSchema.CustomerAccount;


            CustomerAccountProfileSchema.CustomerServicesDataTable customerServicesDataTable = customerAccountSchema.CustomerServices;

            CustomerAccountProfile customerAccountProfile = new CustomerAccountProfile();

            if (customerAccountDT != null && customerAccountDT.Rows.Count > 0)
            {
                BuildCustomerAccountBase(customerAccountDT, customerAccountProfile);
                BuildCustomerAccountCampaign(siteId, accountNumber9, dalCustomerAccount, customerAccountProfile);
                BuildCustomerAccountStatement(accountNumber9, accountNumber, customerAccountProfile);
                BuildCustomerAccountContract(siteId, accountNumber9, dalCustomerAccount, customerAccountProfile);
                BuildCustomerAccountPhones(siteId, accountNumber9, dalCustomerAccount, customerAccountProfile);
                BuildCustomerAccountPrivacy(siteId, accountNumber9, dalCustomerAccount, customerAccountProfile);
                BuildCustomerAccountCCRMInfo(siteId, accountNumber9, customerAccountProfile);
                BuildContactEmail(siteId, accountNumber9, dalCustomerAccount, customerAccountProfile);

                // [17-05-11] Changes starts here for price lock enhancement
                BuildPriceLockDetails(siteId, accountNumber9, dalCustomerAccount, customerAccountProfile);
                // [17-05-11] Changes ends here for price lock enhancement
            }

            if (customerServicesDataTable != null && customerServicesDataTable.Rows.Count > 0)
            {
                List <AvailableService> services = new List <AvailableService>();

                foreach (CustomerAccountProfileSchema.CustomerServicesRow row in customerServicesDataTable.Rows)
                {
                    services.Add(new AvailableService(DalServiceCategory.Instance.GetServiceCategoryDesc(row.Service_Category_Code), (ServiceStatus)TypeDescriptor.GetConverter(typeof(ServiceStatus)).ConvertFrom(row.ServiceStatus)));
                }
                customerAccountProfile.Services = services;
            }

            //[28-01-2009] End Changes to reflect services for an account

            // Changes for Self Reg Ernest Griffin **START**//
            //Account account = new Account();

            //AccountActivity accountActivity = new AccountActivity(_userName);
            //account = accountActivity.InquireAccount(accountNumber9, siteId);

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

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