• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ProductCategory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ProductCategory的典型用法代码示例。如果您正苦于以下问题:C# ProductCategory类的具体用法?C# ProductCategory怎么用?C# ProductCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProductCategory类属于命名空间,在下文中一共展示了ProductCategory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Create

        public ActionResult Create(ProductCategory productcategory)
        {
            if (ModelState.IsValid)
            {
                db.ProductCategories.Add(productcategory);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(productcategory);
        }
开发者ID:sonartez,项目名称:LFS,代码行数:11,代码来源:ProductCategoryController.cs


示例17: Product

        public Product(string productName, int productcode, string description, decimal price, PriceType priceType, ProductCategory[] categories, int internalID)
        {
            this.productName = productName;
            this.productCode = productcode;
            this.description = description;
            this.price = price;
            this.priceType = priceType;
            this.categories = categories;

            this.internalID = internalID;
        }
开发者ID:MohsAkh,项目名称:shop-order-system,代码行数:11,代码来源:Product.cs


示例18: CreateProduct

 public override object CreateProduct(ProductCategory category)
 {
     switch (category)
       {
     case ProductCategory.ProductA:
       return new ConcreteProductA();
     case ProductCategory.ProductB:
       return new ConcreteProductB();
     default:
       throw new NotSupportedException();
       }
 }
开发者ID:Ni2014,项目名称:TheBeautyOfDesignPatterns,代码行数:12,代码来源:Implementation.cs


示例19: AddCategory

 public bool AddCategory(ProductCategory category)
 {
     using (IDbConnection connection = MySQLDAOFactory.GetDatabase().CreateOpenConnection())
     {
         using (IDbTransaction transaction = connection.BeginTransaction())
         {
             try
             {
                 string query = "INSERT INTO category (categoryname, categorydescription) VALUES "
                 + "('" + category.name.Trim().ToLower() + "', '" + category.description + "')";
                 using (IDbCommand command = MySQLDAOFactory.GetDatabase().CreateCommand(query, connection))
                 {
                     if (command.ExecuteNonQuery() <= 0)
                     {
                         transaction.Rollback();
                         return false;
                     }
                 }
                 string queryID = "SELECT LAST_INSERT_ID();";
                 using (IDbCommand commandID = MySQLDAOFactory.GetDatabase().CreateCommand(queryID, connection))
                 {
                     using (IDataReader reader = commandID.ExecuteReader())
                     {
                         if (reader.Read())
                         {
                             category.internalID = Convert.ToInt32(reader[0]);
                         }
                     }
                     if (category.internalID.Equals(-1) == false)
                     {
                         transaction.Commit();
                         return true;
                     }
                     else
                     {
                         transaction.Rollback();
                         throw new Exception("category inserted succesfully, but could not retrieve ID afterwards. Rolled back.");
                     }
                 }
             }
             catch (MySqlException ex)
             {
                 transaction.Rollback();
                 throw new DatabaseException(ex.Message, ex);
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }
开发者ID:MohsAkh,项目名称:shop-order-system,代码行数:53,代码来源:MySQLCategoryDAO.cs


示例20: CreateProduct

 public virtual AbstractOrInterfaceOfProduct CreateProduct(ProductCategory category)
 {
     switch (category)
       {
     case ProductCategory.GoodProduct:
       return new ConcreteGoodProduct();
     case ProductCategory.BadProduct:
       return new ConcreteBadProduct();
     default:
       throw new NotSupportedException();
       }
 }
开发者ID:Ni2014,项目名称:TheBeautyOfDesignPatterns,代码行数:12,代码来源:Implementation.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ProductInner类代码示例发布时间:2022-05-24
下一篇:
C# Product类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap