private void DisplayDepartments()
    {
        DeptListQueryParams param = new DeptListQueryParams()
        {
            Kw = c.qsKw
        };

        param.PagedParams = new PagedListQueryParams()
        {
            BeginNum   = 0,
            EndNum     = 0,
            SortField  = c.qsSortField,
            IsSortDesc = c.qsIsSortDesc
        };

        param.AuthParams = new AuthenticationQueryParams()
        {
            CanReadSubItemOfOthers = empAuth.CanReadSubItemOfOthers(),
            CanReadSubItemOfCrew   = empAuth.CanReadSubItemOfCrew(),
            CanReadSubItemOfSelf   = empAuth.CanReadSubItemOfSelf(),
            MyAccount = c.GetEmpAccount(),
            MyDeptId  = c.GetDeptId()
        };

        // get total of items
        empAuth.GetDepartmentList(param);

        // update pager and get begin end of item numbers
        int itemTotalCount = param.PagedParams.RowCount;

        ucDataPager.Initialize(itemTotalCount, c.qsPageCode);
        if (IsPostBack)
        {
            ucDataPager.RefreshPagerAfterPostBack();
        }

        param.PagedParams = new PagedListQueryParams()
        {
            BeginNum   = ucDataPager.BeginItemNumberOfPage,
            EndNum     = ucDataPager.EndItemNumberOfPage,
            SortField  = c.qsSortField,
            IsSortDesc = c.qsIsSortDesc
        };

        List <DepartmentForBackend> depts = empAuth.GetDepartmentList(param);

        if (depts != null)
        {
            rptDepartments.DataSource = depts;
            rptDepartments.DataBind();
        }

        if (c.qsPageCode > 1 || c.qsSortField != "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "isSearchPanelCollapsingAtBeginning", "isSearchPanelCollapsingAtBeginning = true;", true);
        }
    }
示例#2
0
        /// <summary>
        /// 取得部門清單
        /// </summary>
        public List <DepartmentForBackend> GetDepartmentList(DeptListQueryParams param)
        {
            List <DepartmentForBackend> entities = null;

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                entities = empAuthDao.GetDepartmentListForBackend(param);
                dbErrMsg = empAuthDao.GetErrMsg();
            }

            return(entities);
        }