Пример #1
0
        private void btnSearchTrainee_Click(object sender, EventArgs e)
        {
            BusinessLogic.TraineeManager        traineeManager = new BusinessLogic.TraineeManager();
            List <BusinessEntity.TraineeEntity> traineeEntities;

            traineeEntities = traineeManager.GetAll();
            if (cboSearchGender.Text != string.Empty && cboSearchGender.Text != "All")
            {
                traineeEntities = traineeEntities.Where(x => x.GenderEntity.Title == cboSearchGender.Text).ToList();
            }

            if (txtSearchFullname.Text != string.Empty)
            {
                traineeEntities = traineeEntities.Where(x => x.Fullname.ToLower().Contains(txtSearchFullname.Text.ToLower())).ToList();
            }

            listViewTrainee.Items.Clear();
            if (traineeEntities == null)
            {
                MessageBox.Show("Sorry database error occured, please try again.");
            }
            else
            {
                foreach (BusinessEntity.TraineeEntity traineeEntity in traineeEntities)
                {
                    ListViewItem item = new ListViewItem(traineeEntity.ID.ToString());
                    item.SubItems.Add(traineeEntity.Fullname);
                    item.SubItems.Add(traineeEntity.PhoneNumber);

                    listViewTrainee.Items.Add(item);
                }
            }
        }
        private void LoadTrainees()
        {
            BusinessLogic.TraineeManager        traineeManager  = new BusinessLogic.TraineeManager();
            List <BusinessEntity.TraineeEntity> traineeEntities = traineeManager.GetAll();

            listViewTrainee.Items.Clear();
            if (traineeEntities == null)
            {
                MessageBox.Show("Sorry database error occured, please try again.");
            }
            else
            {
                foreach (BusinessEntity.TraineeEntity traineeEntity in traineeEntities)
                {
                    ListViewItem item = new ListViewItem(traineeEntity.ID.ToString());
                    item.SubItems.Add(traineeEntity.Fullname);
                    item.SubItems.Add(traineeEntity.BirthDate.ToString());
                    item.SubItems.Add(traineeEntity.GenderEntity.Title);
                    item.SubItems.Add(traineeEntity.AcademicLevelEntity.Title);
                    item.SubItems.Add(traineeEntity.BranchEntity.Name);
                    item.SubItems.Add(traineeEntity.Address);
                    item.SubItems.Add(traineeEntity.PhoneNumber);

                    listViewTrainee.Items.Add(item);
                }
            }
        }
Пример #3
0
        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";
        }
Пример #4
0
        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";
        }