private void AddressControl_Load(object sender, EventArgs e) { //poor man's dependency injection address = new BLAddress(new Services.TaxService(), new Services.ValidationService()); SetAddressProperties(); PopulateStateComboBox(); PopulateCountryComboBox(); SetFormToCurrentAddress(); if (address.SalesTaxKey != 0 && containerValidator.IsValid()) { SetFormStatus(Color.Green, "Address has been validated and sales tax is set!"); } else { SetFormStatus(Color.Red, "Please enter the billing address."); } SetZipCodeRegex(); containerValidator.Validate(); }
internal static void EmailSalesTaxServiceFailure(string serviceName, BLAddress address, Customer customer) { var custId = customer == null ? address.CustId : customer.Id; string subject = $"Error calculating Sales Tax: {custId} - Address: {address.Data.Name}"; string body = $"Unable to retrieve Sales Tax Schedule information from the {serviceName} Tax Service. Default Sales Tax has been applied. Please check tcpZipTax and tsmPostalCode.{Environment.NewLine}Customer: {address.Data.Name} - {custId} {Environment.NewLine}{Environment.NewLine}Current address: {Environment.NewLine}{address.Data.Line1}{address.Data.Line2}{Environment.NewLine}{address.Data.City}{Environment.NewLine}{address.Data.Zip} {address.Data.State}{Environment.NewLine}{address.Data.Country}"; if (Debugger.IsAttached) { MessageBox.Show(subject + Environment.NewLine + body); return; } ServiceSoapClient client = new ServiceSoapClient(); client.Email("*****@*****.**", "*****@*****.**", subject, body, false, "", ""); }