Exemplo n.º 1
0
        private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                db     = new LetranIntegratedSystemEntities();
                EGList = new List <EmployeeGenderList>();

                var emp = db.GetHRiSListbyGender().ToList();

                foreach (var x in emp)
                {
                    EmployeeGenderList egl = new EmployeeGenderList();
                    egl.Department   = x.AcaDepartmentName;
                    egl.EmployeeName = x.EmployeeName;
                    egl.Gender       = x.Gender;
                    EGList.Add(egl);
                }
                if (!String.IsNullOrEmpty(cbDepartment.Text))
                {
                    string dept = cbDepartment.SelectedValue.ToString();

                    EGList = EGList.Where(m => m.Department == dept).ToList();
                }
                EGList = EGList.OrderBy(m => m.Department).ToList();
                ListCollectionView eglcollection = new ListCollectionView(EGList);
                eglcollection.GroupDescriptions.Add(new PropertyGroupDescription("Department"));
                dgEmployeeGender.ItemsSource = eglcollection;
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
        public void GridRefresh()
        {
            try
            {
                db     = new LetranIntegratedSystemEntities();
                EGList = new List <EmployeeGenderList>();

                var emp = db.GetHRiSListbyGender().ToList();

                foreach (var x in emp)
                {
                    EmployeeGenderList egl = new EmployeeGenderList();
                    egl.Department   = x.AcaDepartmentName;
                    egl.EmployeeName = x.EmployeeName;
                    egl.Gender       = x.Gender;
                    EGList.Add(egl);
                }
                EGList = EGList.OrderBy(m => m.Department).ToList();
                ListCollectionView eglcollection = new ListCollectionView(EGList);
                eglcollection.GroupDescriptions.Add(new PropertyGroupDescription("Department"));
                dgEmployeeGender.ItemsSource = eglcollection;
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }