/// <summary> /// Placeholder for constants /// </summary> #endregion constants #region member variables ///// <summary> ///// Member variable containing _accountNumber object. ///// </summary> //protected CustomerAccountNumber _accountNumber=null; ///// <summary> ///// Member variable containing siteId ///// </summary> //protected int _siteId=0; ///// <summary> ///// Member variable containing siteCode ///// </summary> //protected string _siteCode=null; ///// <summary> ///// Member variable containing username. ///// </summary> //protected string _userName=null; ///// <summary> ///// Member variable containing phone number. ///// </summary> //protected string _phoneNumber = null; #endregion member variables #region ctors /// <summary> /// The default constructor /// </summary> //public CustomerAccountAdapter(string phoneNumber) //{ // // set value // _phoneNumber = phoneNumber; //} #endregion ctors #region public methods #region FillMultiple /// <summary> /// Fills the AccountAddress object - multiple addresses returned. /// </summary> /// <param name="customerContactInformation"></param> /// <param name="phoneNumber10"></param> /// <param name="filter"></param> public static void MultipleReturns(List <CustomerContactInformation> customerContactInformation, string phoneNumber10, bool getNeverAndFormerAsWell) { try { DalCustomerPhone dalCustomerPhone = new DalCustomerPhone(); CustomerAccountProfileSchema.AccountMatchesDataTable accountMatches = dalCustomerPhone.GetCustomerAccountMatches(phoneNumber10, getNeverAndFormerAsWell); //Check if any account matches were found if (accountMatches.Rows.Count > 0) { //Get CSV string containing pairs of siteids and account numbers string csvSiteIdAndAccountNumbers = GetCSVSiteIdAndAccountNumbers(accountMatches); DalAccount dalAccount = new DalAccount(); //Get customer account information by passing above generated csv string CustomerAccountSchema.CustomerAddressesDataTable addresses; //Since we cannot process varchar more than 4000, we have to divide the string appropraitely if (csvSiteIdAndAccountNumbers.Length > 4000) { //create the list of strings to hold the string of max allowed length List <String> csvStringList = new List <String>(); //max allowed length must be less than 4000 and should be divisible by 13 //13 = 3 digit siteid + 1 for comma + 9 digit account number. int maxAllowedLength = (int)4000 - (4000 % 13); //keep on looping untill all the all the parts of string are added. while (true) { //add max allowed length part of csv string to the list. //maxAllowedLength-2, because since index start from 0 we have to subtract 1 and to remove extra comma at the end we subtract 1 again. csvStringList.Add(csvSiteIdAndAccountNumbers.Substring(0, maxAllowedLength - 2)); //remove the part added to the list from the csv string csvSiteIdAndAccountNumbers = csvSiteIdAndAccountNumbers.Substring(maxAllowedLength - 1); //when the remaining csv string is less than max allowed length, directly add it and exit. if (csvSiteIdAndAccountNumbers.Length < maxAllowedLength - 1) { csvStringList.Add(csvSiteIdAndAccountNumbers); break; } } addresses = dalAccount.GetAccountByPhoneNumber(csvStringList, getNeverAndFormerAsWell); } else { addresses = dalAccount.GetAccountByPhoneNumber(csvSiteIdAndAccountNumbers, getNeverAndFormerAsWell); } if (addresses == null) { customerContactInformation = null; return; } // if we don't get back an address, then its not a valid accountNumber. foreach (CustomerAccountSchema.CustomerAddress ca in addresses) { CustomerContactInformation aa = new CustomerContactInformation(); PopulateAccountInformation(aa, ca); //Check if the match found was cox secondary number or not if (accountMatches.Select("Site_ID='" + aa.SiteId + "' and Account_Number='" + aa.AccountNumber13.Substring(4) + "' and Customer_TN_Flag=1").Length != 0) { aa.CustomerTNNumber = Convert.ToUInt64(phoneNumber10); } customerContactInformation.Add(aa); } } //if not match found return null else { customerContactInformation = null; } } catch (BusinessLogicLayerException) { // already handled throw; } catch (DataSourceException dse) { // not handled. need to handle throw new DataSourceUnavailableException(dse); } catch (Exception ex) { // not handled. need to handle throw new UnexpectedSystemException(ex); } }