?? editsection.aspx.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,
ctlAppearance.FailSkin
);
// 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 + -