public void GetEmployeeStatus()
        {
            try
            {
                db     = new LetranIntegratedSystemEntities();
                ESList = new List <EmployeeStatusList>();


                var empstat = db.GetHRiSEmployeebyStatus().ToList();

                foreach (var x in empstat)
                {
                    EmployeeStatusList e = new EmployeeStatusList();

                    if (x.DateHired.HasValue)
                    {
                        e.DateHired = x.DateHired.Value;
                    }
                    else
                    {
                    }
                    if (x.Archive.HasValue)
                    {
                        e.Archive = x.Archive.Value;
                    }
                    else
                    {
                        e.Archive = true;
                    }

                    e.EmployeeID     = x.EmployeeID;
                    e.EmployeeNumber = Convert.ToInt32(x.EmployeeNo);
                    e.EmployeeName   = x.EmployeeName;
                    e.Department     = x.Department;
                    e.DepartmentID   = x.AcaDeptID;
                    e.Designation    = x.Designation;
                    e.DesignationID  = x.EmployeeDesignationID;

                    e.SeparationDate     = x.SeparationDate.ToString();
                    e.EmployeeStatusID   = x.EmployeeStatusID;
                    e.EmployeeStatusCode = x.EmployeeStatusCode;
                    e.TIN        = x.TIN;
                    e.SSS        = x.SSS;
                    e.PAGIBIG    = x.PAG_IBIG;
                    e.PHILHEALTH = x.PhilHealth;

                    ESList.Add(e);
                }
                if (rbAll.IsChecked == true)
                {
                    ESList = ESList.OrderBy(m => m.EmployeeName).ToList();
                }
                else if (rbPermanent.IsChecked == true)
                {
                    ESList = ESList.Where(m => m.EmployeeStatusID == 3).OrderBy(m => m.EmployeeName).ToList();
                }
                else if (rbProbitionary.IsChecked == true)
                {
                    ESList = ESList.Where(m => m.EmployeeStatusID == 1).OrderBy(m => m.EmployeeName).ToList();
                }
                else if (rbContractual.IsChecked == true)
                {
                    ESList = ESList.Where(m => m.EmployeeStatusID == 2).OrderBy(m => m.EmployeeName).ToList();
                }
                if (chkArchive.IsChecked == true)
                {
                    ESList = ESList.Where(m => m.Archive == true).OrderBy(m => m.EmployeeName).ToList();
                }
                else
                {
                    ESList = ESList.Where(m => m.Archive == false).OrderBy(m => m.EmployeeName).ToList();
                }
                if (!String.IsNullOrEmpty(cbDesignation.Text))
                {
                    int desid = Convert.ToInt32(cbDesignation.SelectedValue);
                    ESList = ESList.Where(m => m.DesignationID == desid).OrderBy(m => m.EmployeeName).ToList();
                }

                dgEmpStatus.ItemsSource = ESList.OrderBy(m => m.EmployeeName);
                lblCount.Content        = "Count: " + ESList.Count.ToString();
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong!", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }