Asp.net源码专业站
首页->博客空间->SpaceBuilder v1.0正式版源码>>BasicWebControls/Manage/News/EditNewsCategory.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
当前文件:文件类型 SpaceBuiderV10Source/BasicWebControls/Manage/News/EditNewsCategory.cs[4K,2009-6-12 11:55:08]打开代码结构图
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System; 8using System.Collections.Generic; 9using System.Text; 10using SpaceBuilder.Components; 11using SpaceBuilder.Posts.Permissions; 12using System.Web.UI.WebControls; 13using TunyNet.Web.UI; 14using SpaceBuilder.Controls; 15using SpaceBuilder.Utils; 16 17namespace SpaceBuilder.Web.Manage.Controls 18{ 19 public class EditNewsCategory : ManageBaseControl 20 { 21 SBContext wlContext = SBContext.Current; 22 23 protected override void Authorize() 24 { 25 if (!wlContext.User.IsContentAdministrator) 26 PermissionBase.RedirectOrExcpetion(SBExceptionType.AccessDenied); 27 } 28 29 protected override void OnInit(EventArgs e) 30 { 31 if (SkinName == null) 32 SkinName = "Skin-EditNewsCategory.ascx"; 33 34 base.OnInit(e); 35 } 36 37 protected override void OnLoad(EventArgs e) 38 { 39 base.OnLoad(e); 40 Header.AddTitle("编辑资讯类别", this.Context); 41 EnsureChildControls(); 42 if (!Page.IsPostBack) 43 Bind(); 44 } 45 46 Child Controls 56 57 protected override void AttachChildControls() 58 { 59 pageTitle = FindControl("PageTitle") as Literal; 60 this.SectionDescription = this.FindControl("SectionDescription") as TextBox; 61 this.SectionName = this.FindControl("SectionName") as TextBox; 62 63 saveButton = FindControl("SaveButton") as LinkButton; 64 saveButton.Click += new EventHandler(SaveButton_Click); 65 66 cancelButton = FindControl("CancelButton") as LinkButton; 67 cancelButton.Click += new EventHandler(CancelButton_Click); 68 69 sortOrder = FindControl("SortOrder") as TextBox; 70 } 71 72 void Bind() 73 { 74 int categoryID = wlContext.GetIntFromQueryString("CategoryID", -1); 75 Forums.Components.Forum entity = Forums.Components.Forums.GetForum(categoryID); 76 if (entity != null) 77 { 78 this.SectionName.Text = entity.SectionName; 79 this.SectionDescription.Text = entity.Description; 80 if (sortOrder != null) 81 { 82 sortOrder.Text = Convert.ToString(entity.SortOrder); 83 } 84 } 85 86 if (categoryID > 0) 87 { 88 pageTitle.Text = "修改资讯类别"; 89 } 90 else 91 { 92 pageTitle.Text = "添加资讯类别"; 93 } 94 95 } 96 97 void SaveButton_Click(object sender, EventArgs e) 98 { 99 int categoryID = wlContext.GetIntFromQueryString("CategoryID", -1); 100 101 Forums.Components.Forum entity; 102 if (categoryID > 0) 103 { 104 entity = Forums.Components.Forums.GetForum(categoryID); 105 if (entity != null) 106 { 107 entity.SortOrder = Convert.ToInt32(sortOrder.Text); 108 entity.Description = this.SectionDescription.Text; 109 entity.SectionName = this.SectionName.Text; 110 } 111 112 Forums.Components.Forums.Update(entity); 113 } 114 else 115 { 116 entity = new SpaceBuilder.Forums.Components.Forum(); 117 entity.Description = this.SectionDescription.Text; 118 entity.SectionName = this.SectionName.Text; 119 entity.SortOrder = Convert.ToInt32(sortOrder.Text); 120 entity.ParentID = 0; 121 entity.IsSearchable = true; 122 entity.IsActive = true; 123 entity.GroupID = 0; 124 entity.ForumType = SpaceBuilder.Forums.Components.ForumType.Announcement; 125 entity.CreateDate = DateTime.Now; 126 entity.ClubID = 0; 127 128 Forums.Components.Forums.Create(entity); 129 } 130 131 this.Page.Response.Redirect(ManagerUrls.Instance().NewsCategoryManage()); 132 } 133 134 void CancelButton_Click(object sender, EventArgs e) 135 { 136 this.Page.Response.Redirect(ManagerUrls.Instance().NewsCategoryManage()); 137 } 138 139 } 140} 141
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:SpaceBuilder v1.0正式版源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146