您目前尚未登陆,请选择【登陆】或【注册
首页->新闻文章->破竹CMS4.0免安装版源码>>admin/PropertyDefinition/PropertyDefinitions.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:破竹CMS4.0免安装版源码
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using Pozhu.UI.Utilities; 12using Pozhu.CMS.Categories; 13using Pozhu.CMS; 14using Pozhu.UI.WebControls; 15using Pozhu.CMS.PropertyDefinitions; 16using Pozhu.Sites; 17using Pozhu.Common.Utilities; 18using Pozhu.CMS.Documents; 19using Pozhu.CMS.Common.Utilities; 20using Pozhu.CMS.Web; 21 22 23public partial class admin_PropertyDefinition_PropertyDefinitions : AdminPageBase 24{ 25 protected void Page_Load(object sender, EventArgs e) 26 { 27 if (!Page.IsPostBack) 28 { 29 BindPropertyCategories(); 30 } 31 } 32 33 PropertyDefinitionControllerBase _pdController = null; 34 PropertyDefinitionControllerBase pdController 35 { 36 get 37 { 38 if (_pdController == null) 39 { 40 string identify = Request.QueryString["Identify"]; 41 if (identify.ToLower() == "category") 42 { 43 _pdController = new CategoryPropertyDefinitionController(); 44 } 45 else if (identify.ToLower() == "document") 46 { 47 _pdController = new DocumentPropertyDefinitionController(); 48 } 49 } 50 return _pdController; 51 } 52 } 53 54 void BindPropertyCategories() 55 { 56 string path = CategoryPath.CheckRepairPath(Request.QueryString["path"]); 57 int siteID = SiteController.GetCurrentSite().SiteID; 58 59 //获取当前栏目 60 Category c = CategoryController.GetCategory(siteID, path); 61 62 //邦定 63 PropertyCategoryCollection pcc = pdController.GetPropertyCategories(c.CategoryID); 64 PropertyCategoryCollection pccClone = (PropertyCategoryCollection)pcc.Clone(); 65 66 if (pdController.GetProperties(c.CategoryID, Null.NullInteger).Count > 0) 67 { 68 // 69 PropertyCategory noCategory = new PropertyCategory(); 70 noCategory.CategoryID = c.CategoryID; 71 noCategory.PropertyCategoryID = Null.NullInteger; 72 noCategory.Title = "未分类的属性"; 73 pccClone.Add(noCategory); 74 } 75 76 // 77 this.rptPropertyCategories.DataSource = pccClone; 78 this.rptPropertyCategories.DataBind(); 79 } 80 81 protected void rptPropertyCategories_ItemCommand(object source, RepeaterCommandEventArgs e) 82 { 83 string commandName = e.CommandName; 84 int propertyCategoryID = int.Parse(e.CommandArgument.ToString()); 85 86 if (commandName == "delete") 87 { 88 pdController.DeletePropertyCategory(propertyCategoryID); 89 // 90 BindPropertyCategories(); 91 } 92 else if (commandName == "up") 93 { 94 pdController.UpdatePropertyCategorySortOrder(propertyCategoryID, MoveOrder.Up); 95 // 96 BindPropertyCategories(); 97 } 98 else if (commandName == "down") 99 { 100 pdController.UpdatePropertyCategorySortOrder(propertyCategoryID, MoveOrder.Down); 101 // 102 BindPropertyCategories(); 103 } 104 } 105 protected void rptPropertyCategories_ItemDataBound(object sender, RepeaterItemEventArgs e) 106 { 107 108 //邦定该分类下的属性 109 string path = CategoryPath.CheckRepairPath(Request.QueryString["path"]); 110 int siteID = SiteController.GetCurrentSite().SiteID; 111 112 //获取当前栏目 113 Category c = CategoryController.GetCategory(siteID, path); 114 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) 115 { 116 LinkButton lbtnDelete = (LinkButton)e.Item.FindControl("lbtnDelete"); 117 ClientAPI.AddButtonConfirm(lbtnDelete, "您确定要删除该分类吗?"); 118 119 WrappedRepeater rptProperties = (WrappedRepeater)e.Item.FindControl("rptProperties"); 120 rptProperties.DataSource = pdController.GetProperties(c.CategoryID, ((PropertyCategory)(e.Item.DataItem)).PropertyCategoryID); 121 rptProperties.DataBind(); 122 } 123 } 124 protected void rptProperties_ItemCommand(object source, RepeaterCommandEventArgs e) 125 { 126 string commandName = e.CommandName; 127 int propertyDefinitionID = int.Parse(e.CommandArgument.ToString()); 128 129 if (commandName == "delete") 130 { 131 pdController.DeleteProperty(propertyDefinitionID); 132 // 133 BindPropertyCategories(); 134 } 135 else if (commandName == "up") 136 { 137 pdController.UpdatePropertySortOrder(propertyDefinitionID, MoveOrder.Up); 138 // 139 BindPropertyCategories(); 140 } 141 else if (commandName == "down") 142 { 143 pdController.UpdatePropertySortOrder(propertyDefinitionID, MoveOrder.Down); 144 // 145 BindPropertyCategories(); 146 } 147 } 148 protected void rptProperties_ItemDataBound(object sender, RepeaterItemEventArgs e) 149 { 150 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) 151 { 152 LinkButton lbtnDelete = (LinkButton)e.Item.FindControl("lbtnDelete"); 153 ClientAPI.AddButtonConfirm(lbtnDelete, "您确定要删除该属性吗?"); 154 } 155 } 156} 157
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:破竹CMS4.0免安装版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号