protected void btnGo_Click(object sender, EventArgs e) { var country = _Countries[ddlCountry.SelectedValue]; var role = _Roles[ddlRole.SelectedValue]; var prospect = new Prospect { CompanyName = txtCompanyName.Text, EmailAddress = txtEmail.Text, FirstName = txtFirstName.Text, LastName = txtLastName.Text, Country = country, Role = role }; var handlerType = Config.Current["Dependencies:IProspectSaveHandler"]; Log.Debug($"Using IProspectSaveHandler implementation: {handlerType}"); var type = Type.GetType(handlerType); var handler = (IProspectSaveHandler)Global.ServiceProvider.GetService(type); handler.SaveProspect(prospect); Log.Info($"Saved new prospect, email address: {prospect.EmailAddress}"); if (_ProspectSaveCounter != null) { _ProspectSaveCounter.Labels(handlerType).Inc(); } Server.Transfer("ThankYou.aspx"); }
public static void PreloadStaticDataCache() { var loaderType = Config.Current["Dependencies:IReferenceDataLoader"]; Log.Debug($"Using IReferenceDataLoader implementation: {loaderType}"); var type = Type.GetType(loaderType); var loader = (IReferenceDataLoader)Global.ServiceProvider.GetService(type); var countries = loader.GetCountries(); _Countries["-"] = countries.Single(x => x.CountryCode == "-"); foreach (var country in countries.Where(x => x.CountryCode != "-").OrderBy(x => x.CountryName)) { _Countries[country.CountryCode] = country; } var roles = loader.GetRoles(); _Roles["-"] = roles.Single(x => x.RoleCode == "-"); foreach (var role in roles.Where(x => x.RoleCode != "-").OrderBy(x => x.RoleName)) { _Roles[role.RoleCode] = role; } Log.Info("Loaded reference data cache"); if (_DataLoadCounter != null) { _DataLoadCounter.Labels(loaderType).Inc(); } }