本文整理汇总了C#中ProductCategory类的典型用法代码示例。如果您正苦于以下问题:C# ProductCategory类的具体用法?C# ProductCategory怎么用?C# ProductCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProductCategory类属于命名空间,在下文中一共展示了ProductCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public ActionResult Create(ProductCategory model)
{
if (ModelState.IsValid)
{
var retry = 0;
Exception exception = null;
while(retry < 5)
{
try
{
model.ModifiedDate = DateTime.Now;
model.rowguid = Guid.NewGuid();
_context.ProductCategories.Add(model);
_context.SaveChanges();
return RedirectToAction("Query");
}
catch (Exception ex)
{
exception = ex;
retry++;
}
}
if(exception != null)
ModelState.AddModelError("", exception.ToString());
}
AddCategoriesDDL();
return View(model);
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strTitle, strDescription, strMetaTitle, strMetaDescription;
if (!string.IsNullOrEmpty(Request.QueryString["ni"]))
{
var oProduct = new Product();
var oProductCategory = new ProductCategory();
var dv = oProduct.ProductSelectOne(Request.QueryString["ni"]).DefaultView;
if (dv != null && dv.Count <= 0) return;
var row = dv[0];
var dv2 = oProductCategory.ProductCategorySelectOne(row["CategoryID"].ToString()).DefaultView;
strTitle = Server.HtmlDecode(row["ProductName"].ToString());
strDescription = Server.HtmlDecode(row["Description"].ToString());
strMetaTitle = Server.HtmlDecode(row["MetaTittle"].ToString());
strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());
lblTitleProduct.Text = dv2[0]["ProductCategoryName"].ToString();
}
else
{
strTitle = strMetaTitle = "Nghiên Cứu Phát Triển";
strDescription = "";
strMetaDescription = "";
}
Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
Header.Controls.Add(meta);
}
}
示例3: ProductCategory
public ProductCategory(string code, string name, string description, ProductCategory parentCategory)
: base(code)
{
_name = name;
_description = description;
_parentCategory = parentCategory;
}
示例4: AddProductCategory
public static void AddProductCategory(KetchupContext context)
{
var price = context.ProductAttributeTypes.First(pat => pat.Name == "Price");
var name = context.ProductAttributeTypes.First(pat => pat.Name == "Name");
var category = new ProductCategory
{
Name = "Default Product Category"
};
context.ProductCategorys.AddOrUpdate(pc => pc.Name, category);
var specifications = new []
{
new ProductCategorySpecificationAttribute
{
Attribute = price,
ProductCategory = category,
ProductAttributeTypeId = price.Id,
ProductCategoryId = category.Id
},
new ProductCategorySpecificationAttribute
{
Attribute = name,
ProductCategory = category,
ProductAttributeTypeId = price.Id,
ProductCategoryId = category.Id
},
};
context.ProductCategorySpecificationAttributes.AddOrUpdate(
pcsa => new { pcsa.ProductAttributeTypeId, pcsa.ProductCategoryId },
specifications);
}
示例5: ProductListItem
public ProductListItem(ProductCategory model,int Belong)
{
this.ID = model.ID;
this.Title = model.Content;
this.Url = "/Product/Index?Category="+model.ID+"&Belong="+(int)model.Belong;
this.FacePath = "/Product/ProductCategoryImgage/" + model.ID;
}
示例6: Product
public Product(string name, decimal unitPrice, ProductCategory category, ImageInfo image)
{
this.Name = name;
this.UnitPrice = unitPrice;
this.Category = category;
this.Image = image;
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//if (((DataView)odsTinTuc.Select()).Count <= DataPager1.PageSize)
//{
// DataPager1.Visible = false;
//}
string strTitle, strDescription, strMetaTitle, strMetaDescription;
if (!string.IsNullOrEmpty(Request.QueryString["pi"]))
{
var oProduct = new Product();
var oProductCategory = new ProductCategory();
var dv = oProduct.ProductSelectOne(Request.QueryString["pi"]).DefaultView;
if (dv != null && dv.Count <= 0) return;
var row = dv[0];
strTitle = Server.HtmlDecode(row["ProductName"].ToString());
strDescription = Server.HtmlDecode(row["Description"].ToString());
strMetaTitle = Server.HtmlDecode(row["MetaTittle"].ToString());
strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());
}
else
{
strTitle = strMetaTitle = "Sản Phẩm";
strDescription = "";
strMetaDescription = "";
}
Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
Header.Controls.Add(meta);
}
}
示例8: GetAll
/// <summary>
/// Get all order items
/// </summary>
/// <remarks>Returns all three order items we've got here</remarks>
/// <response code="200">OK</response>
/// <response code="401">Unauthorized</response>
/// <returns></returns>
public IEnumerable<OrderItem> GetAll(int orderId, ProductCategory? category = null)
{
return new[]
{
new OrderItem {LineNo = 1, Product = "Test Product 1", Quantity = 2},
new OrderItem {LineNo = 2, Product = "Test Product 2", Quantity = 4},
new OrderItem {LineNo = 3, Product = "Test Product 3", Quantity = 3}
};
}
示例9: Product
public Product(string code, Inventory inventory, ProductCategory category, long sellPrice)
: base(code)
{
_inventory = inventory;
_category = category;
_volume = 1;
_sellPrice = sellPrice;
_name = _inventory.Name;
_description = _inventory.Description;
}
示例10: AuctionItem
public AuctionItem(string description, ProductCategory category, int startPrice, DateTime startDate, User owner, SpecialFeatures specialFeatures)
{
this.description = description;
this.category = category;
this.startPrice = startPrice;
this.startDate = startDate;
this.owner = owner;
this.specialFeatures = specialFeatures;
this.bids = new ObservableCollection<Bid>();
}
示例11: Select
public IList<ProductCategory> Select(ProductCategory data)
{
IList<ProductCategory> datos = new List<ProductCategory>();
datos = GetHsql(data).List<ProductCategory>();
if (!Factory.IsTransactional)
Factory.Commit();
return datos;
}
示例12: Insert
public void Insert(ProductCategory productCategory)
{
productCategory = Validate(productCategory);
if (_productCategories.Any(i => i.Description.Equals(productCategory.Description, StringComparison.InvariantCultureIgnoreCase)))
throw new BusinessLogicException("A product category with that name already exists.");
_productCategories.Add(productCategory);
_repository.SaveChanges();
}
示例13: AddParentCategories
private static void AddParentCategories(this InventoryItem @this, ProductCategory productCategory)
{
if (productCategory.ExistParents)
{
foreach (ProductCategory parent in productCategory.Parents)
{
@this.AddDerivedProductCategory(parent);
@this.AddParentCategories(parent);
}
}
}
示例14: AuctionItem
public AuctionItem(string description, ProductCategory category, int startPrice, DateTime startDate, User owner,
SpecialFeatures specialFeatures)
{
_description = description;
_category = category;
_startPrice = startPrice;
_startDate = startDate;
Owner = owner;
_specialFeatures = specialFeatures;
_bids = new ObservableCollection<Bid>();
}
示例15: OneToManyReadTest
public void OneToManyReadTest()
{
using (EasySession easySession = new EasySession())
{
///[Test Read] - one-to-many relationship
ProductCategory productCategory = new ProductCategory();
IList resultList = productCategory.FindAll(easySession);
Assert.AreEqual(4, resultList.Count);
}
}