コード例 #1
0
ファイル: ProductList.aspx.cs プロジェクト: nicknow/nHydrate
        private void Populate()
        {
            ProductPaging     paging            = new ProductPaging(this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage, Product.FieldNameConstants.ProductId, true);
            ProductCollection productCollection = null;

            if (this.Request["categoryId"] != null)
            {
                int categoryId;
                int.TryParse(this.Request["categoryId"], out categoryId);
                productCollection = ProductCollection.RunSelect(x => x.CategoryId == categoryId, paging);
                Category category = Category.SelectUsingPK(categoryId);
                lblHeader.Text = "This is a list of all products for category <a href='/CategoryItem.aspx?id=" + category.CategoryId + "'>" + category.CategoryName + "</a>.";
            }
            else if (this.Request["supplierId"] != null)
            {
                int supplierId;
                int.TryParse(this.Request["supplierId"], out supplierId);
                productCollection = ProductCollection.RunSelect(x => x.SupplierId == supplierId, paging);
                Supplier supplier = Supplier.SelectUsingPK(supplierId);
                lblHeader.Text = "This is a list of all products for supplier <a href='/SupplierItem.aspx?id=" + supplier.SupplierId + "'>" + supplier.CompanyName + "</a>.";
            }
            else
            {
                productCollection = ProductCollection.RunSelect(x => true, paging);
                lblHeader.Text    = "This is a list of all products.";
            }

            this.PagingControl1.ItemCount = paging.RecordCount;
            grdItem.DataSource            = productCollection;
            grdItem.DataBind();
            SessionHelper.LastOrderListSearch = this.Request.Url.AbsoluteUri;
        }
コード例 #2
0
ファイル: ProductList.aspx.cs プロジェクト: nHydrate/nHydrate
		private void Populate()
		{
			ProductPaging paging = new ProductPaging(this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage, Product.FieldNameConstants.ProductId, true);
			ProductCollection productCollection = null;

			if (this.Request["categoryId"] != null)
			{
				int categoryId;
				int.TryParse(this.Request["categoryId"], out categoryId);
				productCollection = ProductCollection.RunSelect(x => x.CategoryId == categoryId, paging);
				Category category = Category.SelectUsingPK(categoryId);
				lblHeader.Text = "This is a list of all products for category <a href='/CategoryItem.aspx?id=" + category.CategoryId + "'>" + category.CategoryName + "</a>.";
			}
			else if (this.Request["supplierId"] != null)
			{
				int supplierId;
				int.TryParse(this.Request["supplierId"], out supplierId);
				productCollection = ProductCollection.RunSelect(x => x.SupplierId == supplierId, paging);
				Supplier supplier = Supplier.SelectUsingPK(supplierId);
				lblHeader.Text = "This is a list of all products for supplier <a href='/SupplierItem.aspx?id=" + supplier.SupplierId + "'>" + supplier.CompanyName + "</a>.";
			}
			else
			{
				productCollection = ProductCollection.RunSelect(x => true, paging);
				lblHeader.Text = "This is a list of all products.";
			}

			this.PagingControl1.ItemCount = paging.RecordCount;
			grdItem.DataSource = productCollection;
			grdItem.DataBind();
			SessionHelper.LastOrderListSearch = this.Request.Url.AbsoluteUri;
		}
コード例 #3
0
        public void getRevenueSumBy4()
        {
            var target = new ProductPaging();
            string fieldName = "Revenue";
            int groupNumber = 4;

            var actual = target.getSumByFieldName(fieldName, groupNumber);

            var excepted = new int[] { 50, 66, 60 };

            excepted.ToExpectedObject().ShouldEqual(actual);
        }
コード例 #4
0
        public void getCostSumBy3()
        {
            //arrange
            IProductDao products = Substitute.For<IProductDao>();
            products.getData().Returns(_products);

               var target = new ProductPaging();
               string fieldName = "Cost";
               int groupNumber = 3;

            //act
               var actual = target.getSumByFieldName(fieldName, groupNumber);

               var excepted = new int[] { 6, 15, 24, 24 };

               //assert
               excepted.ToExpectedObject().ShouldEqual(actual);
        }