类:
namespace ASPNET.StarterKit.Communities {
using System;
using System.Data;
//*********************************************************************
//
// CommunityInfo Class
//CommunityInfo类
// Represents all the information about a particular community.
//描述了一个特定(详细)Community的所有信息
//*********************************************************************
public class CommunityInfo {
private int _id;
private string _name;
private Guid _uniqueID;
private string _primaryDomain;
private string _domain;
private string _subDomain;
private string _smtpServer;
private int _databaseQuota;
private bool _isDisplayed;
private bool _enableTopicMenu;
//*********************************************************************
//
// ID Property
//Community的ID 属性
// The value of the identity column.
//标识列的值.
//*********************************************************************
public int ID {
get {return _id;}
}
//*********************************************************************
//
// Name Property
//Community的Name属性
// The name of this community.
//Community的名字
//*********************************************************************
public string Name
{
get {return _name;}
}
//*********************************************************************
//
// UniqueID Property
//
// The globally unique ID of this community.
//Community的全局唯一标识ID
//*********************************************************************
public Guid UniqueID {
get {return _uniqueID;}
}
//*********************************************************************
//
// PrimaryDomain Property
//主域属性
// The domain used when sending emails and forming absolute URLs.
//用于生成绝对URLs和发送emails的域名
//*********************************************************************
public string PrimaryDomain {
get {return _primaryDomain;}
}
//*********************************************************************
//
// Domain Property
//域属性
// The domain name used for matching request for this community.
//用于为此Community匹配的请求的域名称。 //*********************************************************************
public string Domain {
get {return _domain;}
}
//*********************************************************************
//
// SubDomain Property
//
// The sub domain matched when making requests for this community.
//匹配此Community进行请求时的子域
//*********************************************************************
public string SubDomain {
get {return _subDomain;}
}
//*********************************************************************
//
// SmtpServer Property
//smpt服务
// The email server associated with this community.
//Email服务和Community的结合
//*********************************************************************
public string SmtpServer {
get {return _smtpServer;}
}
//*********************************************************************
//
// DatabaseQuota Property
//Database配额
// The total file and image data that can be stored for this community.
//此社区总的文件和图片数据总数
//*********************************************************************
public int DatabaseQuota
{
get {return _databaseQuota;}
}
//*********************************************************************
//
// IsDisplayed Property
//是否显示属性
// Determines whether this community is displayed in the Communities menu.
//决定这个Community是否显示在Communities的菜单里
//*********************************************************************
public bool IsDisplayed
{
get {return _isDisplayed;}
}
//*********************************************************************
//
// EnableTopicMenu Property
//允许主题菜单属性
// Determines whether this community displays topics.
//确定此Community是否显示主题
//*********************************************************************
public bool EnableTopicMenu
{
get {return _enableTopicMenu;}
}
//*********************************************************************
//
// CommunityInfo Constructor
//构造函数(器)
// Retrieves community info from a datarow.
//从datarow(数据库)里得到Community信息
//*********************************************************************
public CommunityInfo(DataRow drow) {
_id = (int)drow["community_id"];
_uniqueID = (Guid)drow["community_uniqueID"];
_primaryDomain = (string)drow["community_primaryDomain"];
_domain = (string)drow["community_domain"];
_subDomain = (string)drow["community_subDomain"];
_smtpServer = (string)drow["community_smtpServer"];
_name = (string)drow["community_name"];
_databaseQuota = (int)drow["community_databaseQuota"];
_isDisplayed = (bool)drow["community_isDisplayed"];
_enableTopicMenu = (bool)drow["community_enableTopicMenu"];
}
}
我们来看一下相应的数据库中的表:
Community_Communities表:
Community_id int 4(primary key identity(1,1))
Community_name nvarchar 50
Community_uinqueID uniqueidenti 16
Community_PrimaryDomain nvarchar 50
Community_domain nvarchar 50
Community_subdomain nvarchar 50
Community_smtpServer nvarchar 50
Community_databaseQuota int 4
Community_databaseQuotaUsed int 4
Community_sortOrder int 4
Community_isDisplayed bit 1
Community_enableTopicMenu bit 1
数据库操作的存储过程
Community_CommunitiesAddCommunity:添加Community;
Community_CommunitiesDeleteCommunity:删除
Community_CommunitiesGetAllCommunities:读取所有可用的Communities
Community_CommunitiesMoveDown/Up:位置的更新;
Community_CommunitiesUpdateCommunity:更新