/// <summary>
        /// Gets the results from the web service.
        /// </summary>
        /// <param name="criteria">The course search criteria.</param>
        /// <param name="sortBy">The column on which to sort the results.</param>
        /// <param name="recordsPerPage">The number of records to return per page.</param>
        /// <param name="pageNo">The number of the page of data to get.</param>
        /// <returns>A list of found courses.</returns>
        private CourseListOutput GetResults(SearchCriteriaStructure criteria, string sortBy, string recordsPerPage, string pageNo)
        {
            CourseListOutput output = new CourseListOutput();
            ServiceInterface client = new ServiceInterfaceClient("CourseSearchService");

            CourseListRequestStructure listRequestStructure = new CourseListRequestStructure
            {
                CourseSearchCriteria = criteria,
                RecordsPerPage       = recordsPerPage,
                PageNo = pageNo
            };

            if (!string.IsNullOrEmpty(sortBy))
            {
                SortType tempSortType;
                Enum.TryParse(sortBy, out tempSortType);
                listRequestStructure.SortBy          = tempSortType;
                listRequestStructure.SortBySpecified = true;
            }

            CourseListInput request = new CourseListInput(listRequestStructure);

            try
            {
                output = client.CourseList(request);
            }
            catch (Exception ex)
            {
                ResultsOverviewLabel.Text = ex.Message + "\n" + ex.StackTrace;
            }

            return(output);
        }
        /// <summary>
        /// Gets the data from the web service and populates the controls.
        /// </summary>
        /// <param name="courseIds">The id's of the courses to display.</param>
        /// <param name="APIKey"></param>
        private void PopulateData(string[] courseIds, String APIKey)
        {
            ServiceInterface  client          = new ServiceInterfaceClient("CourseSearchService");
            CourseDetailInput courseListInput = new CourseDetailInput(courseIds, APIKey);

            try
            {
                CourseDetailOutput courseDetailOutput = client.CourseDetail(courseListInput);

                List <CourseInformation> courseDetails = CreateCourseDetails(courseDetailOutput);

                if (courseDetails.Count() > 0)
                {
                    NumberOfCourses.Text = string.Format(Constants.StringFormats.CourseDetailNoOfCourses, courseDetails.Count());
                    divResults.Visible   = true;

                    CourseRepeater.DataSource = courseDetails;
                    CourseRepeater.DataBind();
                }
                else
                {
                    divResults.Visible        = false;
                    ResultsOverviewLabel.Text = "There are no results to display.";
                }
            }
            catch (Exception ex)
            {
                ResultsOverviewLabel.Text = ex.Message + "\n" + ex.StackTrace;
            }
        }
Esempio n. 3
0
        public JsonResult SentNotifyMessage(string Message)
        {
            ServiceInterfaceClient client = new ServiceInterfaceClient();
            ProcessResoult         pr     = client.sentNotifyAsync(Message).Result;

            return(Json(pr));
        }
Esempio n. 4
0
 public PlayerView(string viewerName)
 {
     this._currentPlayer = new Player(viewerName);
     this._otherPlayers  = new List <Player>();
     this._cardsOnTable  = new ObservableCollection <Card>();
     //this._interfaceUsed = new Teenus();
     //this._interfaceUsed.setCallbackInterface(this);
     this._moveNr = 1;
     this._client = new ServiceInterfaceClient();
     _joinersList = new ObservableCollection <ServiceUser>();
 }
