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


C# Category.MarkOld方法代码示例

本文整理汇总了C#中Category.MarkOld方法的典型用法代码示例。如果您正苦于以下问题:C# Category.MarkOld方法的具体用法?C# Category.MarkOld怎么用?C# Category.MarkOld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Category的用法示例。


在下文中一共展示了Category.MarkOld方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FillCategories

        /// <summary>
        /// Fills an unsorted list of categories.
        /// </summary>
        /// <returns>A list of Category objects got from the XML data document</returns>
        public override List<Category> FillCategories()
        {
            string fileName = _Folder + "Categories.xml";
              if (!File.Exists(fileName))
            return null;

              XmlDocument doc = new XmlDocument();
              doc.Load(fileName);
              List<Category> categories = new List<Category>();

              foreach (XmlNode node in doc.SelectNodes("categories/category"))
              {
            Category category = new Category();

            category.Id = new Guid(node.Attributes["id"].InnerText);
            category.Title = node.InnerText;
                if (node.Attributes["description"] != null)
                    category.Description = node.Attributes["description"].InnerText;
                else
                    category.Description = string.Empty;
            categories.Add(category);
            category.MarkOld();
              }

              return categories;
        }
开发者ID:chandru9279,项目名称:StarBase,代码行数:30,代码来源:Categories.cs

示例2: SelectCategory

        /// <summary>
        /// Gets a Category based on a Guid
        /// </summary>
        /// <param name="id">The category's Guid.</param>
        /// <returns>A matching Category</returns>
        public override Category SelectCategory(Guid id)
        {
            List<Category> categories = Category.Categories;

            Category category = new Category();

            foreach (Category cat in categories)
            {
                if (cat.Id == id)
                    category = cat;
            }
            category.MarkOld();
            return category;
        }
开发者ID:tikalk,项目名称:fuse.dotnet.mongodb-blogengine,代码行数:19,代码来源:Categories.cs

示例3: FillCategories

        /// <summary>
        /// Gets all categories in database
        /// </summary>
        /// <returns>List of categories</returns>
        public override List<Category> FillCategories()
        {
            List<Category> categories = new List<Category>();
            string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
            string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName;
            DbProviderFactory provider = DbProviderFactories.GetFactory(providerName);

            using (DbConnection conn = provider.CreateConnection())
            {
                conn.ConnectionString = connString;

                using (DbCommand cmd = conn.CreateCommand())
                {
                    string sqlQuery = "SELECT CategoryID, CategoryName, description, ParentID " +
                        "FROM " + tablePrefix + "Categories ";
                    cmd.CommandText = sqlQuery;
                    cmd.CommandType = CommandType.Text;
                    conn.Open();

                    using (DbDataReader rdr = cmd.ExecuteReader())
                    {
                        if (rdr.HasRows)
                        {
                            while (rdr.Read())
                            {
                                Category cat = new Category();
                                cat.Title = rdr.GetString(1);
                                if (rdr.IsDBNull(2))
                                    cat.Description = "";
                                else
                                    cat.Description = rdr.GetString(2);
                                if (rdr.IsDBNull(3))
                                    cat.Parent = null;
                                else
                                    cat.Parent = new Guid(rdr.GetGuid(3).ToString());
                                cat.Id = new Guid(rdr.GetGuid(0).ToString());
                                categories.Add(cat);
                                cat.MarkOld();
                            }
                        }
                    }
                }
            }

            return categories;
        }
开发者ID:rajgit31,项目名称:RajBlog,代码行数:50,代码来源:DbBlogProvider.cs

示例4: FillCategories

        /// <summary>
        /// Gets all categories in database
        /// </summary>
        /// <returns>
        /// List of categories
        /// </returns>
        public override List<Category> FillCategories(Blog blog)
        {
            var categories = new List<Category>();

            using (var conn = this.CreateConnection())
            {
                if (conn.HasConnection)
                {
                    using (var cmd = conn.CreateTextCommand(string.Format("SELECT CategoryID, CategoryName, description, ParentID FROM {0}Categories WHERE BlogId = {1}blogid ", this.tablePrefix, this.parmPrefix)))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("blogid"), blog.Id.ToString()));

                        using (var rdr = cmd.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                var cat = new Category
                                    {
                                        Title = rdr.GetString(1),
                                        Description = rdr.IsDBNull(2) ? string.Empty : rdr.GetString(2),
                                        Parent = rdr.IsDBNull(3) ? (Guid?)null : new Guid(rdr.GetGuid(3).ToString()),
                                        Id = new Guid(rdr.GetGuid(0).ToString())
                                    };

                                categories.Add(cat);
                                cat.MarkOld();
                            }
                        }
                    }
                }
            }

            return categories;
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:40,代码来源:DbBlogProvider.cs

