Example #1
0
        private void ListUsers()
        {
            SetLocalPerson(null);
            isNew = false;
            List <PERSON> userList;

            if (ddlListStatus.SelectedValue == "A")
            {
                userList = SQMModelMgr.SearchPersonList(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", true);
            }
            else if (ddlListStatus.SelectedValue == "I")
            {
                userList = SQMModelMgr.SearchPersonList(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false).Where(l => l.STATUS == "I").ToList();
            }
            else if (ddlListStatus.SelectedValue == "PA")
            {
                userList = SQMModelMgr.SearchPersonList(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false).Where(l => l.ROLE == 150).ToList();
            }
            else if (ddlListStatus.SelectedValue == "CA")
            {
                userList = SQMModelMgr.SearchPersonList(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false).Where(l => l.ROLE <= 100).ToList();
            }
            else
            {
                userList = SQMModelMgr.SearchPersonList(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);
            }

            string selectedModule = ddlListModule.SelectedValue;

            if (selectedModule == "EHS" || selectedModule == "SQM")
            {
                for (int n = userList.Count - 1; n >= 0; n--)
                {
                    PERSON person = userList[n];
                    if (SQMModelMgr.CheckProductModuleAccess(person, selectedModule) == false)
                    {
                        userList.Remove(person);
                    }
                }
            }

            uclUserList.BindUserList(userList.Where(l => l.ROLE > 1).OrderBy(l => l.LAST_NAME).ToList(), SessionManager.EffLocation.Company.COMPANY_ID);
            lblUserCount_out.Text = userList.Count.ToString();
        }