Esempio n. 5
0
        private void PopulateData(SubjectBrowseInput request)
        {
            ServiceInterface client = new ServiceInterfaceClient("CourseSearchService");

            try
            {
                SubjectBrowseOutput response = client.GetCategories(request);

                foreach (Level1 level1 in response.Level1)
                {
                    // start Level 1
                    string   level1Text     = CreateLevelText(level1.LDCS.LDCSCode, level1.LDCS.LDCSDesc, level1.LDCS.Searchable.ToString(), level1.CourseCounts);
                    TreeNode level1TreeNode = new TreeNode(level1Text);
                    level1TreeNode.SelectAction = TreeNodeSelectAction.None;

                    if (level1.Level2 != null)
                    {
                        foreach (Level2 level2 in level1.Level2)
                        {
                            // start Level 2
                            string   level2Text     = CreateLevelText(level2.LDCS.LDCSCode, level2.LDCS.LDCSDesc, level2.LDCS.Searchable.ToString(), level2.CourseCounts);
                            TreeNode level2TreeNode = new TreeNode(level2Text);
                            level2TreeNode.SelectAction = TreeNodeSelectAction.None;
                            if (level2.Level3 != null)
                            {
                                foreach (CategoryInfo level3 in level2.Level3)
                                {
                                    string   level3Text     = CreateLevelText(level3.LDCS.LDCSCode, level3.LDCS.LDCSDesc, level3.LDCS.Searchable.ToString(), level3.CourseCounts);
                                    TreeNode level3TreeNode = new TreeNode(level3Text);
                                    level3TreeNode.NavigateUrl = "~\\CourseSearch.aspx?ldcscategorycodes=" + level3.LDCS.LDCSCode + "&APIKey=" + request.APIKey + "&action=search&recordsperpage=10";
                                    // add the level 3 node to the level 2 node
                                    level2TreeNode.ChildNodes.Add(level3TreeNode);
                                }
                            }

                            // add level 2 node to the level 1 node
                            level1TreeNode.ChildNodes.Add(level2TreeNode);
                        }
                    }

                    // add the level 1 node
                    TreeView1.Nodes.Add(level1TreeNode);
                }

                TreeView1.DataBind();
            }
            catch (Exception ex)
            {
                ResultsOverviewLabel.Text = ex.Message + "/n/n" + ex.StackTrace;
            }
        }
        /// <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 GetCategories button, calls CourseSearchService GetCategories() method wtih test data.
        /// </summary>
        private void btnGetCategories_Click(object sender, EventArgs e)
        {
            txtResult.Text = "Processing ...";

            ServiceInterface client = new ServiceInterfaceClient("CourseSearch");

            SubjectBrowseInput request = new SubjectBrowseInput();
            StringBuilder      sb      = new StringBuilder();

            try
            {
                SubjectBrowseOutput response = client.GetCategories(request);

                foreach (Level1 level1 in response.Level1)
                {
                    sb.Append("Level 1:" + level1.LDCS.LDCSCode + "; " + level1.LDCS.LDCSDesc + "; " +
                              level1.LDCS.Searchable.ToString() + "; " + level1.CourseCounts + "\n");

                    if (level1.Level2 != null)
                    {
                        foreach (Level2 level2 in level1.Level2)
                        {
                            sb.Append("Level 2:" + level2.LDCS.LDCSCode + "; " + level2.LDCS.LDCSDesc + "; " +
                                      level2.LDCS.Searchable.ToString() + "; " + level2.CourseCounts + "\n");

                            if (level2.Level3 != null)
                            {
                                foreach (CategoryInfo level3 in level2.Level3)
                                {
                                    sb.Append("Level 3:" + level3.LDCS.LDCSCode + "; " + level3.LDCS.LDCSDesc + "; " +
                                              level3.LDCS.Searchable.ToString() + "; " + level3.CourseCounts + "\n");
                                }
                            }
                        }
                    }

                    sb.Append("\n");
                }

                txtResult.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                txtResult.Text = sb.ToString() + "\n\n" + ex.Message;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Gets the results from the web service.
        /// </summary>
        /// <param name="criteria">The course search criteria.</param>
        /// <returns>A list of found courses.</returns>
        private static CourseListOutput GetResults(SearchCriteriaStructure criteria)
        {
            ServiceInterface client = new ServiceInterfaceClient("CourseSearchService");

            CourseListRequestStructure listRequestStructure = new CourseListRequestStructure
            {
                CourseSearchCriteria = criteria,
                RecordsPerPage       = "10",
                PageNo          = "1",
                SortBy          = SortType.D,
                SortBySpecified = true
            };

            CourseListInput  request = new CourseListInput(listRequestStructure);
            CourseListOutput output  = client.CourseList(request);

            return(output);
        }
        /// <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;
            }
        }
