Asp.net源码专业站
首页->博客空间->Maolz个人展示网站源码>>SubSonicDAL/MySiteProvider/Custom/Category.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Maolz个人展示网站源码
当前文件:文件类型 maolz/SubSonicDAL/MySiteProvider/Custom/Category.cs[3K,2009-6-12 11:47:17]打开代码结构图
普通视图
		            
1using System; 2using System.Text; 3using System.Data; 4using System.Data.SqlClient; 5using System.Data.Common; 6using System.Collections; 7using System.Collections.Generic; 8using System.ComponentModel; 9using System.Configuration; 10using System.Xml; 11using System.Xml.Serialization; 12using SubSonic; 13using SubSonic.Utilities; 14 15namespace SubSonic.Generated 16{ 17 18 /// <summary> 19 /// This is an ActiveRecord class which wraps the Categories table. 20 /// </summary> 21 public partial class Category : ActiveRecord<Category>, IActiveRecord 22 { 23 /// <summary> 24 /// 输入分类名称集,以逗号、顿号等分隔,输出分类的Id集合,以逗号分隔开。 25 /// </summary> 26 /// <param name="parentCategoryNames"></param> 27 /// <returns></returns> 28 public void SetCategoryParentIds(string parentCategoryNames) 29 { 30 string[] categoryNames = parentCategoryNames.Trim().Split(MySite.Utils.Constant.tagSeparator, StringSplitOptions.RemoveEmptyEntries); 31 if (categoryNames.Length == 0) 32 return; 33 IList<string> list = new List<string>(); 34 foreach (string categoryName in categoryNames) 35 { 36 Category temp = new Category(Category.Columns.Name, categoryName); 37 if (temp.IsLoaded && list.Contains(temp.PKId.ToString()) == false) 38 list.Add(temp.PKId.ToString()); 39 } 40 string[] categoryIds = new string[list.Count]; 41 list.CopyTo(categoryIds, 0); 42 43 this.ParentIds=String.Join(",", categoryIds); 44 } 45 /// <summary> 46 /// 输出指定分类的父类集,以逗号分隔 47 /// </summary> 48 /// <returns></returns> 49 public string GetParentCategoryNames() 50 { 51 if (string.IsNullOrEmpty(this.ParentIds)) 52 return string.Empty; 53 if (this.ParentIds.Trim().Equals(string.Empty)) 54 return string.Empty; 55 string[] categoryIds=this.ParentIds.Split(new char[] { ',' }); 56 IList<string> list = new List<string>(); 57 foreach (string categoryId in categoryIds) 58 { 59 Category cate = new Category(categoryId); 60 list.Add(cate.Name); 61 } 62 string[] categoryNames = new string[list.Count]; 63 list.CopyTo(categoryNames, 0); 64 return string.Join(",", categoryNames); 65 } 66 public static int[] GetCategoryParentIds(string parentCategoryNames) 67 { 68 string[] categoryNames = parentCategoryNames.Trim().Split(MySite.Utils.Constant.tagSeparator, StringSplitOptions.RemoveEmptyEntries); 69 IList<int> list = new List<int>(); 70 foreach (string categoryName in categoryNames) 71 { 72 Category temp = new Category(Category.Columns.Name, categoryName); 73 if (temp.IsLoaded==true && list.Contains(temp.PKId) == false) 74 list.Add(temp.PKId); 75 } 76 int[] categoryIds = new int[list.Count]; 77 list.CopyTo(categoryIds, 0); 78 return categoryIds; 79 } 80 } 81 82} 83 84
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Maolz个人展示网站源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146