コード例 #1
0
        //[23-02-2009] End Changes for improving performance of CustomerAccount service

        #endregion ctors

        #region inquireAccount
        /// <summary>
        /// This method returns account and statement information for the given account.
        /// </summary>
        /// <param name="accountNumber13"></param>
        /// <returns></returns>
        public Account InquireAccount([RequiredItem()][StringLength(13, 13)][CustomerAccountNumberAttribute()] string accountNumber13)
        {
            BillingLogEntry logEntry = new BillingLogEntry(eBillingActivityType.AccountInquiry, accountNumber13 != null?accountNumber13.PadLeft(16, '0'):string.Empty);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), accountNumber13);
                    validator.Validate();
                    // convert the accountNumber.
                    CustomerAccountNumber accountNumber = (CustomerAccountNumber)TypeDescriptor.GetConverter(
                        typeof(CustomerAccountNumber)).ConvertFrom(accountNumber13);

                    // get the siteid/sitecode information
                    PopulateSiteInfo(accountNumber);
                    logEntry.SiteId = this.SiteId;

                    // setup return
                    Account account = new Account();

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

                    //set the AllowOnlineOrdering flag
                    SetAllowOnlineOrderingFlag(ref account);

                    // all done.
                    return(account);
                }
                catch (ValidationException ve)
                {
                    logEntry.SetError(new ExceptionFormatter(ve).Format());
                    throw;
                }
                catch (BusinessLogicLayerException blle)
                {
                    logEntry.SetError(new ExceptionFormatter(blle).Format());
                    throw;
                }
                catch (Exception e)
                {
                    logEntry.SetError(new ExceptionFormatter(e).Format());
                    throw new UnexpectedSystemException(e);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// This method returns the account address information for the given account.
        /// </summary>
        /// <param name="accountNumber13"></param>
        /// <returns></returns>
        public AccountAddress InquireServiceAddress(
            [RequiredItem()][StringLength(13, 13)]
            [CustomerAccountNumber()] string accountNumber13)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.AccountAddress,
                accountNumber13.PadLeft(16, '0'));

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), accountNumber13);
                    validator.Validate();

                    // convert the accountNumber.
                    CustomerAccountNumber accountNumber = (CustomerAccountNumber)TypeDescriptor.GetConverter(
                        typeof(CustomerAccountNumber)).ConvertFrom(accountNumber13);

                    // setup site information.
                    PopulateSiteInfo(accountNumber);
                    logEntry.SiteId = SiteId;

                    // setup the return
                    AccountAddress accountAddress = new AccountAddress();
                    AccountAdapter adapter        = new AccountAdapter(accountNumber, _userName, _siteId, _siteCode);
                    adapter.Fill(accountAddress);
                    return(accountAddress);
                }
                catch (ValidationException ve)
                {
                    logEntry.SetError(new ExceptionFormatter(ve).Format());
                    throw;
                }
                catch (BusinessLogicLayerException blle)
                {
                    logEntry.SetError(new ExceptionFormatter(blle).Format());
                    throw;
                }
                catch (Exception e)
                {
                    logEntry.SetError(new ExceptionFormatter(e).Format());
                    throw new UnexpectedSystemException(e);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// This method returns account and statement information for the given account.
        /// </summary>
        /// <param name="siteId"></param>
        /// <param name="setTopBoxId"></param>
        /// <returns></returns>
        public Account InquireAccount([RequiredItem()] int siteId, [RequiredItem()][StringLength(1, 16)] string setTopBoxId)
        {
            BillingLogEntry logEntry = new BillingLogEntry(eBillingActivityType.AccountInquiry, siteId, setTopBoxId);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), siteId, setTopBoxId);
                    validator.Validate();

                    //look up the sitecode
                    string siteCode = DalSiteCode.Instance.GetSiteCode(siteId);

                    //get account number
                    string       accountNumber9 = null;
                    DalEquipment dalEquipment   = new DalEquipment();
                    accountNumber9 = dalEquipment.GetAccountFromSetTopBoxId(siteId, siteCode,
                                                                            setTopBoxId).PadLeft(9, '0');

                    if (accountNumber9 == null || accountNumber9 == string.Empty)
                    {
                        throw new InvalidSetTopBoxIdException(string.Format(
                                                                  __setTopBoxIdToAccountNumberException, setTopBoxId));
                    }

                    //look up division for this account
                    DalAccount dalAccount = new DalAccount();
                    CompanyDivisionFranchise companyDivisionFranchise = dalAccount.GetCompanyDivisionFranchise(siteId,
                                                                                                               siteCode, accountNumber9);

                    //turn accountNumber9 into accountNumber13
                    string accountNumber13 = companyDivisionFranchise.Company.ToString().PadLeft(2, '0') + companyDivisionFranchise.Division.ToString().PadLeft(2, '0') + accountNumber9;

                    // convert to CustomerAccountNumber
                    CustomerAccountNumber accountNumber = (CustomerAccountNumber)TypeDescriptor.GetConverter(
                        typeof(CustomerAccountNumber)).ConvertFrom(accountNumber13);

                    // get the siteid/sitecode information
                    PopulateSiteInfo(accountNumber);
                    logEntry.CustomerAccountNumber = accountNumber.AccountNumber16;

                    // setup return
                    Account account = new Account();

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

                    //set the AllowOnlineOrdering flag
                    SetAllowOnlineOrderingFlag(ref account);

                    // all done.
                    return(account);
                }
                catch (ValidationException ve)
                {
                    logEntry.SetError(ve.Message);
                    throw;
                }
                catch (BusinessLogicLayerException blle)
                {
                    logEntry.SetError(new ExceptionFormatter(blle).Format());
                    throw;
                }
                catch (DataSourceException de)
                {
                    logEntry.SetError(de.Message);
                    throw new DataSourceUnavailableException(de);
                }
                catch (Exception e)
                {
                    logEntry.SetError(e.Message);
                    throw new UnexpectedSystemException(e);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// This method returns account and statement information for the given account.
        /// </summary>
        /// <param name="accountNumber9"></param>
        /// <param name="siteId"></param>
        /// <returns></returns>
        public Account InquireAccount([RequiredItem()][StringLength(9, 9)] string accountNumber9, [RequiredItem()] int siteId)
        {
            BillingLogEntry logEntry = new BillingLogEntry(eBillingActivityType.AccountInquiry, accountNumber9 == null?string.Empty:accountNumber9.PadLeft(16, '0'));

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), accountNumber9, siteId);
                    validator.Validate();

                    //log the site id
                    logEntry.SiteId = siteId;

                    //look up the company and division for this account
                    string     siteCode   = DalSiteCode.Instance.GetSiteCode(siteId);
                    DalAccount dalAccount = new DalAccount();
                    CompanyDivisionFranchise companyDivisionFranchise = dalAccount.GetCompanyDivisionFranchise(siteId, siteCode, accountNumber9);

                    //turn accountNumber9 into accountNumber13
                    string accountNumber13 = companyDivisionFranchise.Company.ToString().PadLeft(2, '0') + companyDivisionFranchise.Division.ToString().PadLeft(2, '0') + accountNumber9;

                    // convert to CustomerAccountNumber
                    CustomerAccountNumber accountNumber = (CustomerAccountNumber)TypeDescriptor.GetConverter(
                        typeof(CustomerAccountNumber)).ConvertFrom(accountNumber13);

                    PopulateSiteInfo(accountNumber);

                    //log the account number
                    logEntry.CustomerAccountNumber = accountNumber.AccountNumber16;

                    // setup return
                    Account account = new Account();

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

                    //set the AllowOnlineOrdering flag
                    SetAllowOnlineOrderingFlag(ref account);

                    // all done.
                    return(account);
                }
                catch (ValidationException ve)
                {
                    logEntry.SetError(ve.Message);
                    throw;
                }
                catch (InvalidAccountNumberException ie)
                {
                    logEntry.SetError(ie.Message);
                    throw;
                }
                catch (DataSourceException de)
                {
                    logEntry.SetError(de.Message);
                    throw new DataSourceUnavailableException(de);
                }
                catch (UnexpectedSystemException ue)
                {
                    logEntry.SetError(ue.Message);
                    throw;
                }
                catch (Exception e)
                {
                    logEntry.SetError(e.Message);
                    throw new UnexpectedSystemException(e);
                }
            }
        }