示例5: SelectCategory

        /// <summary>
        /// Returns a category
        /// </summary>
        /// <param name="id">Id of category to return</param>
        /// <returns>A category.</returns>
        public override Category SelectCategory(Guid id)
        {
            var categories = Category.Categories;

            var category = new Category();

            foreach (var cat in categories.Where(cat => cat.Id == id))
            {
                category = cat;
            }

            category.MarkOld();
            return category;
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:19,代码来源:DbBlogProvider.cs

示例6: Update

        public void Update(int CategoryID,string CategoryName,string Description,byte[] Picture)
        {
            Category item = new Category();
            item.MarkOld();
            item.IsLoaded = true;

            item.CategoryID = CategoryID;

            item.CategoryName = CategoryName;

            item.Description = Description;

            item.Picture = Picture;

            item.Save(UserName);
        }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:16,代码来源:CategoryController.cs

示例7: FillCategories

        /// <summary>
        /// Fills an unsorted list of categories.
        /// </summary>
        /// <returns>
        /// A List&lt;Category&gt; of all Categories.
        /// </returns>
        public override List<Category> FillCategories()
        {
            var fileName = this.Folder + "categories.xml";
            if (!File.Exists(fileName))
            {
                return null;
            }

            var doc = new XmlDocument();
            doc.Load(fileName);
            var categories = new List<Category>();

            foreach (XmlNode node in doc.SelectNodes("categories/category"))
            {
                var category = new Category { Id = new Guid(node.Attributes["id"].InnerText), Title = node.InnerText };

                if (node.Attributes["description"] != null)
                {
                    category.Description = node.Attributes["description"].InnerText;
                }
                else
                {
                    category.Description = string.Empty;
                }

                if (node.Attributes["parent"] != null)
                {
                    if (String.IsNullOrEmpty(node.Attributes["parent"].InnerText))
                    {
                        category.Parent = null;
                    }
                    else
                    {
                        category.Parent = new Guid(node.Attributes["parent"].InnerText);
                    }
                }
                else
                {
                    category.Parent = null;
                }

                categories.Add(category);
                category.MarkOld();
            }

            return categories;
        }
开发者ID:RajneeshVerma,项目名称:blogengine.net-mvc,代码行数:53,代码来源:Categories.cs

示例8: FillCategories

        /// <summary>
        /// Gets all categories in database
        /// </summary>
        /// <returns>
        /// List of categories
        /// </returns>
        public override List<Category> FillCategories()
        {
            var categories = new List<Category>();
            var connString = ConfigurationManager.ConnectionStrings[this.connStringName].ConnectionString;
            var providerName = ConfigurationManager.ConnectionStrings[this.connStringName].ProviderName;
            var provider = DbProviderFactories.GetFactory(providerName);

            using (var conn = provider.CreateConnection())
            {
                if (conn != null)
                {
                    conn.ConnectionString = connString;

                    using (var cmd = conn.CreateCommand())
                    {
                        var sqlQuery = string.Format("SELECT CategoryID, CategoryName, description, ParentID FROM {0}Categories ", this.tablePrefix);
                        cmd.CommandText = sqlQuery;
                        cmd.CommandType = CommandType.Text;
                        conn.Open();

                        using (var rdr = cmd.ExecuteReader())
                        {
                            if (rdr.HasRows)
                            {
                                while (rdr.Read())
                                {
                                    var cat = new Category
                                        {
                                            Title = rdr.GetString(1),
                                            Description = rdr.IsDBNull(2) ? string.Empty : rdr.GetString(2),
                                            Parent = rdr.IsDBNull(3) ? (Guid?)null : new Guid(rdr.GetGuid(3).ToString()),
                                            Id = new Guid(rdr.GetGuid(0).ToString())
                                        };

                                    categories.Add(cat);
                                    cat.MarkOld();
                                }
                            }
                        }
                    }
                }
            }

            return categories;
        }
开发者ID:karanbhasin,项目名称:blogEngine.Common,代码行数:51,代码来源:DbBlogProvider.cs

示例9: Update

        public void Update(int CategoryId,Guid CategoryGuid,int ParentId,string Name,string ImageFile,string Description,int SortOrder,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
        {
            Category item = new Category();

                item.CategoryId = CategoryId;

                item.CategoryGuid = CategoryGuid;

                item.ParentId = ParentId;

                item.Name = Name;

                item.ImageFile = ImageFile;

                item.Description = Description;

                item.SortOrder = SortOrder;

                item.CreatedBy = CreatedBy;

                item.CreatedOn = CreatedOn;

                item.ModifiedBy = ModifiedBy;

                item.ModifiedOn = ModifiedOn;

            item.MarkOld();
            item.Save(UserName);
        }
开发者ID:89sos98,项目名称:dashcommerce-3,代码行数:29,代码来源:CategoryController.cs

示例10: Update

        public void Update(int CategoryID,string URLRewrite,string CatName,int? Parent,int Lang,int? Arrange)
        {
            Category item = new Category();
            item.MarkOld();
            item.IsLoaded = true;

            item.CategoryID = CategoryID;

            item.URLRewrite = URLRewrite;

            item.CatName = CatName;

            item.Parent = Parent;

            item.Lang = Lang;

            item.Arrange = Arrange;

            item.Save(UserName);
        }
开发者ID:hieuuk,项目名称:pingpoong,代码行数:20,代码来源:CategoryController.cs


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