Пример #1
0
    /// <summary>
    /// populate the grid from this accounts data
    /// </summary>
    /// <param name="se">sort expression</param>
    /// <param name="sd">sort direction</param>
    /// <param name="pi">page index</param>
    protected void LoadGrid(string se, SortDirection sd, int pi)
    {
        Affinity.OrderCriteria oc = new Affinity.OrderCriteria();
        oc.AppendToOrderBy(se, sd == SortDirection.Descending);

        // don't show closed orders unless the box is checked
        oc.HideInternalClosed = (!cbShowClosed.Checked);

        // set the page index after binding
        oGrid.PageIndex = pi;

        // TODO: implment custom paging for performance
        oc.PagingEnabled    = true;
        oc.PageSize         = oGrid.PageSize;
        oc.Page             = oGrid.PageIndex + 1;
        oc.OrderUploadLogId = (cbShowStandard.Checked)? 0 : 1;

        if (txtQuery.Text != "")
        {
            oc.SearchQuery = txtQuery.Text;
            // TODO: implement closed
            //oc.CustomerStatusCode = cbShowClosed.Checked ? "" : "";
            searchFilter = false;
        }

        Affinity.Orders orders = new Affinity.Orders(this.phreezer);
        orders.Query(oc);

        oGrid.DataSource = orders;
        oGrid.DataBind();


        ViewState["lastSE"] = se;
        ViewState["lastSD"] = sd;
    }