/// <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;
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            certificateId = Request.QueryString["id"];

            if (!IsPostBack)
            {
                var certificate = CertificateService.GetCertificateById(certificateId, SessionVariable.Current.Company.Id);

                if (certificate != null)
                {
                    Name.Text                = certificate.Name;
                    Description.Text         = certificate.Description;
                    ExpiryType.SelectedValue = ((int)certificate.ExpiryType).ToString();
                    ExpiryMonth.Text         = certificate.ExpiryMonth.ToString();

                    if (certificate.ExpiryType == CertificateExpiryType.Term)
                    {
                        showExpiryPanel = true;
                    }

                    CourseRepeater.DataSource = certificate.GetAttachedCourses().ToList();
                    CourseRepeater.DataBind();
                }
            }
        }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CourseRepeater.DataSource = CourseService.LoadAllCourses(SessionVariable.Current.Company.Id).OrderBy(x => x.Name).ToList();
         CourseRepeater.DataBind();
     }
 }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SearchControl1.SearchButtonClick += new EventHandler(SearchBtn_Click);

            if (!IsPostBack)
            {
                CourseRepeater.DataSource = CourseService.LoadAllCourses(SessionVariable.Current.Company.Id, SessionVariable.Current.User.UserType).ToList();
                CourseRepeater.DataBind();
            }
        }
예제 #5
0
        protected void SearchBtn_Click(object sender, EventArgs e)
        {
            Func <Lms.Domain.Models.Courses.Course, bool> nameFilter = x => x.Name.Contains(SearchControl1.Keyword);
            Func <Lms.Domain.Models.Courses.Course, bool> descFilter = x => x.Description.Contains(SearchControl1.Keyword);
            Func <Lms.Domain.Models.Courses.Course, bool> predicate  = x => nameFilter(x) || descFilter(x);

            var courses = CourseService.FindCourses(SessionVariable.Current.Company.Id, predicate);

            CourseRepeater.DataSource = courses;
            CourseRepeater.DataBind();
        }