/// <summary> /// Call the search and populate the table with the (hopefully) found Provider detail. /// </summary> /// <param name="providerID">The id of the Provider to display.</param> private void PopulateData(string providerID, String APIKey) { ServiceInterface client = new ServiceInterfaceClient("CourseSearchService"); ProviderDetailsInput request = new ProviderDetailsInput(providerID, APIKey); try { ProviderDetailsOutput response = client.ProviderDetails(request); // make sure we start with a clear table ProviderDetailTable.Rows.Clear(); if (response.ProviderDetails != null) { //ResultsOverviewLabel.Text = response.ProviderDetails.ProviderName; // add header TableHeaderCell headerCell = new TableHeaderCell(); headerCell.Text = response.ProviderDetails.ProviderName; headerCell.ColumnSpan = 2; TableRow headerRow = new TableRow(); headerRow.Cells.Add(headerCell); ProviderDetailTable.Rows.Add(headerRow); // add the rows of provider data ProviderDetailTable.Rows.Add(CreateTableRow("Provider name:", response.ProviderDetails.ProviderName)); ProviderDetailTable.Rows.Add(CreateTableRow("Provider ID:", response.ProviderDetails.ProviderID)); ProviderDetailTable.Rows.Add(CreateTableRow("UKPRN:", response.ProviderDetails.UKPRN)); ProviderDetailTable.Rows.Add(CreateTableRow("UPIN:", response.ProviderDetails.UPIN)); ProviderDetailTable.Rows.Add(CreateTableRow("Address Line 1:", response.ProviderDetails.ProviderAddress.Address_line_1)); ProviderDetailTable.Rows.Add(CreateTableRow("Address Line 2:", response.ProviderDetails.ProviderAddress.Address_line_2)); ProviderDetailTable.Rows.Add(CreateTableRow("Town:", response.ProviderDetails.ProviderAddress.Town)); ProviderDetailTable.Rows.Add(CreateTableRow("County:", response.ProviderDetails.ProviderAddress.County)); ProviderDetailTable.Rows.Add(CreateTableRow("Postcode:", response.ProviderDetails.ProviderAddress.PostCode)); ProviderDetailTable.Rows.Add(CreateTableRow("Phone:", response.ProviderDetails.Phone)); ProviderDetailTable.Rows.Add(CreateTableRow("Fax:", response.ProviderDetails.Fax)); ProviderDetailTable.Rows.Add(CreateTableRow("Email:", response.ProviderDetails.Email)); ProviderDetailTable.Rows.Add(CreateTableRow("Website:", response.ProviderDetails.Website)); ProviderDetailTable.Rows.Add(CreateTableRow("24+ Loans:", response.ProviderDetails.TFPlusLoans.ToString())); ProviderDetailTable.Rows.Add(CreateTableRow("DFE Provider:", response.ProviderDetails.DFE1619Funded.ToString())); } } catch (Exception ex) { ResultsOverviewLabel.Text = ex.Message + "/n/n" + ex.StackTrace; } }
/// <summary> /// On clicking ProviderDetails button, calls CourseSearchService ProviderDetails() method wtih test data. /// </summary> private void btnProviderDetails_Click(object sender, EventArgs e) { txtResult.Text = "Processing ..."; ServiceInterface client = new ServiceInterfaceClient("CourseSearch"); ProviderDetailsInput request = new ProviderDetailsInput("300017", ""); // 3958 = Cardiff University try { ProviderDetailsOutput response = client.ProviderDetails(request); StringBuilder sb = new StringBuilder(); sb.Append("Request details:"); sb.Append("\nProvider ID = " + response.RequestDetails.ProviderID); sb.Append("\n\n"); if (response.ProviderDetails != null) { sb.Append("Provider details:"); sb.Append("\nID: " + response.ProviderDetails.ProviderID); sb.Append("\nName: " + response.ProviderDetails.ProviderName); sb.Append("\nUKPRN: " + response.ProviderDetails.UKPRN); sb.Append("\nUPIN:" + response.ProviderDetails.UPIN); sb.Append("\nAddress: " + response.ProviderDetails.ProviderAddress.Address_line_1); sb.Append(", " + response.ProviderDetails.ProviderAddress.Address_line_2); sb.Append(", " + response.ProviderDetails.ProviderAddress.Town); sb.Append(", " + response.ProviderDetails.ProviderAddress.County); sb.Append(", " + response.ProviderDetails.ProviderAddress.PostCode); sb.Append("\nPhone: " + response.ProviderDetails.Phone); sb.Append("\nFax: " + response.ProviderDetails.Fax); sb.Append("\nEmail: " + response.ProviderDetails.Email); sb.Append("\nWebsite: " + response.ProviderDetails.Website); sb.Append("\n"); } txtResult.Text = sb.ToString(); } catch (Exception ex) { txtResult.Text = ex.Message; } }