温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:破竹CMS4.0免安装版源码
1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using Pozhu.CMS.Categories; 12
using Pozhu.Sites; 13
using Pozhu.CMS.PropertyDefinitions; 14
using Pozhu.CMS.Documents; 15
using Pozhu.Common.Utilities; 16
using Pozhu.CMS.Web; 17
18
public partial class admin_PropertyDefinition_EditPropertyDefinitionCategory : AdminPageBase 19
{ 20
protected void Page_Load(object sender, EventArgs e) 21
{ 22
if (!Page.IsPostBack) 23
{ 24
int siteID = SiteController.GetCurrentSite().SiteID; 25
int categoryID = CategoryController.GetCategory(siteID, Request.QueryString["path"]).CategoryID; 26
27
28
// 29
string action = Request.QueryString["action"]; 30
if (action == "add") 31
{ 32
this.lbtnUpdate.Visible = false; 33
} 34
else if (action == "edit") 35
{ 36
// 37
string identify = Request.QueryString["Identify"]; 38
PropertyDefinitionControllerBase pdController = null; 39
if (identify.ToLower() == "category") 40
{ 41
pdController = new CategoryPropertyDefinitionController(); 42
} 43
else if (identify.ToLower() == "document") 44
{ 45
pdController = new DocumentPropertyDefinitionController(); 46
} 47
48
// 49
int propertyCategoryID = int.Parse(Request.QueryString["PropertyCategoryID"]); 50
PropertyCategory pc = pdController.GetPropertyCategory(propertyCategoryID); 51
52
// 53
tbName.Text = pc.Title; 54
tbDescription.Text = pc.Description; 55
56
lbtnAdd.Visible = false; 57
} 58
} 59
60
} 61
protected void lbtnCancel_Click(object sender, EventArgs e) 62
{ 63
string identify = Request.QueryString["Identify"]; 64
Response.Redirect("PropertyDefinitions.aspx?tabindex=" + Request.QueryString["tabindex"] + "&path=" + Request.QueryString["path"] + "&identify=" + identify); 65
66
} 67
protected void lbtnAdd_Click(object sender, EventArgs e) 68
{ 69
int siteID = SiteController.GetCurrentSite().SiteID; 70
int categoryID = CategoryController.GetCategory(siteID, Request.QueryString["path"]).CategoryID; 71
72
// 73
string redirectUrl = Null.NullString; 74
string identify = Request.QueryString["Identify"]; 75
PropertyDefinitionControllerBase pdController = null; 76
if (identify.ToLower() == "category") 77
{ 78
pdController = new CategoryPropertyDefinitionController(); 79
} 80
else if (identify.ToLower() == "document") 81
{ 82
pdController = new DocumentPropertyDefinitionController(); 83
} 84
85
// 86
PropertyCategory pc = new PropertyCategory(); 87
pc.Title = tbName.Text; 88
pc.Description = tbDescription.Text; 89
pc.CategoryID = categoryID; 90
91
//添加 92
pdController.AddPropertyCategory(pc); 93
94
// 95
Response.Redirect("PropertyDefinitions.aspx?tabindex=" + Request.QueryString["tabindex"] + "&path=" + Request.QueryString["path"] + "&identify=" + identify); 96
} 97
protected void lbtnUpdate_Click(object sender, EventArgs e) 98
{ 99
int siteID = SiteController.GetCurrentSite().SiteID; 100
int categoryID = CategoryController.GetCategory(siteID, Request.QueryString["path"]).CategoryID; 101
102
// 103
string redirectUrl = Null.NullString; 104
string identify = Request.QueryString["Identify"]; 105
PropertyDefinitionControllerBase pdController = null; 106
if (identify.ToLower() == "category") 107
{ 108
pdController = new CategoryPropertyDefinitionController(); 109
} 110
else if (identify.ToLower() == "document") 111
{ 112
pdController = new DocumentPropertyDefinitionController(); 113
} 114
115
// 116
int propertyCategoryID = int.Parse(Request.QueryString["PropertyCategoryID"]); 117
PropertyCategory pc = pdController.GetPropertyCategory(propertyCategoryID); 118
pc.CategoryID = categoryID; 119
pc.Title = tbName.Text; 120
pc.Description = tbDescription.Text; 121
122
//更新 123
pdController.UpdatePropertyCategory(pc); 124
125
// 126
Response.Redirect("PropertyDefinitions.aspx?tabindex=" + Request.QueryString["tabindex"] + "&path=" + Request.QueryString["path"] + "&identify=" + identify); 127
} 128
} 129





}
}