Esempio n. 10
0
        private object GetResult(string service, string method, object[] args)
        {
            try
            {
                using (ServiceInterfaceClient client = new ServiceInterfaceClient())
                {
                    EntityCollection collection = client.GetEntitiesByField("Name", service, "=");

                    if (collection.Count == 0)
                    {
                        throw new ValueNotFoundException("该服务不存在,请重新输入!");
                    }

                    string filename = string.Format(collection[0].GetValue("Filename").ToString(), WebConfigurationManager.AppSettings["Path"]);
                    //string url = string.Format(collection[0].GetValue("Url").ToString(), WebConfigurationManager.AppSettings["Address"]);
                    string url      = string.Format(collection[0].GetValue("Url").ToString(), "localhost");
                    string contract = collection[0].GetValue("Contract").ToString();

                    using (ServiceHelper helper = new ServiceHelper(filename, url, contract))
                    {
                        return(helper.ExecuteMethod(method, this.Deserialize(args)));
                    }
                }
            }
            catch (Exception exception)
            {
                WriteExceptLog(exception, service, method, this.Deserialize(args));

                if (exception.InnerException is ServiceActivationException)
                {
                    return(Helper.GetEntity(false, exception.InnerException.Message));
                }
                if (exception.InnerException.InnerException.InnerException is SocketException)
                {
                    return(Helper.GetEntity(false, exception.InnerException.InnerException.InnerException.Message));
                }



                return(Helper.GetEntity(false, exception.Message));
            }
        }
