Exemple #1
0
        /// <summary>
        /// This method returns the account address information for the given Phone Number.
        /// </summary>
        /// <param name="phoneNumber10"></param>
        /// <returns></returns>
        public List <CustomerContactInformation> getAccountAddressesbyPhoneNumber(
            [RequiredItem()][StringLength(10, 10)][RegEx(@"\d{10}", RegexOptions.Compiled)] string phoneNumber10,
            bool getNeverAndFormerAsWell)
        {
            //create log and begin logging
            CustomerAccountLogEntry logEntry = new CustomerAccountLogEntry(eCustomerAccountActivityType.GetCustomerAccountInformation, phoneNumber10);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    //Assigned note property of logEntry object to log the phonenumber10 on 4-Feb-2010
                    logEntry.Note = "PhoneNumber10:" + phoneNumber10;
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), phoneNumber10);
                    validator.Validate();
                    try
                    {
                        if (Convert.ToUInt64(phoneNumber10) == 0)
                        {
                            throw new Exception();
                        }
                    }
                    catch
                    {
                        throw new ValidationException("Invalid PhoneNumber");
                    }

                    // setup the return
                    List <CustomerContactInformation> contactInformation = new List <CustomerContactInformation>();
                    CustomerAccountInfo.MultipleReturns(contactInformation, phoneNumber10, getNeverAndFormerAsWell);
                    return(contactInformation);
                }
                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);
                }
            }
        }
Exemple #2
0
        /// <summary>GetCustomerAcount</summary>
        /// <param name="siteId">Site Id for the customer</param>
        /// <param name="accountNumber9">9 digit customer account</param>
        /// <returns><CategoryActiveOutage></returns>
        public CustomerAccountProfile GetCustomerAcount(
            [RequiredItem()][SiteId()] int siteId,
            [RequiredItem()][RegEx(@"^(\d{7}(?<=\d*?[1-9]{1}\d*?)(?=\d*?[1-9]{1}\d*?)\d{2})?$", RegexOptions.None)] string accountNumber9)
        {
            //create log and begin logging
            CustomerAccountLogEntry logEntry = new CustomerAccountLogEntry(eCustomerAccountActivityType.GetCustomerAccountByAccountNumberAndSiteId, siteId, accountNumber9);

            using (Log log = CreateLog(logEntry))

                try
                {
                    //perform validation
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), siteId, accountNumber9);
                    validator.Validate();

                    //start changes for activity logging on 4-Feb-2010
                    logEntry.SiteId = siteId;
                    //get a data access obj to work with
                    CustomerAccountProfile customerAccountProfile = GetCustomerAccountProfile(siteId, accountNumber9);
                    //End changes for activity logging on 4-Feb-2010
                    // Changes for Self Reg **END**//
                    return(customerAccountProfile);
                }
                catch (ValidationException vex)
                {
                    logEntry.SetError(new ExceptionFormatter(vex).Format());
                    throw vex;
                }
            catch (BusinessLogicLayerException bllex)
            {
                logEntry.SetError(new ExceptionFormatter(bllex).Format());
                throw bllex;
            }
            catch (DataSourceException dse)
            {
                logEntry.SetError(new ExceptionFormatter(dse).Format());
                throw new DataSourceUnavailableException(dse);
            }
            catch (Exception e)
            {
                logEntry.SetError(new ExceptionFormatter(e).Format());
                //need to convert to bll exception
                throw new UnexpectedSystemException(e);
            }
        }
