Beispiel #1
0
        private void Populate()
        {
            OrderDetailPaging     paging = new OrderDetailPaging(this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage, OrderDetail.FieldNameConstants.OrderId, true);
            OrderDetailCollection orderDetailCollection = null;

            if (this.Request["orderid"] != null)
            {
                int orderId;
                int.TryParse(this.Request["orderid"], out orderId);
                orderDetailCollection = OrderDetailCollection.RunSelect(x => x.OrderId == orderId, paging);
                lblHeader.Text        = "This is a list of all orders details for order <a href='/OrderItem.aspx?id=" + orderId + "'>" + orderId + "</a>.";
            }
            else if (this.Request["productid"] != null)
            {
                int productId = int.Parse(this.Request["productid"]);
                orderDetailCollection = OrderDetailCollection.RunSelect(x => x.ProductId == productId, paging);
                Product product = Product.SelectUsingPK(productId);
                lblHeader.Text = "This is a list of all orders details for product <a href='/ProductItem.aspx?id=" + product.ProductId + "'>" + product.ProductName + "</a>.";
            }
            else
            {
                orderDetailCollection = OrderDetailCollection.RunSelect(x => true, paging);
                lblHeader.Text        = "This is a list of all order details.";
            }

            this.PagingControl1.ItemCount = paging.RecordCount;
            grdItem.DataSource            = orderDetailCollection;
            grdItem.DataBind();
            SessionHelper.LastOrderListSearch = this.Request.Url.AbsoluteUri;
        }