CommunityStarterKit之SectionInfo类及数据库中表和操作

原创 2007年10月09日 10:37:00

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.

还有一些存储过程,进行表的操作,不在一一列出.

 

CommunityStarterKit之Communities类及数据库中表和操作

类:namespace ASPNET.StarterKit.Communities {    using System;    using System.Data;    //************...
  • hontao2128
  • hontao2128
  • 2007-10-09 10:20:00
  • 450

hibernate学习之实体类以及crud操

实体类的编写规则 1.实体类的属性是私有的 2.私有属性要使用公开的get,set方法 3.要求实体类有属性作为唯一值(一般使用id值) 4.实体类属性建议不使用基本数据类型,而是使用基本数据类型...
  • m0_37983376
  • m0_37983376
  • 2017-06-09 13:58:59
  • 163

数据库中表的操作

# 创建数据库 DROP DATABASE `test`; CREATE DATABASE IF NOT EXISTS `test`; USE TEST; -- --和#可以用来创建单行注释 # 表...
  • ShaoqunLiu
  • ShaoqunLiu
  • 2016-08-13 21:20:16
  • 184

关于数据库中表被锁定时如何操作表

今天工作过程中同事遇到这样的问题,在对表进行操作时无法完成出现了‘假死’   状态,由于自己也不是很懂,于是查看了资料,总结如下: --首先查询被锁表   select object_name, ...
  • xtongzhen
  • xtongzhen
  • 2016-06-13 21:18:29
  • 654

winform实现对数据库的基本操作

  • 2013年06月07日 18:58
  • 65KB
  • 下载

Oracle数据库中几种常用的集合类操作

没事儿唠唠IT 2016-12-21 00:11 常用的union、union all等就不介绍了,今天唠唠使用频率不高但很好用的集合类操作。 1、INTERSECT: 返回两个结...
  • u011277123
  • u011277123
  • 2017-01-11 17:32:35
  • 199

使表中的项目清空 .rar

  • 2011年11月11日 22:20
  • 12KB
  • 下载

数据库的分类及各自的特点

  • 2009年05月26日 17:40
  • 167KB
  • 下载

python数据库中表的操作

创建表 [root@localhost ~]# cat 1.py #!/usr/bin/env python import MySQLdb def connect_mysql(): db_...
  • zzh_1032399080
  • zzh_1032399080
  • 2017-11-23 08:27:29
  • 113

数据库中表的move操作

在我们的系统中,有大量这样的需求:把表goods中的数据,move到表spec_goods中. (两个表的列是相同的).一般来说,我们知道,最标准的写法是这样的:insert into spec_go...
  • yun15291li
  • yun15291li
  • 2005-06-08 20:42:00
  • 997
收藏助手
不良信息举报
您举报文章:CommunityStarterKit之SectionInfo类及数据库中表和操作
举报原因:
原因补充:

(最多只允许输入30个字)