/// <summary>BuildCustomerAccountPrivacy - Populates customerAccountProfile.Privacies</summary> /// <param name="siteId">Site Id for the customer</param> /// <param name="accountNumber9">9 digit customer account</param> /// <param name="dalCustomerAccount">Customer account data access</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildCustomerAccountPrivacy(int siteId, string accountNumber9, DalCustomerAccount dalCustomerAccount, CustomerAccountProfile customerAccountProfile) { // call dal GetCustomerPrivacyInfo CustomerAccountProfileSchema.CustomerPrivacyDataTable customerPrivacyDT = dalCustomerAccount.GetCustomerPrivacy(siteId, accountNumber9); if (customerPrivacyDT != null && customerPrivacyDT.Rows.Count > 0) { customerAccountProfile.Privacies = new List <Privacy>(); for (int i = 0; i < customerPrivacyDT.Count; ++i) { customerAccountProfile.Privacies.Add(new Privacy(customerPrivacyDT[i].New_Privacy_Code, customerPrivacyDT[i].Privacy_Code_Description)); } } }
/// <summary>BuildCustomerAccountPhones - Populates customerAccountProfile.Phones</summary> /// <param name="siteId">Site Id for the customer</param> /// <param name="accountNumber9">9 digit customer account</param> /// <param name="dalCustomerAccount">Customer account data access</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildCustomerAccountPhones(int siteId, string accountNumber9, DalCustomerAccount dalCustomerAccount, CustomerAccountProfile customerAccountProfile) { // call dal GetAllAccountPhones CustomerAccountProfileSchema.CustomerPhoneDataTable customerPhoneDT = dalCustomerAccount.GetAllAccountPhones(siteId, accountNumber9); if (customerPhoneDT != null && customerPhoneDT.Rows.Count > 0) { customerAccountProfile.Phones = new List <PhoneDetail>(); for (int i = 0; i < customerPhoneDT.Count; ++i) { customerAccountProfile.Phones.Add(new PhoneDetail(customerPhoneDT[i].Phone_Number, customerPhoneDT[i].Phone_Type, customerPhoneDT[i].Customer_TN_Sequence, customerPhoneDT[i].Customer_TN_Type_Id, customerPhoneDT[i].Wireless_Flag, customerPhoneDT[i].DNC_Flag)); } } }
/// <summary>BuildCustomerAccountCampaign - Populates customerAccountProfile.CurrentCampaignDetails</summary> /// <param name="siteId">Site Id for the customer</param> /// <param name="accountNumber9">9 digit customer account</param> /// <param name="dalCustomerAccount">Customer account data access</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildCustomerAccountCampaign(int siteId, string accountNumber9, DalCustomerAccount dalCustomerAccount, CustomerAccountProfile customerAccountProfile) { // call dal GetcustomerCampaign CustomerAccountProfileSchema.CustomerCampaignDataTable customerCampaignDT = dalCustomerAccount.GetCustomerCampaign(siteId, accountNumber9); if (customerCampaignDT != null && customerCampaignDT.Rows.Count > 0) { customerAccountProfile.CurrentCampaignDetails = new List <CurrentCampaignDetail>(); //[23-09-2009] Start Changes for Current Campaign Data fetch request foreach (CustomerAccountProfileSchema.CustomerCampaignRow row in customerCampaignDT) { CurrentCampaignDetail campaignDetail = new CurrentCampaignDetail(); campaignDetail.CurrentCampaignCode = row.IsPromotion_CodeNull() ? null : row.Promotion_Code.ToString(); campaignDetail.CurrentCampaignDescription = row.IsPromotion_DescriptionNull() ? null : row.Promotion_Description.ToString(); campaignDetail.ServiceCode = row.IsService_CodeNull() ? null : row.Service_Code.ToString(); campaignDetail.ServiceOccurrence = row.IsService_OccurrenceNull() ? null : row.Service_Occurrence.ToString(); campaignDetail.ServiceStatus = row.IsService_StatusNull() ? ServiceStatus.Unknown : (ServiceStatus)TypeDescriptor.GetConverter(campaignDetail.ServiceStatus).ConvertFrom(row.Service_Status); campaignDetail.ServiceCategory = DalServiceCategory.Instance.GetServiceCategoryDesc(row.Service_Category_Code); campaignDetail.DiscountActive = row.IsDiscount_ActiveNull() ? DiscountActive.Unknown : (DiscountActive)TypeDescriptor.GetConverter(campaignDetail.DiscountActive).ConvertFrom(row.Discount_Active); if (!row.IsDiscount_Begin_DateNull()) { campaignDetail.CampaignStartDate = new Icoms1900Date(row.Discount_Begin_Date); } else { campaignDetail.CampaignStartDate = DateTime.MinValue; } if (!row.IsDiscount_End_DateNull()) { campaignDetail.CampaignEndDate = new Icoms1900Date(row.Discount_End_Date); } else { campaignDetail.CampaignEndDate = DateTime.MinValue; } customerAccountProfile.CurrentCampaignDetails.Add(campaignDetail); } //[23-09-2009] End Changes for Current Campaign Data fetch request } }
/// <summary>BuildCustomerAccountContract - Populates customerAccountProfile.ContractDetails</summary> /// <param name="siteId">Site Id for the customer</param> /// <param name="accountNumber9">9 digit customer account</param> /// <param name="dalCustomerAccount">Customer account data access</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildCustomerAccountContract(int siteId, string accountNumber9, DalCustomerAccount dalCustomerAccount, CustomerAccountProfile customerAccountProfile) { // call dal GetCustomerContract CustomerAccountProfileSchema.CustomerContractDataTable customerContractDT = dalCustomerAccount.GetCustomerContract(siteId, accountNumber9); if (customerContractDT != null && customerContractDT.Rows.Count > 0) { //Changes for adding contract start date starts here DateTime contract_End_Date, contract_Start_Date; customerAccountProfile.ContractDetails = new List <ContractDetail>(); for (int i = 0; i < customerContractDT.Count; ++i) { contract_End_Date = DateTime.MinValue; if (customerContractDT[i].Contract_End_Date != null) { contract_End_Date = new Icoms1900Date(customerContractDT[i].Contract_End_Date); } contract_Start_Date = DateTime.MinValue; if (customerContractDT[i].Contract_START_Date != null) { contract_Start_Date = new Icoms1900Date(customerContractDT[i].Contract_START_Date); } List <string> serviceCategory = new List <string>(); if (customerContractDT[i].Service_Category_Code != null) { string[] serviceCategoryCode = customerContractDT[i].Service_Category_Code.Split(','); foreach (string s in serviceCategoryCode) { serviceCategory.Add(DalServiceCategory.Instance.GetServiceCategoryDesc(s)); } } customerAccountProfile.ContractDetails.Add(new ContractDetail(customerContractDT[i].Contract_Id.ToString(), customerContractDT[i].Contract_Desc.ToString(), contract_End_Date, contract_Start_Date, Convert.ToDouble(customerContractDT[i].Early_Term_Assesment_Amt), serviceCategory)); //Changes for adding contract start date ends here } } }
/// <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 }
/// <summary> /// BuildPriceLockDetails - populates customerAccountProfile.PriceLockDetails /// </summary> /// <param name="siteId">Site Id for the customer</param> /// <param name="accountNumber9">9 digit customer account</param> /// <param name="dalCustomerAccount">Customer account data access</param> /// <param name="customerAccountProfile">Customer account profile object</param> private void BuildPriceLockDetails(int siteId, string accountNumber9, DalCustomerAccount dalCustomerAccount, CustomerAccountProfile customerAccountProfile) { CustomerAccountProfileSchema.CustomerPriceLockInfoDataTable customerPriceLockInfoDt = dalCustomerAccount.GetCustomerPriceLockInfo(siteId, accountNumber9); List <PriceLockDetail> lsPriceLockDetails = new List <PriceLockDetail>(); foreach (CustomerAccountProfileSchema.CustomerPriceLockInfoRow dr in customerPriceLockInfoDt) { PriceLockDetail priceLockDetail = new PriceLockDetail(); priceLockDetail.ServiceCode = dr.IsSERVICE_CODENull() ? string.Empty : dr.SERVICE_CODE; priceLockDetail.ServiceOccurrence = dr.IsSERVICE_OCCURRENCENull() ? "0" : dr.SERVICE_OCCURRENCE; priceLockDetail.PriceProtectionTermsAndConditionsId = dr.IsTERMS_AND_CONDITIONS_IDNull() ? string.Empty : dr.TERMS_AND_CONDITIONS_ID; priceLockDetail.PriceProtectedRate = dr.IsPRICE_PROTECTED_RATENull() ? 0.0 : Convert.ToDouble(dr.PRICE_PROTECTED_RATE); priceLockDetail.ServiceCategory = DalServiceCategory.Instance.GetServiceCategoryDesc(dr.SERVICE_CATEGORY_CODE); priceLockDetail.PriceProtectionStatus = dr.IsPRICE_PROTECTION_STATUSNull() ? ePriceProtectionStatus.Unknown : (ePriceProtectionStatus) TypeDescriptor.GetConverter(typeof(ePriceProtectionStatus)).ConvertFrom(dr.PRICE_PROTECTION_STATUS); if (!dr.IsACTIVATION_DATENull()) { priceLockDetail.ActivationDate = new Icoms1900Date(dr.ACTIVATION_DATE); try { if (!dr.IsACTIVATION_TIMENull()) { string activationTime = dr.ACTIVATION_TIME.PadLeft(4, '0'); double hours = Convert.ToDouble(activationTime.Substring(0, 2)); double minutes = Convert.ToDouble(activationTime.Substring(2)); priceLockDetail.ActivationDate = priceLockDetail.ActivationDate.AddHours(hours).AddMinutes(minutes); } } catch { //Do notthing } } else { priceLockDetail.ActivationDate = DateTime.MinValue; } if (!dr.IsPRICE_PROTECT_START_DATENull()) { priceLockDetail.PriceProtectionStartDate = new Icoms1900Date(dr.PRICE_PROTECT_START_DATE); } else { priceLockDetail.PriceProtectionStartDate = DateTime.MinValue; } if (!dr.IsPRICE_PROTECTION_END_DATENull()) { priceLockDetail.PriceProtectionEndDate = new Icoms1900Date(dr.PRICE_PROTECTION_END_DATE); } else { priceLockDetail.PriceProtectionEndDate = DateTime.MinValue; } priceLockDetail.PriceProtectionDescription = dr.IsPRICE_PROTECT_DESCNull() ? string.Empty : dr.PRICE_PROTECT_DESC; priceLockDetail.PriceProtectionId = dr.IsPRICE_PROTECTION_IDNull() ? string.Empty : dr.PRICE_PROTECTION_ID; lsPriceLockDetails.Add(priceLockDetail); } customerAccountProfile.PriceLockDetails = lsPriceLockDetails; }
/// <summary>BuildContactEmail - populates customerAccountProfile.ContactEmailAddress</summary> /// <param name="siteId">Site Id for the customer</param> /// <param name="accountNumber9">9 digit customer account</param> /// <param name="dalCustomerAccount">Customer account data access</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildContactEmail(int siteId, string accountNumber9, DalCustomerAccount dalCustomerAccount, CustomerAccountProfile customerAccountProfile) { customerAccountProfile.ContactEmailAddress = dalCustomerAccount.GetCustomerEmail(siteId, accountNumber9); }
//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); }