Exemplo n.º 1
0
    private void DisplayAccounts()
    {
        AccountListQueryParams param = new AccountListQueryParams()
        {
            ListMode = c.qsEmpRange,
            DeptId   = c.qsDeptId,
            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.GetAccountList(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 <EmployeeForBackend> accounts = empAuth.GetAccountList(param);

        if (accounts != null)
        {
            rptAccounts.DataSource = accounts;
            rptAccounts.DataBind();
        }

        if (c.qsPageCode > 1 || c.qsSortField != "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "isSearchPanelCollapsingAtBeginning", "isSearchPanelCollapsingAtBeginning = true;", true);
        }
    }