Пример #1
0
        public void LoadComboBox()
        {
            try
            {
                using (var db = new LetranIntegratedSystemEntities())
                {
                    EList = new List <HRiSClass.EmpCombo>();

                    var emp = db.Employees.Where(m => m.Archive == false).ToList();

                    foreach (var i in emp)
                    {
                        HRiSClass.EmpCombo ec = new HRiSClass.EmpCombo();
                        ec.EmployeeID     = i.EmployeeID;
                        ec.EmployeeNumber = i.EmployeeNo;
                        ec.EmployeeName   = i.LastName.ToUpper() + ", " + i.FirstName.ToUpper();
                        EList.Add(ec);
                    }

                    cbEmployee.ItemsSource       = EList.OrderBy(m => m.EmployeeName);
                    cbEmployee.DisplayMemberPath = "EmployeeName";
                    cbEmployee.SelectedValuePath = "EmployeeID";

                    var dept = db.AcademicDepartments.ToList();
                    cbDepartment.ItemsSource       = dept.OrderBy(m => m.AcaDepartmentName);
                    cbDepartment.DisplayMemberPath = "AcaDepartmentName";
                    cbDepartment.SelectedValuePath = "AcaDeptID";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
        public void LoadComboBox()
        {
            try
            {
                EList = new List <HRiSClass.EmpCombo>();
                using (var db = new LetranIntegratedSystemEntities())
                {
                    var listbal = db.AspNetUsers.ToList();

                    var listemp = db.Employees.Where(m => m.Archive == false).ToList();

                    var x = (from a in listemp
                             where listbal.Select(m => m.UserName).Contains(a.EmployeeNo)
                             select a).ToList();

                    foreach (var i in x)
                    {
                        HRiSClass.EmpCombo ec = new HRiSClass.EmpCombo();
                        ec.EmployeeID     = i.EmployeeID;
                        ec.EmployeeNumber = i.EmployeeNo;
                        ec.EmployeeName   = i.LastName.ToUpper() + ", " + i.FirstName.ToUpper();
                        EList.Add(ec);
                    }

                    cbEmp.ItemsSource       = EList.OrderBy(m => m.EmployeeName);
                    cbEmp.DisplayMemberPath = "EmployeeName";
                    cbEmp.SelectedValuePath = "EmployeeID";

                    var roles = db.AspNetRoles.Where(m => m.Id != "6" && m.Id != "1" && m.Id != "7").ToList();

                    cbRole.ItemsSource       = roles.OrderBy(m => m.Name);
                    cbRole.DisplayMemberPath = "Name";
                    cbRole.SelectedValuePath = "Id";

                    //
                    cbEmp.SelectedValue  = db.Employees.Where(m => m.EmployeeNo == empno).FirstOrDefault().EmployeeID;
                    cbRole.SelectedValue = db.AspNetUserRoles.Where(m => m.UserId == userid).FirstOrDefault().RoleId;
                    txtEmail.Text        = db.Employees.Where(m => m.EmployeeNo == empno).FirstOrDefault().PrimaryEmail;
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #3
0
        public void LoadComboBox()
        {
            try
            {
                using (var db = new LetranIntegratedSystemEntities())
                {
                    EList      = new List <HRiSClass.EmpCombo>();
                    lShiftList = new List <HRISShift>();
                    var emp = db.Employees.Where(m => m.Archive == false && m.EmployeeScheduleId == null).ToList();

                    foreach (var i in emp)
                    {
                        HRiSClass.EmpCombo ec = new HRiSClass.EmpCombo();
                        ec.EmployeeID     = i.EmployeeID;
                        ec.EmployeeNumber = i.EmployeeNo;
                        ec.EmployeeName   = i.LastName.ToUpper() + ", " + i.FirstName.ToUpper();
                        EList.Add(ec);
                    }

                    cbEmployee.ItemsSource       = EList.OrderBy(m => m.EmployeeName);
                    cbEmployee.DisplayMemberPath = "EmployeeName";
                    cbEmployee.SelectedValuePath = "EmployeeID";

                    var shift = db.HRISShifts.ToList();

                    foreach (var x in shift)
                    {
                        HRISShift hrisShift = new HRISShift();
                        hrisShift.ShiftCode = x.ShiftCode;
                        lShiftList.Add(hrisShift);
                    }
                    cbShiftCode.ItemsSource       = lShiftList.OrderBy(m => m.ShiftCode);
                    cbShiftCode.DisplayMemberPath = "ShiftCode";
                    cbShiftCode.SelectedValuePath = "ShiftCode";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }