CommunityStarterKit之SectionInfo类及数据库中表和操作
2007-10-09 10:37
399 查看
namespace ASPNET.StarterKit.Communities {
using System;
using System.Collections;
using System.Data;
//*********************************************************************
//
// SectionInfo Class
//
// Represents all the information about a section.
//
//*********************************************************************
public class SectionInfo {
int _id;
int _communityID;
string _name;
string _title;
string _menuTitle;
string _path;
string _description;
bool _isEnabled;
bool _isSystem;
int _pageType;
bool _isWebBoxesInherited;
string[] _webBoxes;
int _webBoxDisplayMode;
bool _isWebServiceBoxesInherited;
string[] _webServiceBoxes;
int _webServiceBoxDisplayMode;
string _skin;
string _style;
int _parentSectionID;
string _logo;
string _pageHeader;
string _pageFooter;
string _footer;
string _pageMetaKeys;
string _pageMetaDesc;
string[] _viewRoles;
string[] _addRoles;
string[] _editRoles;
string[] _deleteRoles;
int _recordsPerPage = 10;
bool _enableTopics;
bool _enableComments;
string[] _commentRoles;
bool _enableModeration;
string[] _moderateRoles;
bool _enableRatings;
bool _enableCommentRatings;
string[] _rateRoles;
bool _enableNotifications;
bool _inheritTransformations;
string _transformations;
bool _isSectionWebService;
string _webServicePassword;
AllowHtml _allowHtmlInput;
AllowHtml _allowCommentHtmlInput;
string _content;
//*********************************************************************
//
// ID Property
//
// Represents the section ID.
//
//*********************************************************************
public int ID {
get { return _id; }
}
//*********************************************************************
//
// CommunityID Property
//
// Represents the community associated with the section.
//
//*********************************************************************
public int CommunityID {
get { return _communityID; }
}
//*********************************************************************
//
// Name Property
//
// Represents the section name which is used when building
// the section URL.
//
//*********************************************************************
public string Name {
get { return _name; }
}
//*********************************************************************
//
// Path Property
//
// Represents the section URL.
//
//*********************************************************************
public string Path {
get { return _path; }
}
//*********************************************************************
//
// Title Property
//
// Represents the full name of the section.
//
//*********************************************************************
public string Title {
get { return _title; }
}
//*********************************************************************
//
// MenuTitle Property
//
// Represents the title of the section displayed in menus.
//
//*********************************************************************
public string MenuTitle {
get { return _menuTitle; }
}
//*********************************************************************
//
// BriefDescription Property
//
// Represents the brief description of the section.
//
//*********************************************************************
public string Description {
get { return _description; }
}
//*********************************************************************
//
// IsEnabled Property
//
// When false, section is not displayed in menus.
//
//*********************************************************************
public bool IsEnabled {
get { return _isEnabled;}
}
//*********************************************************************
//
// IsSystem Property
//
// When true, section is a system section (for example, the home section).
//
//*********************************************************************
public bool IsSystem {
get { return _isSystem;}
}
//*********************************************************************
//
// PageType Property
//
// Represents the type of content contained in the section.
//
//*********************************************************************
public int PageType {
get { return _pageType; }
}
//*********************************************************************
//
// IsWebBoxesInherited Property
//
// Indicates whether Web boxes are inherited from parent section.
//
//*********************************************************************
public bool IsWebBoxesInherited {
get { return _isWebBoxesInherited; }
}
//*********************************************************************
//
// WebBoxes Property
//
// Represents the Web boxes displayed in this section.
//
//*********************************************************************
public string[] WebBoxes {
get { return _webBoxes; }
set { _webBoxes = value; }
}
//*********************************************************************
//
// WebBoxDisplayMode Property
//
// Indicates how Web boxes should be displayed.
//
//*********************************************************************
public int WebBoxDisplayMode {
get { return _webBoxDisplayMode; }
}
//*********************************************************************
//
// IsWebSeriveBoxesInherited Property
//
// Indicates whether Web service boxes are inherited
// from parent section.
//
//*********************************************************************
public bool IsWebServiceBoxesInherited {
get { return _isWebServiceBoxesInherited; }
}
//*********************************************************************
//
// WebServiceBoxes Property
//
// Represents the Web service boxes for this section.
//
//*********************************************************************
public string[] WebServiceBoxes {
get { return _webServiceBoxes; }
set { _webServiceBoxes = value; }
}
//*********************************************************************
//
// WebServiceBoxDisplayMode Property
//
// Indicates how Web service boxes are displayed.
//
//*********************************************************************
public int WebServiceBoxDisplayMode {
get { return _webServiceBoxDisplayMode; }
}
//*********************************************************************
//
// Skin Property
//
// Represents the page skin used for this section.
//
//*********************************************************************
public string Skin {
get { return _skin; }
}
//*********************************************************************
//
// Style Property
//
// Represents the cascading style sheet applied to this section.
//
//*********************************************************************
public string Style {
get { return _style; }
}
//*********************************************************************
//
// ParentSectionID Property
//
// Represents the parent section of this section.
//
//*********************************************************************
public int ParentSectionID {
get { return _parentSectionID; }
}
//*********************************************************************
//
// Logo Property
//
// Represents the image that appears for this section.
//
//*********************************************************************
public string Logo {
get { return _logo; }
}
//*********************************************************************
//
// Page Header Property
//
// Represents the page header text.
//
//*********************************************************************
public string PageHeader {
get { return _pageHeader; }
}
//*********************************************************************
//
// Page Footer Property
//
// Represents the page footer text.
//
//*********************************************************************
public string PageFooter {
get { return _pageFooter; }
}
//*********************************************************************
//
// Footer Property
//
// Represents the very bottom footer text.
//
//*********************************************************************
public string Footer {
get { return _footer; }
}
//*********************************************************************
//
// PageMetaDesc Property
//
// Represents the meta description.
//
//*********************************************************************
public string PageMetaDesc {
get { return _pageMetaDesc; }
}
//*********************************************************************
//
// PageMetaKeys Property
//
// Represents the page meta keys.
//
//*********************************************************************
public string PageMetaKeys {
get { return _pageMetaKeys; }
}
//*********************************************************************
//
// ViewRoles Property
//
// Represents the roles of users who can view pages in this section.
//
//*********************************************************************
public string[] ViewRoles {
get { return _viewRoles; }
}
//*********************************************************************
//
// AddRoles Property
//
// Represents the roles of users who can add pages to this section.
//
//*********************************************************************
public string[] AddRoles {
get { return _addRoles; }
}
//*********************************************************************
//
// EditRoles Property
//
// Represents the roles of users who can edit pages in this section.
//
//*********************************************************************
public string[] EditRoles {
get { return _editRoles; }
}
//*********************************************************************
//
// DeleteRoles Property
//
// Represents the roles of users who can delete pages in this section.
//
//*********************************************************************
public string[] DeleteRoles {
get { return _deleteRoles; }
}
//*********************************************************************
//
// RecordsPerPage Property
//
// Represents the number of content items to display in the
// section default page.
//
//*********************************************************************
public int RecordsPerPage {
get { return _recordsPerPage; }
}
//*********************************************************************
//
// EnableTopics Property
//
// Indicates whether content in this section should be
// categorized by topic.
//
//*********************************************************************
public bool EnableTopics {
get { return _enableTopics; }
}
//*********************************************************************
//
// EnableComments Property
//
// Indicates whether users should be allowed to add comments to
// content items in this section.
//
//*********************************************************************
public bool EnableComments {
get { return _enableComments; }
}
//*********************************************************************
//
// CommentRoles Property
//
// Represents the roles of users who can comment on pages in this section.
//
//*********************************************************************
public string[] CommentRoles {
get { return _commentRoles; }
}
//*********************************************************************
//
// EnableModeration Property
//
// Indicates whether content must be moderated before it is
// displayed..
//
//*********************************************************************
public bool EnableModeration {
get { return _enableModeration; }
}
//*********************************************************************
//
// ModerateRoles Property
//
// Represents the roles of users who can moderate pages in this section.
//
//*********************************************************************
public string[] ModerateRoles {
get { return _moderateRoles; }
}
//*********************************************************************
//
// EnableRatings Property
//
// Indicates whether users can rate content in this section.
//
//*********************************************************************
public bool EnableRatings {
get { return _enableRatings; }
}
//*********************************************************************
//
// EnableCommentRatings Property
//
// Indicates whether users can rate comments in this section.
//
//*********************************************************************
public bool EnableCommentRatings {
get { return _enableCommentRatings; }
}
//*********************************************************************
//
// RateRoles Property
//
// Represents the roles of users who can rate pages in this section.
//
//*********************************************************************
public string[] RateRoles {
get { return _rateRoles; }
}
//*********************************************************************
//
// EnableNotifications Property
//
// Indicates whether users can receive email notifications when
// new content is added to this section.
//
//*********************************************************************
public bool EnableNotifications {
get { return _enableNotifications; }
}
//*********************************************************************
//
// InheritTransformations Property
//
// Indicates whether transformations are inherited from the parent
// section.
//
//*********************************************************************
public bool InheritTransformations {
get { return _inheritTransformations; }
}
//*********************************************************************
//
// Transformations Property
//
// Represents the transformations that are applied to text
// in this section.
//
//*********************************************************************
public string Transformations {
get { return _transformations; }
}
//*********************************************************************
//
// IsSectionWebService Property
//
// Indicates whether this section is exposed as a Web service.
//
//*********************************************************************
public bool IsSectionWebService {
get { return _isSectionWebService; }
}
//*********************************************************************
//
// WebServicePassword Property
//
// Represents the password needed to access this section's Web service.
//
//*********************************************************************
public string WebServicePassword {
get { return _webServicePassword; }
}
//*********************************************************************
//
// AllowHtmlInput Property
//
// Represents whether or not users are allowed to add HTML content to forms.
//
//*********************************************************************
public AllowHtml AllowHtmlInput {
get { return _allowHtmlInput; }
}
//*********************************************************************
//
// AllowCommentHtmlInput Property
//
// Represents whether or not users are allowed to add HTML content to comments.
//
//*********************************************************************
public AllowHtml AllowCommentHtmlInput {
get { return _allowCommentHtmlInput; }
}
//*********************************************************************
//
// Content Property
//
// Represents the fully qualified assembly name that
// represents the content displayed by this section.
//
//*********************************************************************
public string Content {
get { return _content; }
}
//*********************************************************************
//
// SectionInfo Constructor
//
// Initializes the SectionInfo object with a DataRow.
//
//*********************************************************************
public SectionInfo(DataRow drowSection, DataRow[] drowSectionSecurity, DataRow[] drowWebBoxes, DataRow[] drowWebServiceBoxes) {
_id = (int)drowSection[ "section_id" ];
_communityID = (int)drowSection[ "section_communityID" ];
_name = (string)drowSection[ "section_name" ];
_title = (string)drowSection[ "section_title" ];
_menuTitle = (string)drowSection[ "section_menuTitle" ];
_description = (string)drowSection[ "section_description" ];
_isEnabled = (bool)drowSection["section_isEnabled"];
_isSystem = (bool)drowSection["section_isSystem"];
_pageType = (int)drowSection[ "section_pageType" ];
_skin = (string)drowSection[ "section_pageSkin" ];
_style = (string)drowSection[ "section_pageStyle" ];
_parentSectionID = (int)drowSection[ "section_parentID" ];
_isWebBoxesInherited = (bool)drowSection[ "section_isWebBoxesInherited" ];
_webBoxes = SplitBoxes(drowWebBoxes);
_webBoxDisplayMode = (int)drowSection[ "section_webBoxDisplayMode" ];
_isWebServiceBoxesInherited = (bool)drowSection["section_isWebServiceBoxesInherited"];
_webServiceBoxes = SplitServiceBoxes(drowWebServiceBoxes);
_webServiceBoxDisplayMode = (int)drowSection["section_webServiceBoxDisplayMode"];
_logo = (string)drowSection[ "section_logo" ];
_pageHeader = (string)drowSection[ "section_pageHeader" ];
_pageFooter = (string)drowSection[ "section_pageFooter" ];
_footer = (string)drowSection[ "section_footer" ];
_pageMetaKeys = (string)drowSection[ "section_pageMetaKeys" ];
_pageMetaDesc = (string)drowSection[ "section_pageMetaDesc" ];
_viewRoles = SplitRoles(drowSectionSecurity, RoleType.ViewRole);
_addRoles = SplitRoles(drowSectionSecurity, RoleType.AddRole);;
_editRoles = SplitRoles(drowSectionSecurity, RoleType.EditRole);;
_deleteRoles = SplitRoles(drowSectionSecurity, RoleType.DeleteRole);
_recordsPerPage = ((int)drowSection[ "section_recordsPerPage" ]);
_enableTopics = (bool)drowSection[ "section_enableTopics" ];
_enableComments = (bool)drowSection[ "section_enableComments" ];
_commentRoles = SplitRoles(drowSectionSecurity, RoleType.CommentRole);
_enableModeration = (bool)drowSection[ "section_enableModeration" ];
_moderateRoles = SplitRoles(drowSectionSecurity, RoleType.ModerateRole);
_enableRatings = (bool)drowSection[ "section_enableRatings" ];
_enableCommentRatings = (bool)drowSection[ "section_enableCommentRatings" ];
_rateRoles = SplitRoles(drowSectionSecurity, RoleType.RateRole);
_enableNotifications = (bool)drowSection["section_enableNotifications"];
_inheritTransformations = (bool)drowSection[ "section_inheritTransformations" ];
_transformations = (string)drowSection[ "section_transformations" ];
_isSectionWebService = (bool)drowSection[ "section_isSectionWebService" ];
_webServicePassword = (string)drowSection[ "section_webServicePassword" ];
_allowHtmlInput = (AllowHtml)drowSection["section_allowHtmlInput"];
_allowCommentHtmlInput = (AllowHtml)drowSection["section_allowCommentHtmlInput"];
_content = (string)drowSection[ "pageType_pageContent" ];
_path = (string)drowSection["section_path"];
}
public SectionInfo(){}
private string[] SplitRoles(DataRow[] allRoles, RoleType sectionRoleType) {
ArrayList colRoles = new ArrayList();
foreach (DataRow row in allRoles)
if ((RoleType)row["ss_roleType"] == sectionRoleType)
colRoles.Add( row["ss_role"] );
return (string[])colRoles.ToArray(typeof(String));
}
private string[] SplitBoxes(DataRow[] allBoxes) {
ArrayList colBoxes = new ArrayList();
foreach (DataRow row in allBoxes)
colBoxes.Add( row["sw_webBox"] );
return (string[])colBoxes.ToArray(typeof(String));
}
private string[] SplitServiceBoxes(DataRow[] allBoxes) {
ArrayList colBoxes = new ArrayList();
foreach (DataRow row in allBoxes)
colBoxes.Add( row["sw_webServiceBox"] );
return (string[])colBoxes.ToArray(typeof(String));
}
}
}
相对来说,这个类更为复杂,有section通用属性,如id ,title,name,display,更有section的类别,角色分配(不同的角色权限),更重要的是控件,及控件的格式等.其对应的数据表有:
Community_Sections,Community_SectionSecurity,Community_SectionServerSubscriptions,Community_SectionWebBoxes,Community_SectionWebServiceBoxes.
还有一些存储过程,进行表的操作,不在一一列出.
using System;
using System.Collections;
using System.Data;
//*********************************************************************
//
// SectionInfo Class
//
// Represents all the information about a section.
//
//*********************************************************************
public class SectionInfo {
int _id;
int _communityID;
string _name;
string _title;
string _menuTitle;
string _path;
string _description;
bool _isEnabled;
bool _isSystem;
int _pageType;
bool _isWebBoxesInherited;
string[] _webBoxes;
int _webBoxDisplayMode;
bool _isWebServiceBoxesInherited;
string[] _webServiceBoxes;
int _webServiceBoxDisplayMode;
string _skin;
string _style;
int _parentSectionID;
string _logo;
string _pageHeader;
string _pageFooter;
string _footer;
string _pageMetaKeys;
string _pageMetaDesc;
string[] _viewRoles;
string[] _addRoles;
string[] _editRoles;
string[] _deleteRoles;
int _recordsPerPage = 10;
bool _enableTopics;
bool _enableComments;
string[] _commentRoles;
bool _enableModeration;
string[] _moderateRoles;
bool _enableRatings;
bool _enableCommentRatings;
string[] _rateRoles;
bool _enableNotifications;
bool _inheritTransformations;
string _transformations;
bool _isSectionWebService;
string _webServicePassword;
AllowHtml _allowHtmlInput;
AllowHtml _allowCommentHtmlInput;
string _content;
//*********************************************************************
//
// ID Property
//
// Represents the section ID.
//
//*********************************************************************
public int ID {
get { return _id; }
}
//*********************************************************************
//
// CommunityID Property
//
// Represents the community associated with the section.
//
//*********************************************************************
public int CommunityID {
get { return _communityID; }
}
//*********************************************************************
//
// Name Property
//
// Represents the section name which is used when building
// the section URL.
//
//*********************************************************************
public string Name {
get { return _name; }
}
//*********************************************************************
//
// Path Property
//
// Represents the section URL.
//
//*********************************************************************
public string Path {
get { return _path; }
}
//*********************************************************************
//
// Title Property
//
// Represents the full name of the section.
//
//*********************************************************************
public string Title {
get { return _title; }
}
//*********************************************************************
//
// MenuTitle Property
//
// Represents the title of the section displayed in menus.
//
//*********************************************************************
public string MenuTitle {
get { return _menuTitle; }
}
//*********************************************************************
//
// BriefDescription Property
//
// Represents the brief description of the section.
//
//*********************************************************************
public string Description {
get { return _description; }
}
//*********************************************************************
//
// IsEnabled Property
//
// When false, section is not displayed in menus.
//
//*********************************************************************
public bool IsEnabled {
get { return _isEnabled;}
}
//*********************************************************************
//
// IsSystem Property
//
// When true, section is a system section (for example, the home section).
//
//*********************************************************************
public bool IsSystem {
get { return _isSystem;}
}
//*********************************************************************
//
// PageType Property
//
// Represents the type of content contained in the section.
//
//*********************************************************************
public int PageType {
get { return _pageType; }
}
//*********************************************************************
//
// IsWebBoxesInherited Property
//
// Indicates whether Web boxes are inherited from parent section.
//
//*********************************************************************
public bool IsWebBoxesInherited {
get { return _isWebBoxesInherited; }
}
//*********************************************************************
//
// WebBoxes Property
//
// Represents the Web boxes displayed in this section.
//
//*********************************************************************
public string[] WebBoxes {
get { return _webBoxes; }
set { _webBoxes = value; }
}
//*********************************************************************
//
// WebBoxDisplayMode Property
//
// Indicates how Web boxes should be displayed.
//
//*********************************************************************
public int WebBoxDisplayMode {
get { return _webBoxDisplayMode; }
}
//*********************************************************************
//
// IsWebSeriveBoxesInherited Property
//
// Indicates whether Web service boxes are inherited
// from parent section.
//
//*********************************************************************
public bool IsWebServiceBoxesInherited {
get { return _isWebServiceBoxesInherited; }
}
//*********************************************************************
//
// WebServiceBoxes Property
//
// Represents the Web service boxes for this section.
//
//*********************************************************************
public string[] WebServiceBoxes {
get { return _webServiceBoxes; }
set { _webServiceBoxes = value; }
}
//*********************************************************************
//
// WebServiceBoxDisplayMode Property
//
// Indicates how Web service boxes are displayed.
//
//*********************************************************************
public int WebServiceBoxDisplayMode {
get { return _webServiceBoxDisplayMode; }
}
//*********************************************************************
//
// Skin Property
//
// Represents the page skin used for this section.
//
//*********************************************************************
public string Skin {
get { return _skin; }
}
//*********************************************************************
//
// Style Property
//
// Represents the cascading style sheet applied to this section.
//
//*********************************************************************
public string Style {
get { return _style; }
}
//*********************************************************************
//
// ParentSectionID Property
//
// Represents the parent section of this section.
//
//*********************************************************************
public int ParentSectionID {
get { return _parentSectionID; }
}
//*********************************************************************
//
// Logo Property
//
// Represents the image that appears for this section.
//
//*********************************************************************
public string Logo {
get { return _logo; }
}
//*********************************************************************
//
// Page Header Property
//
// Represents the page header text.
//
//*********************************************************************
public string PageHeader {
get { return _pageHeader; }
}
//*********************************************************************
//
// Page Footer Property
//
// Represents the page footer text.
//
//*********************************************************************
public string PageFooter {
get { return _pageFooter; }
}
//*********************************************************************
//
// Footer Property
//
// Represents the very bottom footer text.
//
//*********************************************************************
public string Footer {
get { return _footer; }
}
//*********************************************************************
//
// PageMetaDesc Property
//
// Represents the meta description.
//
//*********************************************************************
public string PageMetaDesc {
get { return _pageMetaDesc; }
}
//*********************************************************************
//
// PageMetaKeys Property
//
// Represents the page meta keys.
//
//*********************************************************************
public string PageMetaKeys {
get { return _pageMetaKeys; }
}
//*********************************************************************
//
// ViewRoles Property
//
// Represents the roles of users who can view pages in this section.
//
//*********************************************************************
public string[] ViewRoles {
get { return _viewRoles; }
}
//*********************************************************************
//
// AddRoles Property
//
// Represents the roles of users who can add pages to this section.
//
//*********************************************************************
public string[] AddRoles {
get { return _addRoles; }
}
//*********************************************************************
//
// EditRoles Property
//
// Represents the roles of users who can edit pages in this section.
//
//*********************************************************************
public string[] EditRoles {
get { return _editRoles; }
}
//*********************************************************************
//
// DeleteRoles Property
//
// Represents the roles of users who can delete pages in this section.
//
//*********************************************************************
public string[] DeleteRoles {
get { return _deleteRoles; }
}
//*********************************************************************
//
// RecordsPerPage Property
//
// Represents the number of content items to display in the
// section default page.
//
//*********************************************************************
public int RecordsPerPage {
get { return _recordsPerPage; }
}
//*********************************************************************
//
// EnableTopics Property
//
// Indicates whether content in this section should be
// categorized by topic.
//
//*********************************************************************
public bool EnableTopics {
get { return _enableTopics; }
}
//*********************************************************************
//
// EnableComments Property
//
// Indicates whether users should be allowed to add comments to
// content items in this section.
//
//*********************************************************************
public bool EnableComments {
get { return _enableComments; }
}
//*********************************************************************
//
// CommentRoles Property
//
// Represents the roles of users who can comment on pages in this section.
//
//*********************************************************************
public string[] CommentRoles {
get { return _commentRoles; }
}
//*********************************************************************
//
// EnableModeration Property
//
// Indicates whether content must be moderated before it is
// displayed..
//
//*********************************************************************
public bool EnableModeration {
get { return _enableModeration; }
}
//*********************************************************************
//
// ModerateRoles Property
//
// Represents the roles of users who can moderate pages in this section.
//
//*********************************************************************
public string[] ModerateRoles {
get { return _moderateRoles; }
}
//*********************************************************************
//
// EnableRatings Property
//
// Indicates whether users can rate content in this section.
//
//*********************************************************************
public bool EnableRatings {
get { return _enableRatings; }
}
//*********************************************************************
//
// EnableCommentRatings Property
//
// Indicates whether users can rate comments in this section.
//
//*********************************************************************
public bool EnableCommentRatings {
get { return _enableCommentRatings; }
}
//*********************************************************************
//
// RateRoles Property
//
// Represents the roles of users who can rate pages in this section.
//
//*********************************************************************
public string[] RateRoles {
get { return _rateRoles; }
}
//*********************************************************************
//
// EnableNotifications Property
//
// Indicates whether users can receive email notifications when
// new content is added to this section.
//
//*********************************************************************
public bool EnableNotifications {
get { return _enableNotifications; }
}
//*********************************************************************
//
// InheritTransformations Property
//
// Indicates whether transformations are inherited from the parent
// section.
//
//*********************************************************************
public bool InheritTransformations {
get { return _inheritTransformations; }
}
//*********************************************************************
//
// Transformations Property
//
// Represents the transformations that are applied to text
// in this section.
//
//*********************************************************************
public string Transformations {
get { return _transformations; }
}
//*********************************************************************
//
// IsSectionWebService Property
//
// Indicates whether this section is exposed as a Web service.
//
//*********************************************************************
public bool IsSectionWebService {
get { return _isSectionWebService; }
}
//*********************************************************************
//
// WebServicePassword Property
//
// Represents the password needed to access this section's Web service.
//
//*********************************************************************
public string WebServicePassword {
get { return _webServicePassword; }
}
//*********************************************************************
//
// AllowHtmlInput Property
//
// Represents whether or not users are allowed to add HTML content to forms.
//
//*********************************************************************
public AllowHtml AllowHtmlInput {
get { return _allowHtmlInput; }
}
//*********************************************************************
//
// AllowCommentHtmlInput Property
//
// Represents whether or not users are allowed to add HTML content to comments.
//
//*********************************************************************
public AllowHtml AllowCommentHtmlInput {
get { return _allowCommentHtmlInput; }
}
//*********************************************************************
//
// Content Property
//
// Represents the fully qualified assembly name that
// represents the content displayed by this section.
//
//*********************************************************************
public string Content {
get { return _content; }
}
//*********************************************************************
//
// SectionInfo Constructor
//
// Initializes the SectionInfo object with a DataRow.
//
//*********************************************************************
public SectionInfo(DataRow drowSection, DataRow[] drowSectionSecurity, DataRow[] drowWebBoxes, DataRow[] drowWebServiceBoxes) {
_id = (int)drowSection[ "section_id" ];
_communityID = (int)drowSection[ "section_communityID" ];
_name = (string)drowSection[ "section_name" ];
_title = (string)drowSection[ "section_title" ];
_menuTitle = (string)drowSection[ "section_menuTitle" ];
_description = (string)drowSection[ "section_description" ];
_isEnabled = (bool)drowSection["section_isEnabled"];
_isSystem = (bool)drowSection["section_isSystem"];
_pageType = (int)drowSection[ "section_pageType" ];
_skin = (string)drowSection[ "section_pageSkin" ];
_style = (string)drowSection[ "section_pageStyle" ];
_parentSectionID = (int)drowSection[ "section_parentID" ];
_isWebBoxesInherited = (bool)drowSection[ "section_isWebBoxesInherited" ];
_webBoxes = SplitBoxes(drowWebBoxes);
_webBoxDisplayMode = (int)drowSection[ "section_webBoxDisplayMode" ];
_isWebServiceBoxesInherited = (bool)drowSection["section_isWebServiceBoxesInherited"];
_webServiceBoxes = SplitServiceBoxes(drowWebServiceBoxes);
_webServiceBoxDisplayMode = (int)drowSection["section_webServiceBoxDisplayMode"];
_logo = (string)drowSection[ "section_logo" ];
_pageHeader = (string)drowSection[ "section_pageHeader" ];
_pageFooter = (string)drowSection[ "section_pageFooter" ];
_footer = (string)drowSection[ "section_footer" ];
_pageMetaKeys = (string)drowSection[ "section_pageMetaKeys" ];
_pageMetaDesc = (string)drowSection[ "section_pageMetaDesc" ];
_viewRoles = SplitRoles(drowSectionSecurity, RoleType.ViewRole);
_addRoles = SplitRoles(drowSectionSecurity, RoleType.AddRole);;
_editRoles = SplitRoles(drowSectionSecurity, RoleType.EditRole);;
_deleteRoles = SplitRoles(drowSectionSecurity, RoleType.DeleteRole);
_recordsPerPage = ((int)drowSection[ "section_recordsPerPage" ]);
_enableTopics = (bool)drowSection[ "section_enableTopics" ];
_enableComments = (bool)drowSection[ "section_enableComments" ];
_commentRoles = SplitRoles(drowSectionSecurity, RoleType.CommentRole);
_enableModeration = (bool)drowSection[ "section_enableModeration" ];
_moderateRoles = SplitRoles(drowSectionSecurity, RoleType.ModerateRole);
_enableRatings = (bool)drowSection[ "section_enableRatings" ];
_enableCommentRatings = (bool)drowSection[ "section_enableCommentRatings" ];
_rateRoles = SplitRoles(drowSectionSecurity, RoleType.RateRole);
_enableNotifications = (bool)drowSection["section_enableNotifications"];
_inheritTransformations = (bool)drowSection[ "section_inheritTransformations" ];
_transformations = (string)drowSection[ "section_transformations" ];
_isSectionWebService = (bool)drowSection[ "section_isSectionWebService" ];
_webServicePassword = (string)drowSection[ "section_webServicePassword" ];
_allowHtmlInput = (AllowHtml)drowSection["section_allowHtmlInput"];
_allowCommentHtmlInput = (AllowHtml)drowSection["section_allowCommentHtmlInput"];
_content = (string)drowSection[ "pageType_pageContent" ];
_path = (string)drowSection["section_path"];
}
public SectionInfo(){}
private string[] SplitRoles(DataRow[] allRoles, RoleType sectionRoleType) {
ArrayList colRoles = new ArrayList();
foreach (DataRow row in allRoles)
if ((RoleType)row["ss_roleType"] == sectionRoleType)
colRoles.Add( row["ss_role"] );
return (string[])colRoles.ToArray(typeof(String));
}
private string[] SplitBoxes(DataRow[] allBoxes) {
ArrayList colBoxes = new ArrayList();
foreach (DataRow row in allBoxes)
colBoxes.Add( row["sw_webBox"] );
return (string[])colBoxes.ToArray(typeof(String));
}
private string[] SplitServiceBoxes(DataRow[] allBoxes) {
ArrayList colBoxes = new ArrayList();
foreach (DataRow row in allBoxes)
colBoxes.Add( row["sw_webServiceBox"] );
return (string[])colBoxes.ToArray(typeof(String));
}
}
}
相对来说,这个类更为复杂,有section通用属性,如id ,title,name,display,更有section的类别,角色分配(不同的角色权限),更重要的是控件,及控件的格式等.其对应的数据表有:
Community_Sections,Community_SectionSecurity,Community_SectionServerSubscriptions,Community_SectionWebBoxes,Community_SectionWebServiceBoxes.
还有一些存储过程,进行表的操作,不在一一列出.
相关文章推荐
- CommunityStarterKit之Communities类及数据库中表和操作
- ASP.NET Community Starter Kit的一个bug
- 使用 ASP.NET Community Starter Kit 建造网站
- 解读ASP.NET Portal Starter Kit(1)——数据库篇
- Commerce starter kit数据库分析
- 解读ASP.NET TimeTracker Starter Kit(1)——数据库篇
- 看Community Starter Kit源码
- ASP.NET Community Starter Kit 的一个可视编辑器
- 解读ASP.NET TimeTracker Starter Kit(1)——数据库篇
- 学习ASP.NET Starter Kit[Community](20050704)
- Community Starter Kit 目录结构
- Community Starter Kit中如何加载外观
- Community Starter Kit -简介
- Community Starter Kit 的 CommunitiesModule类
- 解读ASP.NET Portal Starter Kit(1)——数据库篇
- Community Starter Kit - 功能介绍
- 解读ASP.NET Portal Starter Kit(1)——数据库篇
- Community Starter Kit - 结构
- CommunityStarterKit之区域信息
- dnn6.1开发模板DotNetNuke_Community_06.01.01_StarterKit.rar