コード例 #1
0
        private void LoadItems()
        {
            string description = null;
            string name        = null;
            string countryName = null;
            ShippingOptionSortingType orderBy = ShippingOptionSortingType.IdAsc;

            if (HasState(DESCRIPTION_FILTER))
            {
                description = GetStringState(DESCRIPTION_FILTER);
            }
            if (HasState(SHIPPING_COUNTRY_FILTER))
            {
                countryName = GetStringState(SHIPPING_COUNTRY_FILTER);
            }
            if (HasState(SHIPPING_NAME_FILTER))
            {
                name = GetStringState(SHIPPING_NAME_FILTER);
            }
            if (HasState("OrderBy"))
            {
                orderBy = (ShippingOptionSortingType)GetIntState("OrderBy");
            }

            var result = ShippingService.GetPagedShippingOptionOverviewModel(
                pageIndex: gvItems.CustomPageIndex,
                pageSize: gvItems.PageSize,
                description: description,
                name: name,
                countryName: countryName,
                orderBy: orderBy);

            if (result != null)
            {
                gvItems.DataSource      = result.Items;
                gvItems.RecordCount     = result.TotalCount;
                gvItems.CustomPageCount = result.TotalPages;
            }

            gvItems.DataBind();

            if (gvItems.Rows.Count <= 0)
            {
                enbNotice.Message = "No records found.";
            }
        }