/// <summary>
 /// Constructor that takes a string for initialization.
 /// It expects either a single string character or a
 /// match to one of the underlying eBillingOption values.
 /// </summary>
 /// <param name="billingOption"></param>
 protected void construct(string billingOption)
 {
     try
     {
         int val = int.Parse(billingOption);
         if (Enum.IsDefined(typeof(eBillingOption), val))
         {
             _billingOption = (eBillingOption)val;
         }
     }
     catch { /* Ignore me */ }
 }
        /// <summary>
        /// This method updates the given account with the correct BillingOption code.
        /// </summary>
        /// <param name="accountNumber16"></param>
        /// <param name="billingOption"></param>
        public void UpdateBillingOption(
            [RequiredItem()][CustomerAccountNumber()] string accountNumber16,
            [RequiredItem()] eBillingOption billingOption)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.UpdateBillOption,
                accountNumber16);

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

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

                    // create the proxy
                    CreateProxy(accountNumber);
                    logEntry.SiteId = SiteId;

                    // invoke it. if an error occurs, one will be thrown.
                    Invoke((Request.STOPPB) new StopPbHelper(_siteId.ToString(),
                                                             accountNumber.AccountNumber9, new SpbHelper(
                                                                 toInt32(accountNumber.StatementCode),
                                                                 (int)billingOption, eSpbFunctionAction.Add)));
                }
                catch (CmErrorException eCm)
                {
                    logEntry.SetError(eCm.Message, eCm.ErrorCode);
                    throw TranslateCmException(eCm);
                }
                catch (Exception e)
                {
                    logEntry.SetError(e.Message);
                    throw;
                }
            }
        }
 /// <summary>
 /// Constructor that takes a eBillingOption for initialization.
 /// </summary>
 /// <param name="billingOption"></param>
 public BillingOption(eBillingOption billingOption)
 {
     _billingOption = billingOption;
 }