Exemple #3
0
        //[02-02-09] Start Changes for Q-matic

        #region GetCustomerAccountByAccountNumber

        /// <summary>
        ///
        /// </summary>
        /// <param name="accountNumber13"></param>
        /// <returns></returns>
        public CustomerAccountProfile GetCustomerAccountByAccountNumber([RequiredItem()][StringLength(13, 13)][CustomerAccountNumberAttribute()] string accountNumber13)
        {
            //create log and begin logging
            CustomerAccountLogEntry logEntry = new CustomerAccountLogEntry();

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    logEntry.CustomerAccountActivityType =
                        eCustomerAccountActivityType.GetCustomerAccountByAccountNumber;
                    logEntry.CustomerAccountNumber = accountNumber13;
                    // 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;
                    string accountNumber9 = accountNumber13.Substring(4);
                    return(GetCustomerAccountProfile(SiteId, accountNumber9));
                }
                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);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// This method returns the account address information for the given Phone Number.
        /// </summary>
        /// <param name="phoneNumber10"></param>
        /// <param name="streetNumber"></param>
        /// <returns></returns>
        public CustomerAccountProfile GetCustomerAccountByPhoneNbrAndStreetNbr([RequiredItem()][StringLength(10, 10)][RegEx(@"\d{10}", RegexOptions.Compiled)] string phoneNumber10
                                                                               , string streetNumber)
        {
            //create log and begin logging
            CustomerAccountLogEntry logEntry = new CustomerAccountLogEntry(eCustomerAccountActivityType.GetCustomerAccountByPhoneNbrAndStreetNbr, phoneNumber10, streetNumber);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    logEntry.Note = "phoneNumber10:" + phoneNumber10 + " and street#:" + streetNumber;
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), phoneNumber10);
                    validator.Validate();
                    try
                    {
                        if (Convert.ToUInt64(phoneNumber10) == 0)
                        {
                            throw new ValidationException();
                        }
                    }
                    catch
                    {
                        throw new ValidationException("Invalid Phonenumber");
                    }

                    //create dal to get customer accounts for given phone number ad street address
                    DalCustomerPhone dalCustomerPhone = new DalCustomerPhone();
                    CustomerAccountProfileSchema.AccountMatchesDataTable accountMatches = dalCustomerPhone.GetCustomerAccountMatches(phoneNumber10, streetNumber);

                    if (String.IsNullOrEmpty(streetNumber))
                    {
                        if (accountMatches.Rows.Count > 1)
                        {
                            throw new MultipleMatchsFoundException(String.Format(_multipleMatchesWithPhoneOnly, phoneNumber10));
                        }
                        else if (accountMatches.Rows.Count == 0)
                        {
                            throw new NoMatchFoundException(String.Format(_noMatchWithPhoneOnly, phoneNumber10));
                        }
                        else
                        {
                            return(GetCustomerAccountProfile(accountMatches[0].Site_ID,
                                                             accountMatches[0].Account_Number));
                        }
                    }
                    else
                    {
                        if (accountMatches.Rows.Count > 1)
                        {
                            throw new MultipleMatchsFoundException(String.Format(_multipleMatchesWithStreet, phoneNumber10, streetNumber));
                        }
                        else if (accountMatches.Rows.Count == 0)
                        {
                            throw new NoMatchFoundException(String.Format(_noMatchWithStreet, phoneNumber10, streetNumber));
                        }
                        else
                        {
                            return(GetCustomerAccountProfile(accountMatches[0].Site_ID,
                                                             accountMatches[0].Account_Number));
                        }
                    }
                }
                catch (ValidationException ve)
                {
                    logEntry.SetError(new ExceptionFormatter(ve).Format());
                    throw;
                }
                catch (InvalidAccountNumberException)
                {
                    logEntry.SetError(new ExceptionFormatter(new NoMatchFoundException(String.Format(_noMatchWithPhoneOnly, phoneNumber10))).Format());
                    throw new NoMatchFoundException(String.Format(_noMatchWithPhoneOnly, phoneNumber10));
                }
                catch (BusinessLogicLayerException blle)
                {
                    logEntry.SetError(new ExceptionFormatter(blle).Format());
                    throw;
                }
                catch (Exception e)
                {
                    logEntry.SetError(new ExceptionFormatter(e).Format());
                    throw new UnexpectedSystemException(e);
                }
            }
        }