Esempio n. 11
0
        protected Int32 ProcessRequest(String searchTerm, String location, Int32 pageNumber)
        {
            //while (lastRequest.AddTicks(100000000 * 2) <= DateTime.Now)
            //{
            //    // Wait at least 2/10th of a second
            //}
            //lastRequest = DateTime.Now;

            ServiceInterface client = new ServiceInterfaceClient("CourseSearchService");

            CourseListRequestStructure listRequestStructure = new CourseListRequestStructure
            {
                CourseSearchCriteria = new SearchCriteriaStructure
                {
                    //APIKey
                    APIKey = ConfigurationManager.AppSettings["APIKey"],
                    // SUBJECT
                    SubjectKeyword = searchTerm,
                    Location       = location
                },
                RecordsPerPage  = "10",
                PageNo          = pageNumber.ToString(),
                SortBy          = SortType.D,
                SortBySpecified = true
            };

            CourseListInput request = new CourseListInput(listRequestStructure);

            try
            {
                CourseListOutput output = client.CourseList(request);
                WriteLog(String.Format("Term:{0} Location:{1} PageNum:{2} Results:{3}", searchTerm, location, pageNumber, output.CourseListResponse.ResultInfo.NoOfRecords));
                return(String.IsNullOrEmpty(output.CourseListResponse.ResultInfo.NoOfPages) ? 0 : Convert.ToInt32(output.CourseListResponse.ResultInfo.NoOfPages));
            }
            catch (Exception ex)
            {
                WriteLog(String.Format("Term:{0} Location:{1} PageNum:{2} Error:{3}", searchTerm, location, pageNumber, ex.Message));
            }

            return(0);
        }
        /// <summary>
        /// On clicking ProviderSearch button, calls CourseSearchService ProviderSearch() method wtih test data.
        /// </summary>
        private void btnProviderSearch_Click(object sender, EventArgs e)
        {
            txtResult.Text = "Processing ...";

            ServiceInterface client = new ServiceInterfaceClient("CourseSearch");

            ProviderSearchInput request = new ProviderSearchInput(new ProviderSearchRequestStructure());

            request.ProviderSearchRequest.ProviderKeyword = "Cardiff";

            try
            {
                ProviderSearchOutput response = client.ProviderSearch(request);
                StringBuilder        sb       = new StringBuilder();
                sb.Append("Request details:");
                sb.Append("\nProvider Keyword = " +
                          response.ProviderSearchResponse.RequestDetails.ProviderSearch.ProviderKeyword);

                sb.Append("\n\n");

                if (response.ProviderSearchResponse != null && response.ProviderSearchResponse.ProviderDetails != null)
                {
                    sb.Append("Provider details:");
                    foreach (ProviderStructure providerDetail in response.ProviderSearchResponse.ProviderDetails)
                    {
                        sb.Append("\n" + providerDetail.Provider.ProviderID);
                        sb.Append("\n" + providerDetail.Provider.ProviderName);
                        sb.Append("\n");
                    }
                }

                txtResult.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                txtResult.Text = ex.Message;
            }
        }
        /// <summary>
        /// Gets the results from the web service.
        /// </summary>
        /// <param name="criteria">The course search criteria.</param>
        /// <returns>A list of found courses.</returns>
        private ProviderSearchOutput GetResults(SearchCriteriaStructure criteria)
        {
            ProviderSearchOutput output = new ProviderSearchOutput();
            ServiceInterface     client = new ServiceInterfaceClient("CourseSearchService");

            ProviderSearchRequestStructure listRequestStructure = new ProviderSearchRequestStructure
            {
                APIKey          = criteria.APIKey,
                ProviderKeyword = criteria.ProviderKeyword
            };

            ProviderSearchInput request = new ProviderSearchInput(listRequestStructure);

            try
            {
                output = client.ProviderSearch(request);
            }
            catch (Exception ex)
            {
                ResultsOverviewLabel.Text = ex.Message + "\n" + ex.StackTrace;
            }

            return(output);
        }
        /// <summary>
        /// On clicking CourseList button, calls CourseSearchService ClientList() method wtih test data.
        /// </summary>
        private void btnCourseList_Click(object sender, EventArgs e)
        {
            txtResult.Text = "Processing ...";

            ServiceInterface client = new ServiceInterfaceClient("CourseSearch");

            CourseListRequestStructure listRequestStructure = new CourseListRequestStructure();

            listRequestStructure.CourseSearchCriteria = new SearchCriteriaStructure();
            listRequestStructure.CourseSearchCriteria.SubjectKeyword = "chemistry";
//            listRequestStructure.CourseSearchCriteria.ProviderID = "4517";  // 4517 University of Bristol
            listRequestStructure.CourseSearchCriteria.Location = "grantham";
//            listRequestStructure.CourseSearchCriteria.Distance = 30.0f;
//            listRequestStructure.CourseSearchCriteria.DistanceSpecified = true;

            CourseListInput request = new CourseListInput(listRequestStructure);

            try
            {
                CourseListOutput response = client.CourseList(request);

                StringBuilder sb = new StringBuilder();
                sb.Append("Request details:");
                sb.Append("\nCourse Search Criteria:");
                sb.Append("\n A10 codes: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.A10Codes);
                sb.Append("\n Adult LR status: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.AdultLRStatus);
                sb.Append("\n Attendance Modes: " +
                          ((response.CourseListResponse.RequestDetails.CourseSearchCriteria.AttendanceModes != null) ?
                           response.CourseListResponse.RequestDetails.CourseSearchCriteria.AttendanceModes.ToString() : "null"));
                sb.Append("\n Attendance Patterns: " +
                          ((response.CourseListResponse.RequestDetails.CourseSearchCriteria.AttendancePatterns != null) ?
                           response.CourseListResponse.RequestDetails.CourseSearchCriteria.AttendancePatterns.ToString() : "null"));
                sb.Append("\n Distance: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.Distance.ToString());
                sb.Append("\n Distance specified: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.DistanceSpecified.ToString());
                sb.Append("\n Earliest Start date: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.EarliestStartDate);
                sb.Append("\n ER app status: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.ERAppStatus);
                sb.Append("\n ER TTG status: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.ERTtgStatus);
                sb.Append("\n Flex start date: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.FlexStartFlag);
                sb.Append("\n IES flag: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.IESFlag);
                sb.Append("\n ILS flag: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.ILSFlag);
                sb.Append("\n LDCS Category code: " +
                          ((response.CourseListResponse.RequestDetails.CourseSearchCriteria.LDCS != null) ?
                           response.CourseListResponse.RequestDetails.CourseSearchCriteria.LDCS.CategoryCode.ToString() : ""));
                sb.Append("\n Location: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.Location);
                sb.Append("\n Opps App closed flag: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.OppsAppClosedFlag);
                sb.Append("\n Other funding status: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.OtherFundingStatus);
                sb.Append("\n Provider ID: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.ProviderID);
                sb.Append("\n Provider Keyword: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.ProviderKeyword);
                sb.Append("\n Qualification levels: " +
                          ((response.CourseListResponse.RequestDetails.CourseSearchCriteria.QualificationLevels != null) ?
                           response.CourseListResponse.RequestDetails.CourseSearchCriteria.QualificationLevels.ToString() : "null"));
                sb.Append("\n Qualification types: " +
                          ((response.CourseListResponse.RequestDetails.CourseSearchCriteria.QualificationTypes != null) ?
                           response.CourseListResponse.RequestDetails.CourseSearchCriteria.QualificationTypes.ToString() : "null"));
                sb.Append("\n SFL flag: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.SFLFlag);
                sb.Append("\n Study modes: " +
                          ((response.CourseListResponse.RequestDetails.CourseSearchCriteria.StudyModes != null) ?
                           response.CourseListResponse.RequestDetails.CourseSearchCriteria.StudyModes.ToString() : "null"));
                sb.Append("\n Subject keyword: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.SubjectKeyword);
                sb.Append("\n TQS flag: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.TQSFlag);
                sb.Append("\n TTG flag: " + response.CourseListResponse.RequestDetails.CourseSearchCriteria.TTGFlag);
                sb.Append("\n\n");

                sb.Append("Course Details:");

                if (response.CourseListResponse.CourseDetails != null)
                {
                    foreach (CourseStructure courseStructure in response.CourseListResponse.CourseDetails)
                    {
                        sb.Append("\n" + courseStructure.Course.CourseID);
                        sb.Append("\n" + courseStructure.Provider);
                        sb.Append("\n" + courseStructure.Course.CourseTitle);
                        sb.Append("\n" + courseStructure.Course.QualificationType);
                        sb.Append("\n" + courseStructure.Course.QualificationLevel);
                        sb.Append("\n" + courseStructure.Course.CourseSummary);
                        sb.Append("\n" + courseStructure.Course.NoOfOpps);

                        sb.Append("\n" + courseStructure.Opportunity.OpportunityId);
                        sb.Append("\n" + courseStructure.Opportunity.StudyMode);
                        sb.Append("\n" + courseStructure.Opportunity.AttendanceMode);
                        sb.Append("\n" + courseStructure.Opportunity.AttendancePattern);
                        sb.Append("\n" + courseStructure.Opportunity.StartDate.Item);
                        sb.Append("\n" + courseStructure.Opportunity.Duration.DurationValue);
                        sb.Append("\n" + courseStructure.Opportunity.Duration.DurationUnit);
                        sb.Append("\n" + courseStructure.Opportunity.Duration.DurationDescription);

                        if (courseStructure.Opportunity.Item.GetType() == typeof(VenueInfo))
                        {
                            VenueInfo venue = (VenueInfo)courseStructure.Opportunity.Item;
                            sb.Append("\n" + venue.VenueName);
                            sb.Append("\n" + venue.Distance);
                            sb.Append("\n" + venue.VenueAddress.Address_line_1);
                            sb.Append("\n" + venue.VenueAddress.Address_line_2);
                            sb.Append("\n" + venue.VenueAddress.Town);
                            sb.Append("\n" + venue.VenueAddress.County);
                            sb.Append("\n" + venue.VenueAddress.PostCode);
                            sb.Append("\n" + venue.VenueAddress.Latitude);
                            sb.Append("\n" + venue.VenueAddress.Longitude);
                        }
                        else
                        {
                            sb.Append("\n" + (string)courseStructure.Opportunity.Item);
                        }

                        sb.Append("\n");
                    }
                }
                sb.Append("\n\n");

                sb.Append("Matching LDCS Details:");

                if (response.CourseListResponse.MatchingLDCS != null)
                {
                    foreach (CourseListResponseStructureMatchingLDCS mathcingLDCS in response.CourseListResponse.MatchingLDCS)
                    {
                        sb.Append("\n" + mathcingLDCS.LDCS.LDCSCode);
                        sb.Append("\n" + mathcingLDCS.LDCS.LDCSDesc);
                        sb.Append("\n" + mathcingLDCS.Counts);
                    }
                }
                sb.Append("\n\n");

                txtResult.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                txtResult.Text = ex.Message;
            }
        }
        /// <summary>
        /// On clicking CourseDetail button, calls CourseSearchService ClientDetail() method with test data.
        /// </summary>
        private void btnCourseDetail_Click(object sender, EventArgs e)
        {
            txtResult.Text = "Processing ...";

            ServiceInterface client = new ServiceInterfaceClient("CourseSearch");

            string[]          courseIds = { "53527655" };
            CourseDetailInput request   = new CourseDetailInput(courseIds, "");

            try
            {
                CourseDetailOutput response = client.CourseDetail(request);

                StringBuilder sb = new StringBuilder();
                sb.Append("Request details:");
                foreach (string s in response.RequestDetails.CourseID)
                {
                    sb.Append("\n" + s);
                }
                sb.Append("\n\n");

                sb.Append("Course details:");
                foreach (CourseDetailStructure courseDetail in response.CourseDetails)
                {
                    sb.Append("\n" + courseDetail.Course.CourseID);
                    sb.Append("\n" + courseDetail.Course.CourseTitle);
                    sb.Append("\n" + courseDetail.Course.CourseSummary);
                    sb.Append("\n" + courseDetail.Provider.ProviderID);
                    sb.Append("\n" + courseDetail.Provider.ProviderName);
                    sb.Append("\n" + courseDetail.Provider.UPIN);
                    sb.Append("\n" + courseDetail.Provider.Email);
                    sb.Append("\n" + courseDetail.Provider.Website);
                    sb.Append("\n");

                    sb.Append("Opportunity details:");
                    foreach (OpportunityDetail opportunityDetail in courseDetail.Opportunity)
                    {
                        sb.Append("\n" + opportunityDetail.ProviderOpportunityId);
                        sb.Append("\n" + opportunityDetail.URL);
                        sb.Append("\n" + opportunityDetail.A10);
                        sb.Append("\n" + opportunityDetail.ApplyFromDate);
                        sb.Append("\n" + opportunityDetail.ApplyUntilDate);
                        sb.Append("\n" + opportunityDetail.ApplyTo);
                        sb.Append("\n" + opportunityDetail.AttendanceMode);
                        sb.Append("\n" + opportunityDetail.AttendancePattern);
                        sb.Append("\n" + opportunityDetail.EnquireTo);
                        sb.Append("\n" + opportunityDetail.PlacesAvailable);
                        sb.Append("\n" + opportunityDetail.StudyMode);
                        sb.Append("\n" + opportunityDetail.Price);
                        sb.Append("\n");
                    }

                    sb.Append("Venue details:");
                    foreach (VenueDetail venueDetail in courseDetail.Venue)
                    {
                        sb.Append("\n" + venueDetail.VenueID);
                        sb.Append("\n" + venueDetail.VenueName);
                        sb.Append("\n" + venueDetail.Email);
                        sb.Append("\n" + venueDetail.Facilities);
                        sb.Append("\n" + venueDetail.Website);
                        sb.Append("\n");
                    }

                    sb.Append("\n");
                }

                txtResult.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                txtResult.Text = ex.Message;
            }
        }