} // BllConnectionManager( string userName ) #endregion Construction/Destruction #region Methods /// <summary> /// This method creates a Connection Manager proxy according to the /// account number provided. The account number is used to query site /// infomration using the base class functionality. The internal /// username is also used to query the Connection Manager credentials. /// </summary> /// <param name="can"> /// The customer account number from which site information is /// garnered. /// </param> protected void CreateProxy(CustomerAccountNumber can) { // get the siteid/sitecode information PopulateSiteInfo(can); // Don't keep this in exposed memory string strLogon, strPassword; PopulateCmCredentials(out strLogon, out strPassword); try { m_proxy = new ConnectionManagerProxy( SiteId, SiteCode, strLogon, strPassword); } // try catch (CmErrorException) { // Let the containing layer have a crack at this information throw; } // catch( CmErrorException excCm ) catch (Exception e) { throw new ServiceAgentUnavailableException(e); } // catch( Exception e ) } // CreateProxy()
public Task <Bill> Find(CustomerAccountNumber customer) { Check.Argument.IsNotNull(customer, nameof(customer)); return(client.GetString(endpoint) .ContinueWith(x => JsonConvert.DeserializeObject <Bill>(x.Result, converters))); }
public Task<Bill> Find(CustomerAccountNumber customer) { Check.Argument.IsNotNull(customer, nameof(customer)); return client.GetString(endpoint) .ContinueWith(x => JsonConvert.DeserializeObject<Bill>(x.Result, converters)); }
/// <summary> /// The default constructor /// </summary> public AccountActivityAdapter( CustomerAccountNumber accountNumber, string userName, int siteId, string siteCode) { // set value _accountNumber = accountNumber; _userName = userName; _siteId = siteId; _siteCode = siteCode; }
/// <summary> /// This method returns the telephone numbers for digital telephone service for a statement. /// </summary> /// <param name="accountNumber13"></param> /// <param name="phoneNumber"></param> /// <returns></returns> public string InquireStatementCode( [RequiredItem()][StringLength(13, 13)][CustomerAccountNumber()] string accountNumber13, [RequiredItem()][StringLength(4, 4)] string phoneNumber) { BillingLogEntry logEntry = new BillingLogEntry(eBillingActivityType.StatementCodeInquiry, accountNumber13, phoneNumber); using (Log log = CreateLog(logEntry)) { try { // validate the parameters. MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), accountNumber13, phoneNumber); 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; // use dal to get statement code string statementCode = null; DalAccount dalAccount = new DalAccount(); statementCode = dalAccount.GetStatementCode(SiteId, SiteCode, accountNumber.AccountNumber9, phoneNumber); // if no statement code is found throw ex if (statementCode == null || statementCode == string.Empty) { throw new InvalidAccountNumberException( string.Format(__noStatementCodeForAccountExceptionMessage, accountNumber.AccountNumber13, phoneNumber)); } return(statementCode.PadLeft(3, '0')); } 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); } } }
/// <summary> /// Return true, if the string value is a valid /// customeraccountnumber, false otherwise. /// </summary> /// <param name="accountNumber"></param> /// <returns></returns> public bool IsValid(string accountNumber) { try { return(CustomerAccountNumber.ValidateAccountNumber( accountNumber.Trim().PadLeft( CustomerAccountNumber.knAccountNumberLength, '0'))); } catch { return(false); } }
public async Task <ActionResult> GetBillWithStatistics() { var accountNumber = new CustomerAccountNumber(ClaimsPrincipal.Current.FindFirst("AccountNumber").Value); var bill = await billingService.Find(accountNumber); var vm = new BillWithStatisticsViewModel { Bill = bill, CalledFrequency = bill.GetCalledFrequency(), SkyStoreChargesValue = bill.GetSkyStoreChargesValue() }; return(Json(vm, jsonConverters)); }
public async Task<ActionResult> GetBillWithStatistics() { var accountNumber = new CustomerAccountNumber(ClaimsPrincipal.Current.FindFirst("AccountNumber").Value); var bill = await billingService.Find(accountNumber); var vm = new BillWithStatisticsViewModel { Bill = bill, CalledFrequency = bill.GetCalledFrequency(), SkyStoreChargesValue = bill.GetSkyStoreChargesValue() }; return Json(vm, jsonConverters); }
//[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); } } }
/// <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); } } }
public async Task Find_JsonBillWithoutCallCharges_ShouldReturnBillWithNullCallChargesAndNotNullSkyStore() { // Arrange var client = new Mock<IHttpClient>(); client.Setup(x => x.GetString(It.IsAny<string>())).Returns(Task.FromResult(SampleData.BillWithoutCallCharges())); var converters = new JsonConverter[] { new MoneyJsonConverter(), new SkyStoreMovieJsonConverter(), new TelephoneNumberJsonConverter() }; var service = new BillingService(client.Object, converters, "http://some-end-point"); var accountNumber = new CustomerAccountNumber("1234567890"); // Act var bill = await service.Find(accountNumber); // Assert Assert.IsNotNull(bill); Assert.IsNull(bill.CallCharges); Assert.IsNotNull(bill.SkyStore); }
public async Task Find_JsonBillWithoutCallCharges_ShouldReturnBillWithNullCallChargesAndNotNullSkyStore() { // Arrange var client = new Mock <IHttpClient>(); client.Setup(x => x.GetString(It.IsAny <string>())).Returns(Task.FromResult(SampleData.BillWithoutCallCharges())); var converters = new JsonConverter[] { new MoneyJsonConverter(), new SkyStoreMovieJsonConverter(), new TelephoneNumberJsonConverter() }; var service = new BillingService(client.Object, converters, "http://some-end-point"); var accountNumber = new CustomerAccountNumber("1234567890"); // Act var bill = await service.Find(accountNumber); // Assert Assert.IsNotNull(bill); Assert.IsNull(bill.CallCharges); Assert.IsNotNull(bill.SkyStore); }
//[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); } } }
/// <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> /// This is the primary constructor for this class. The username is /// passed to the base class BllConnectionManager to allow for CM /// credentials population. /// </summary> /// <param name="strUserName"> /// This username is passed to the base class BllConnection Manager /// to populate CM credentials. /// </param> /// <param name="strAccountNumber16"> /// This account number is used to query site information by the base /// class BllCustomer. /// </param> public Payment([RequiredItem()] string strUserName, [RequiredItem()][StringLength(16, 16)][CustomerAccountNumber()] string strAccountNumber16) : base(strUserName) { // validate the parameters. ConstructorValidator validator = new ConstructorValidator(ConstructorInfo.GetCurrentMethod(), strUserName, strAccountNumber16); validator.Validate(); // convert the accountNumber. m_can = (CustomerAccountNumber)TypeDescriptor.GetConverter( typeof(CustomerAccountNumber)).ConvertFrom(strAccountNumber16); // NOTE: This is a fix to work around a Connection Manager bug. // When an account number has statement code equal to "000," this // causes Connection Manger to blow up for the entire site and // return the error message similar to "Cannot start IGI // interface". We are now kicking these references out here. if ("000" == m_can.StatementCode) { throw new InvalidStatementCodeException(); } // Initialize the service agent CreateProxy(m_can); }
//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); }
/// <summary> /// This method returns the StatementActivity for the given account /// since the last statement. /// </summary> /// <param name="accountNumber16"></param> /// <returns></returns> public StatementActivity InquireStatementActivity( [RequiredItem()][StringLength(16, 16)] [CustomerAccountNumber()] string accountNumber16) { BillingLogEntry logEntry = new BillingLogEntry( eBillingActivityType.StatementActivity, accountNumber16); using (Log log = CreateLog(logEntry)) { try { // validate the parameters. MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), accountNumber16); validator.Validate(); // convert the accountNumber. CustomerAccountNumber accountNumber = (CustomerAccountNumber)TypeDescriptor.GetConverter( typeof(CustomerAccountNumber)).ConvertFrom(accountNumber16); // setup the return StatementActivity statementActivity = new StatementActivity(); statementActivity.AccountNumber16 = accountNumber.AccountNumber16; statementActivity.StatementCode = accountNumber.StatementCode; // create proxy CreateProxy(accountNumber); // get the sitecode/siteId information // NOTE: CreateProxy above populates enough data for this // purpose as well logEntry.SiteId = SiteId; // get ACSUM from proxy Response.MAC00010 mac10Output = (Response.MAC00010) this.Invoke( (Request.MAC00010) new Mac00010Helper( SiteId.ToString(), accountNumber.AccountNumber9, accountNumber.StatementCode)); if (mac10Output.Items != null) { foreach (object item in mac10Output.Items) { if (item is Response.INL00008) { Response.INL00008 inline8 = (Response.INL00008)item; Transaction transaction = new Transaction(); transaction.Amount = toDouble(inline8.TRNSCTNAMNT); transaction.Description = inline8.DETLDSCRPTN; transaction.FromDate = new IcomsDate(inline8.TRNSCTNFROMDATE8).Date; transaction.ToDate = new IcomsDate(inline8.TRNSCTNTODATE8).Date; transaction.TransactionType = (eTransactionType)TypeDescriptor.GetConverter(typeof( eTransactionType)).ConvertFrom(inline8.TRNSCTNTYPE);; transaction.ServiceCategory = (eServiceCategory)TypeDescriptor.GetConverter(typeof( eServiceCategory)).ConvertFrom(inline8.SRVCCTGRY);; statementActivity.Transactions.Add(transaction); } } } // all done. return(statementActivity); } catch (ValidationException ve) { logEntry.SetError(new ExceptionFormatter(ve).Format()); throw; } catch (BusinessLogicLayerException blle) { logEntry.SetError(new ExceptionFormatter(blle).Format()); throw; } catch (CmErrorException eCm) { logEntry.SetError(eCm.Message, eCm.ErrorCode); throw TranslateCmException(eCm); } catch (Exception e) { logEntry.SetError(new ExceptionFormatter(e).Format()); throw new UnexpectedSystemException(e); } } }
/// <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); } } }
/// <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); } } }
/// <summary> /// BuildCustomerAccountStatement - Populates customerAccountProfile.Statements /// and customerAccountProfile.TotalCurrentBalance /// </summary> /// <param name="accountNumber9">9 digit account number</param> /// <param name="accountNumber">full account number</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildCustomerAccountStatement(string accountNumber9, CustomerAccountNumber accountNumber, CustomerAccountProfile customerAccountProfile) { //Get Statements CurrentAmount, EnrolledInEasyPay, EnrolledInStopPaperBill Account account = new Account(); //get a data access obj to coxprod_commerce //DalBillNotification dalBillNotification = new DalBillNotification(); //// setup adapter and fill account object. AccountAdapter adapter = new AccountAdapter(accountNumber, _userName, _siteId, _siteCode); adapter.Fill(account); double totalCurrentBalance = 0.00; double monthlyRecurringRevenue = 0.0; if (account.Statements != null && account.Statements.Count > 0) { customerAccountProfile.Statements = new List <Cox.BusinessObjects.CustomerAccount.Statement>(); for (int j = 0; j < account.Statements.Count; j++) { bool enrolledInStopPaperBill = false; //bool enrolledInEmailBillReminder = false; if (account.Statements[j].BillingOption == eBillingOption.StopPaper) { enrolledInStopPaperBill = true; } if (account.Statements[j].BillingOption == eBillingOption.WebStopPaper) { enrolledInStopPaperBill = true; } //enrolledInEmailBillReminder = dalBillNotification.GetEnrolledInEmailBillReminder(accountNumber9, _siteId, account.Statements[j].AccountNumber16.Substring(4, 4), account.Statements[j].StatementCode); // Call GetMonthlyServiceAmount DalCustomerAccount dalCustomerAccount = new DalCustomerAccount(); CustomerAccountProfileSchema.CustomerMonthlyServiceAmountDataTable customerMonthlyServiceAmountDT = dalCustomerAccount.GetMonthlyServiceAmount(_siteId, accountNumber9); if (customerMonthlyServiceAmountDT != null && customerMonthlyServiceAmountDT.Rows.Count > 0) { customerAccountProfile.TotalMonthlyRecurringRevenue = customerMonthlyServiceAmountDT[0].Total_Monthly_SVC_Amount; for (int i = 0; i < customerMonthlyServiceAmountDT.Count; ++i) { int statementCode = 0; int statementCodeDT = 0; statementCode = int.Parse(account.Statements[j].StatementCode); statementCodeDT = int.Parse(customerMonthlyServiceAmountDT[i].Statement_Code); if (statementCode == statementCodeDT) { monthlyRecurringRevenue = customerMonthlyServiceAmountDT[i].StatementCD_Monthly_SVC_Amount; } } } //[05-02-2009] Start Changes for reflecting AR amounts for Q-Matic //customerAccountProfile.Statements.Add(new Cox.BusinessObjects.CustomerAccount.Statement(account.Statements[j].StatementCode, account.Statements[j].AccountNumber16, monthlyRecurringRevenue, account.Statements[j].CurrentBalance, account.Statements[j].EasyPayFlag, enrolledInStopPaperBill, enrolledInEmailBillReminder)); customerAccountProfile.Statements.Add(new Cox.BusinessObjects.CustomerAccount.Statement(account.Statements[j].StatementCode, account.Statements[j].AccountNumber16, monthlyRecurringRevenue, account.Statements[j].CurrentBalance, account.Statements[j].EasyPayFlag, enrolledInStopPaperBill, account.Statements[j].AR1To30Amount, account.Statements[j].AR31To60Amount, account.Statements[j].AR61To90Amount, account.Statements[j].AR91To120Amount)); //[05-02-2009] Start Changes for reflecting AR amounts for Q-Matic totalCurrentBalance += account.Statements[j].CurrentBalance; } customerAccountProfile.TotalCurrentBalance = totalCurrentBalance; } //[23-02-2009] Start Changes for improving performance of CustomerAccount service AccountActivity accountActivity = new AccountActivity(_userName, _siteId); accountActivity.SetAllowOnlineOrderingFlag(ref account); if (account.AllowOnlineOrdering) { customerAccountProfile.OnlineOrderDelinquentBalance = false; } else { customerAccountProfile.OnlineOrderDelinquentBalance = true; } if (account.OnlineOrderingOptOut != 0) { customerAccountProfile.OnlineOrderBlock = true; } else { customerAccountProfile.OnlineOrderBlock = false; } //[23-02-2009] End Changes for improving performance of CustomerAccount service }