当前位置: 首页>>代码示例>>C#>>正文


C# ProductCategory类代码示例

本文整理汇总了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);         
        }
开发者ID:Karolinebryn,项目名称:SampleCodeCertification70-487,代码行数:29,代码来源:DbContextController.cs

示例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);
        }
    }
开发者ID:hungtien408,项目名称:web-bezut,代码行数:34,代码来源:nghien-cuu-phat-trien-chi-tiet.aspx.cs

示例3: ProductCategory

 public ProductCategory(string code, string name, string description, ProductCategory parentCategory)
     : base(code)
 {
     _name = name;
     _description = description;
     _parentCategory = parentCategory;
 }
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:7,代码来源:ProductCategory.cs

示例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);
        }
开发者ID:dibble-james,项目名称:Ketchup,代码行数:34,代码来源:Seeder.cs

示例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;
 }
开发者ID:Cream2015,项目名称:QqhrCitizen,代码行数:7,代码来源:ProductListItem.cs

示例6: Product

 public Product(string name, decimal unitPrice, ProductCategory category, ImageInfo image)
 {
     this.Name = name;
     this.UnitPrice = unitPrice;
     this.Category = category;
     this.Image = image;
 }
开发者ID:snahider,项目名称:Refactoring-Golf,代码行数:7,代码来源:Product.cs

示例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);
        }
    }
开发者ID:hungtien408,项目名称:web-bezut,代码行数:35,代码来源:san-pham-sub-1.aspx.cs

示例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}
         };
 }
开发者ID:nprovencher,项目名称:Swashbuckle,代码行数:16,代码来源:OrderItemsController.cs

示例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;
 }
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:10,代码来源:Product.cs

示例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>();
 }
开发者ID:liuzuocai,项目名称:Some-HCI,代码行数:10,代码来源:AuctionItem.cs

示例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;
            
        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:10,代码来源:DaoProductCategory.cs

示例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();
        }
开发者ID:txsll,项目名称:SLLInvoices,代码行数:10,代码来源:ProductCategoryService.cs

示例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);
         }
     }
 }
开发者ID:Allors,项目名称:apps,代码行数:11,代码来源:InventoryitemExtensions.cs

示例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>();
 }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:11,代码来源:AuctionItem.cs

示例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);
            }
        }
开发者ID:hasi,项目名称:EasyData,代码行数:11,代码来源:Read.aspx.cs


注:本文中的ProductCategory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。