private void frmTraineeCourse_Load(object sender, EventArgs e) { this.Tag = "Bereket"; LoadTraineeCourses(); BusinessLogic.TraineeManager traineeManager = new BusinessLogic.TraineeManager(); List <BusinessEntity.TraineeEntity> trainees = traineeManager.GetAll(); cboTrainee.DataSource = trainees; cboTrainee.ValueMember = "ID"; cboTrainee.DisplayMember = "Fullname"; BusinessLogic.CourseManager courseManager = new BusinessLogic.CourseManager(); List <BusinessEntity.CourseEntity> courses = courseManager.GetAll(); cboCourse.DataSource = courses; cboCourse.ValueMember = "ID"; cboCourse.DisplayMember = "Title"; }
private void LoadCourses() { BusinessLogic.CourseManager courseManager = new BusinessLogic.CourseManager(); List <BusinessEntity.CourseEntity> courseEntities = courseManager.GetAll(); listViewCourse.Items.Clear(); if (courseEntities == null) { MessageBox.Show("Sorry database error occured, please try again."); } else { foreach (BusinessEntity.CourseEntity courseEntity in courseEntities) { ListViewItem item = new ListViewItem(courseEntity.ID.ToString()); item.SubItems.Add(courseEntity.Title); listViewCourse.Items.Add(item); } } }
private void PopulateCombobox() { //populate gender BusinessLogic.GenderManager genderManager = new BusinessLogic.GenderManager(); List <BusinessEntity.GenderEntity> genders = genderManager.GetAll(); genders.Add(new BusinessEntity.GenderEntity() { ID = 0, Title = "All" }); cboGender.DataSource = genders.OrderBy(x => x.ID).ToList(); cboGender.ValueMember = "ID"; cboGender.DisplayMember = "Title"; //populate academic level BusinessLogic.AcademicLevelManager academicLevelManager = new BusinessLogic.AcademicLevelManager(); List <BusinessEntity.AcademicLevelEntity> academicLevels = academicLevelManager.GetAll(); academicLevels.Add(new BusinessEntity.AcademicLevelEntity() { ID = 0, Title = "All" }); cboAcademicLevel.DataSource = academicLevels.OrderBy(x => x.ID).ToList(); cboAcademicLevel.ValueMember = "ID"; cboAcademicLevel.DisplayMember = "Title"; //populate trainee BusinessLogic.TraineeManager traineeManager = new BusinessLogic.TraineeManager(); List <BusinessEntity.TraineeEntity> trainees = traineeManager.GetAll(); trainees.Add(new BusinessEntity.TraineeEntity() { ID = 0, Fullname = "All" }); cboTrainee.DataSource = trainees.OrderBy(x => x.ID).ToList(); cboTrainee.ValueMember = "ID"; cboTrainee.DisplayMember = "Fullname"; cboTraineePayment.DataSource = trainees.OrderBy(x => x.ID).ToList(); cboTraineePayment.ValueMember = "ID"; cboTraineePayment.DisplayMember = "Fullname"; //populate course BusinessLogic.CourseManager courseManager = new BusinessLogic.CourseManager(); List <BusinessEntity.CourseEntity> courses = courseManager.GetAll(); courses.Add(new BusinessEntity.CourseEntity() { ID = 0, Title = "All" }); cboCourse.DataSource = courses.OrderBy(x => x.ID).ToList(); cboCourse.ValueMember = "ID"; cboCourse.DisplayMember = "Title"; cboCoursePayment.DataSource = courses.OrderBy(x => x.ID).ToList(); cboCoursePayment.ValueMember = "ID"; cboCoursePayment.DisplayMember = "Title"; }