本文整理汇总了C#中ProductType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ProductType.ToString方法的具体用法?C# ProductType.ToString怎么用?C# ProductType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductType
的用法示例。
在下文中一共展示了ProductType.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProdCategoriesForDomain
public List<tbl_ProdCategories> GetProdCategoriesForDomain(int domainID, int parentID, bool includeDeleted, ProductType type = ProductType.AllProducts)
{
var query = ProdCategoriesRepository.GetAll().Where(pc => pc.tbl_SiteMap.SM_DomainID == domainID && pc.PC_Live &&
pc.tbl_SiteMap.tbl_Content.Any(c => c.C_Approved && !c.C_Deleted));
if (!includeDeleted)
query = query.Where(pc => pc.PC_Deleted == false);
return (type != ProductType.AllProducts) ?
query.OrderBy(pc => pc.PC_Order).ToList()
.Where(pc => pc.PC_ParentID.GetValueOrDefault(0) == parentID && pc.tbl_ProductTypes.PT_Name == type.ToString()).ToList() :
query.OrderBy(pc => pc.PC_Order).ToList()
.Where(pc => pc.PC_ParentID.GetValueOrDefault(0) == parentID).ToList();
}
示例2: GetProductsByType
public PagedResult<Product> GetProductsByType(ProductType type, int page, int itemsPerPage)
{
PagedResult<Product> result = new PagedResult<Product>();
result.PageNumber = page;
result.ItemsPerPage = itemsPerPage;
using (SqlConnection connection = new SqlConnection(this._connectionString))
{
string sql = @"Select * From VintageRabbit.Products Where [Type] = @Type Order By DateCreated Desc OFFSET @Offset ROWS FETCH NEXT @ResultsPerPage ROWS ONLY;
Select Count(*) From VintageRabbit.Products Where [Type] = @Type;";
int offset = (page - 1) * itemsPerPage;
using (var multi = connection.QueryMultiple(sql, new { Type = type.ToString(), Offset = offset, ResultsPerPage = itemsPerPage }))
{
var productResults = multi.Read<ProductDb>();
foreach (var product in productResults)
{
result.Add(this.ConvertToProduct(product));
}
result.TotalResults = multi.Read<int>().First();
}
}
return result;
}
示例3: GetProductsByCategory
public PagedResult<Product> GetProductsByCategory(ProductType type, Category category, int page, int itemsPerPage)
{
PagedResult<Product> result = new PagedResult<Product>();
result.PageNumber = page;
result.ItemsPerPage = itemsPerPage;
IList<int> categoryIds = new List<int>() { category.Id };
foreach(var child in category.Children)
{
categoryIds.Add(child.Id);
}
string sql = @"Select * From VintageRabbit.Products
Where [Type] = @Type And VintageRabbit.Products.Id In (Select Distinct ProductId From VintageRabbit.ProductCategories Where CategoryId In @CategoryIds)
Order By DateCreated Desc
OFFSET @Offset ROWS FETCH NEXT @ResultsPerPage ROWS ONLY;
Select Count(*) From VintageRabbit.Products Where [Type] = @Type And VintageRabbit.Products.Id In (Select Distinct ProductId From VintageRabbit.ProductCategories Where CategoryId In @CategoryIds);";
int offset = (page - 1) * itemsPerPage;
using (SqlConnection connection = new SqlConnection(this._connectionString))
{
using (var multi = connection.QueryMultiple(sql, new { CategoryIds = categoryIds, Type = type.ToString(), Offset = offset, ResultsPerPage = itemsPerPage }))
{
var productResults = multi.Read<ProductDb>();
foreach (var product in productResults)
{
result.Add(this.ConvertToProduct(product));
}
result.TotalResults = multi.Read<int>().First();
}
}
return result;
}
示例4: GetWithContent
public static IEnumerable<tbl_Products> GetWithContent(this EntityCollection<tbl_Products> table, ProductType type)
{
return table.Where(p => !p.P_Deleted && p.P_Live &&
p.tbl_ProductTypes.PT_Name.Equals(type.ToString()) &&
p.tbl_SiteMap.tbl_Content.Any(c => c.C_Approved && !c.C_Deleted)).OrderBy(p => p.P_Order);
}
示例5: CreateProductEntries
private void CreateProductEntries(ProductType type)
{
var entries = _products.Where(p => p.type == type);
if (entries.Any())
{
EditorGUILayout.Separator();
EditorGUILayout.LabelField(type.ToString() + "s");
foreach (var p in entries)
{
CreateProductEntry(p);
}
}
}
示例6: CreateNewProduct
public virtual IProduct CreateNewProduct(ProductType type, String productName, int productPrice)
{
if (type == ProductType.Bags)
{
return new FactoryVivienneBags(productName, productPrice);
}
else if (type == ProductType.Shoes)
{
return new FactoryVivienneShoes(productName, productPrice);
}
if (type == ProductType.Dresses || type == ProductType.Coats)
{
return new BaseWear(productName, productPrice, type.ToString());
}
return null;
}