⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editsection.aspx.cs

📁 一个ASP.NET下的中文内容管理和社区系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace ASPNET.StarterKit.Communities.Admin.EditSections
{
	/// <summary>
	/// Summary description for EditSection.
	/// </summary>
	public class EditSection : System.Web.UI.Page
	{
		protected ASPNET.StarterKit.Communities.DisplayQuota valQuota;
		protected ASPNET.StarterKit.Communities.Admin.TabStrip Tabstrip1;
		protected System.Web.UI.WebControls.Panel pnlGeneral;
		protected System.Web.UI.WebControls.Panel pnlAppearance;
		protected System.Web.UI.WebControls.Panel pnlWebBoxes;
		protected System.Web.UI.WebControls.Panel pnlSecurity;
		protected System.Web.UI.WebControls.Panel pnlWebServices;
		protected System.Web.UI.WebControls.Panel pnlAdvanced;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;


		protected SectionGeneral ctlGeneral;
		protected SectionAppearance ctlAppearance;
		protected SectionWebBoxes ctlWebBoxes;
		protected SectionWebServices ctlWebServices;
		protected SectionSecurity ctlSecurity;
		protected SectionAdvanced ctlAdvanced;



		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button1.Click += new System.EventHandler(this.UpdateSection);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion


		public int SectionID {
			get { return (int)ViewState[ "SectionID" ]; }
			set { ViewState[ "SectionID" ] = value; }
		}
	    
	    
		void Page_Load(object sender, System.EventArgs e) {
			// Hide quota stats if not over quota
			if (valQuota.IsValid)
					valQuota.Visible = false;
	    
			if (!IsPostBack) {
				// Assign section ID
				SectionID = Int32.Parse( Request.QueryString["id"] );
	    
					// Get the Section information
					SectionInfo objSectionInfo = SectionUtility.GetSectionInfoFromDB(SectionID);
	    
					// Assign the Section values
					ctlGeneral.Section = objSectionInfo;
					ctlAppearance.Section = objSectionInfo;
					ctlWebBoxes.Section = objSectionInfo;
					ctlSecurity.Section = objSectionInfo;
					ctlWebServices.Section = objSectionInfo;
					ctlAdvanced.Section = objSectionInfo;
	    
	    
				// Initialize roles
				ArrayList colAllRoles = UserUtility.GetAllRoles();
				ctlSecurity.AllRoles = colAllRoles;
				ctlAdvanced.AllRoles = colAllRoles;
	    
			}
		}
	    
	    
		void UpdateSection(Object s, EventArgs e) {
			if (IsValid) {
				SectionUtility.EditSection
				(
					SectionID,
					ctlGeneral.Name,
					ctlGeneral.Title,
					ctlGeneral.MenuTitle,
					ctlGeneral.Description,
					ctlGeneral.IsEnabled,
					ctlWebBoxes.InheritWebBoxes,
					ctlWebBoxes.WebBoxDisplayMode,
					ctlWebBoxes.InheritWebServiceBoxes,
					ctlWebBoxes.WebServiceBoxDisplayMode,
					ctlAppearance.PageSkin,
					ctlAppearance.PageStyle,
					ctlGeneral.ParentSectionID,
					ctlAppearance.PageHeader,
					ctlAppearance.PageFooter,
					ctlAppearance.Footer,
					ctlAppearance.PageMetaKeys,
					ctlAppearance.PageMetaDesc,
					ctlAdvanced.RecordsPerPage,
					ctlAdvanced.EnableTopics,
					ctlAdvanced.EnableComments,
					ctlAdvanced.EnableModeration,
					ctlAdvanced.EnableRatings,
					ctlAdvanced.EnableCommentRatings,
					ctlAdvanced.EnableNotifications,
					ctlAppearance.InheritTransformations,
					ctlAppearance.Transformations,
					ctlWebServices.IsSectionWebService,
					ctlWebServices.WebServicePassword,
					ctlAdvanced.AllowHtmlInput,
					ctlAdvanced.AllowCommentHtmlInput,
					ctlAppearance.Logo
				);
	    
				// Update View Roles
				if (ctlSecurity.ViewRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.ViewRole, ctlSecurity.ViewRoles);
	    
				// Update Add Roles
				if (ctlSecurity.AddRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.AddRole, ctlSecurity.AddRoles);
	    
				// Update Edit Roles
				if (ctlSecurity.EditRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.EditRole, ctlSecurity.EditRoles);
	    
				// Update Delete Roles
				if (ctlSecurity.DeleteRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.DeleteRole, ctlSecurity.DeleteRoles);
	    
				// Update Comment Roles
				if (ctlAdvanced.CommentRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.CommentRole, ctlAdvanced.CommentRoles);
	    
				// Update Moderate Roles
				if (ctlAdvanced.ModerateRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.ModerateRole, ctlAdvanced.ModerateRoles);
	    
				// Update Rate Roles
				if (ctlAdvanced.RateRolesChanged)
					SectionUtility.AddSectionRoles(SectionID, RoleType.RateRole, ctlAdvanced.RateRoles);
	    
				// Update Web Boxes
				if (ctlWebBoxes.WebBoxesChanged)
					SectionUtility.AddSectionWebBoxes(SectionID, ctlWebBoxes.WebBoxes);
	    
				// Update Web Service Boxes
				if (ctlWebBoxes.WebServiceBoxesChanged)
					SectionUtility.AddSectionWebServiceBoxes(SectionID, ctlWebBoxes.WebServiceBoxes);
	    
				// Update Service Subscriptions
				if (ctlWebServices.ServiceSubscriptionsChanged)
					SectionUtility.AddSectionServiceSubscriptions(SectionID, ctlWebServices.ServiceSubscriptions);
	    
				// Redirect to EditSections
				Response.Redirect("Default.aspx");
			}
	    
		}

		private void Page_Load()
		{
		
		}



	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -