private void ButtonLeadCaptureByKeyName_Click(object sender, EventArgs e) { ResultsClear(); APICredentials TempActInfo = CreateAPICredentials(); if (TempActInfo == null) { return; } if (string.IsNullOrWhiteSpace(TextBoxAttendeeConnectKey.Text)) { DisplayErrorMessage("You must enter the Attendee's Connect Key.", "For samples from the Demo Show please use the \"Badge QRCode Samples\" link shown."); } else if (string.IsNullOrWhiteSpace(TextBoxAttendeeLastName.Text)) { DisplayErrorMessage("You must enter at least one letter of the Attendee's Last Name.", "For samples from the Demo Show please use the \"Badge QRCode Samples\" link shown."); } else { ServiceInvoke(() => { ResultsWriteLine("Capturing Lead: {0} / {1}", TextBoxAttendeeConnectKey.Text, TextBoxAttendeeLastName.Text); ResultsWriteLine(); ExperientService Service = new ExperientService(); if (CheckBoxLeadCaptureByKeyName.Checked) { string ResponseJSON = Service.GetLeadInfoJSON(TempActInfo, TextBoxAttendeeConnectKey.Text, TextBoxAttendeeLastName.Text); if (ResponseJSON == null) { ResultsWriteLine("Null response."); } else { ResultsWriteLine(ResponseJSON); } } else { LeadInfoResult Response = Service.GetLeadInfo(TempActInfo, TextBoxAttendeeConnectKey.Text, TextBoxAttendeeLastName.Text); DisplayLeadInfoResults(Response); } // Update our local activation info storage. _APICredInfo = SaveAPICredentials(TempActInfo); }); } }
/// <summary> /// Simple method to display the results of capturing a lead. /// </summary> /// <param name="result"></param> private void DisplayLeadInfoResults(LeadInfoResult result) { if (result == null) { ResultsWriteLine("Null response."); } else { // Display any messages in the response. ResultsWrite(result.Messages); if (!result.Success) { ResultsWriteLine("No data to display since the call was not successful"); } else { TextBoxLeadID.Text = result.LeadInfo.LeadID ?? ""; TextBoxCapturedBy.Text = result.LeadInfo.CapturedBy ?? ""; TextBoxCapturedDate.Text = result.LeadInfo.CapturedDate ?? ""; TextBoxRegID.Text = result.LeadInfo.RegistrantID ?? ""; TextBoxFirstName.Text = result.LeadInfo.FirstName ?? ""; TextBoxLastName.Text = result.LeadInfo.LastName ?? ""; TextBoxTitle.Text = result.LeadInfo.Title ?? ""; TextBoxCompany.Text = result.LeadInfo.Company ?? ""; TextBoxCompany2.Text = result.LeadInfo.Company2 ?? ""; TextBoxAddress.Text = result.LeadInfo.Address ?? ""; TextBoxAddress2.Text = result.LeadInfo.Address2 ?? ""; TextBoxAddress3.Text = result.LeadInfo.Address3 ?? ""; TextBoxCity.Text = result.LeadInfo.City ?? ""; TextBoxStateCode.Text = result.LeadInfo.StateCode ?? ""; TextBoxZipCode.Text = result.LeadInfo.ZipCode ?? ""; TextBoxCountryCode.Text = result.LeadInfo.CountryCode ?? ""; TextBoxEmail.Text = result.LeadInfo.Email ?? ""; TextBoxPhone.Text = result.LeadInfo.Phone ?? ""; TextBoxPhoneExt.Text = result.LeadInfo.PhoneExtension ?? ""; TextBoxFax.Text = result.LeadInfo.Fax ?? ""; TextBoxNotes.Text = result.LeadInfo.Notes ?? ""; // Demographic fields. dgvDemographics.DataSource = null; if (result.Demographics != null) { dgvDemographics.DataSource = result.Demographics.ToArray(); } // Flip over to the tab to display the results. TabPageControl1.SelectedTab = TabPageLeadInfoResults; } } }
private void ButtonDisplayFields_Click(object sender, EventArgs e) { ResultsClear(); APICredentials TempActInfo = CreateAPICredentials(); if (TempActInfo == null) { return; } ServiceInvoke(() => { ResultsWriteLine("Querying Fields"); ResultsWriteLine(); ExperientService Service = new ExperientService(); if (CheckBoxShowJsonFields.Checked) { string ResponseJSON = Service.QueryFieldsJSON(TempActInfo); if (ResponseJSON == null) { ResultsWriteLine("Null response."); } else { ResultsWriteLine(ResponseJSON); } } else { LeadInfoResult Response = Service.QueryFields(TempActInfo); if (Response == null) { ResultsWriteLine("Null response."); } else { // Display any messages in the response. ResultsWrite(Response.Messages); if (!Response.Success) { ResultsWriteLine("No data to display since the call was not successful"); } else if ((Response.Demographics == null) || (Response.Demographics.Length == 0)) { ResultsWriteLine("This show does not include any fields other than the core contact fields in the LeadInfo class."); } else { ResultsWriteLine("In addition to the core contact fields in the LeadInfo class, " + "this show also contains the following Demographic fields. Each field is shown below " + "along with it's list of possible values. Fields with no possible values may contain " + "free-form text."); ResultsWriteLine(); foreach (var F in Response.Demographics) { ResultsWriteLine("Field Name: {0}", F.Key); foreach (var V in F.Value.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) { ResultsWriteLine(" {0}", V); } ResultsWriteLine(); } } } } // Update our local activation info storage. _APICredInfo = SaveAPICredentials(TempActInfo); }); }
/// <summary> /// Simple method to display the results of capturing a lead. /// </summary> /// <param name="result"></param> private void DisplayLeadInfoResults(LeadInfoResult result) { if ( result == null ) ResultsWriteLine("Null response."); else { // Display any messages in the response. ResultsWrite(result.Messages); if ( !result.Success ) ResultsWriteLine("No data to display since the call was not successful"); else { TextBoxLeadID.Text = result.LeadInfo.LeadID ?? ""; TextBoxCapturedBy.Text = result.LeadInfo.CapturedBy ?? ""; TextBoxCapturedDate.Text = result.LeadInfo.CapturedDate ?? ""; TextBoxRegID.Text = result.LeadInfo.RegistrantID ?? ""; TextBoxFirstName.Text = result.LeadInfo.FirstName ?? ""; TextBoxLastName.Text = result.LeadInfo.LastName ?? ""; TextBoxTitle.Text = result.LeadInfo.Title ?? ""; TextBoxCompany.Text = result.LeadInfo.Company ?? ""; TextBoxCompany2.Text = result.LeadInfo.Company2 ?? ""; TextBoxAddress.Text = result.LeadInfo.Address ?? ""; TextBoxAddress2.Text = result.LeadInfo.Address2 ?? ""; TextBoxAddress3.Text = result.LeadInfo.Address3 ?? ""; TextBoxCity.Text = result.LeadInfo.City ?? ""; TextBoxStateCode.Text = result.LeadInfo.StateCode ?? ""; TextBoxZipCode.Text = result.LeadInfo.ZipCode ?? ""; TextBoxCountryCode.Text = result.LeadInfo.CountryCode ?? ""; TextBoxEmail.Text = result.LeadInfo.Email ?? ""; TextBoxPhone.Text = result.LeadInfo.Phone ?? ""; TextBoxPhoneExt.Text = result.LeadInfo.PhoneExtension ?? ""; TextBoxFax.Text = result.LeadInfo.Fax ?? ""; TextBoxNotes.Text = result.LeadInfo.Notes ?? ""; // Demographic fields. dgvDemographics.DataSource = null; if ( result.Demographics != null ) dgvDemographics.DataSource = result.Demographics.ToArray(); // Flip over to the tab to display the results. TabPageControl1.SelectedTab = TabPageLeadInfoResults; } } }